move over BackstageSignInResult, BackstageIdentityResponse, BackstageUserIdentity

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-02-09 17:10:18 +01:00
parent b3f3e42036
commit 86b40d464f
17 changed files with 149 additions and 122 deletions
+23
View File
@@ -3,6 +3,29 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { Entity } from '@backstage/catalog-model';
// @public
export interface BackstageIdentityResponse extends BackstageSignInResult {
identity: BackstageUserIdentity;
}
// @public
export interface BackstageSignInResult {
// @deprecated
entity?: Entity;
// @deprecated
id: string;
token: string;
}
// @public
export type BackstageUserIdentity = {
type: 'user';
userEntityRef: string;
ownershipEntityRefs: string[];
};
// @public
export function getBearerTokenFromAuthorizationHeader(
authorizationHeader: unknown,
+1
View File
@@ -20,6 +20,7 @@
},
"dependencies": {
"@backstage/backend-common": "^0.10.7-next.0",
"@backstage/catalog-model": "^0.9.10",
"@backstage/config": "^0.1.13",
"winston": "^3.2.1"
},
+5
View File
@@ -21,3 +21,8 @@
*/
export { getBearerTokenFromAuthorizationHeader } from './getBearerTokenFromAuthorizationHeader';
export type {
BackstageIdentityResponse,
BackstageSignInResult,
BackstageUserIdentity,
} from './types';
+88
View File
@@ -0,0 +1,88 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Entity } from '@backstage/catalog-model';
/**
* A representation of a successful Backstage sign-in.
*
* Compared to the {@link BackstageIdentityResponse} this type omits
* the decoded identity information embedded in the token.
*
* @public
*/
export interface BackstageSignInResult {
/**
* An opaque ID that uniquely identifies the user within Backstage.
*
* This is typically the same as the user entity `metadata.name`.
*
* @deprecated Use the `identity` field instead
*/
id: string;
/**
* The entity that the user is represented by within Backstage.
*
* This entity may or may not exist within the Catalog, and it can be used
* to read and store additional metadata about the user.
*
* @deprecated Use the `identity` field instead.
*/
entity?: Entity;
/**
* The token used to authenticate the user within Backstage.
*/
token: string;
}
/**
* Response object containing the {@link BackstageUserIdentity} and the token
* from the authentication provider.
*
* @public
*/
export interface BackstageIdentityResponse extends BackstageSignInResult {
/**
* A plaintext description of the identity that is encapsulated within the token.
*/
identity: BackstageUserIdentity;
}
/**
* User identity information within Backstage.
*
* @public
*/
export type BackstageUserIdentity = {
/**
* The type of identity that this structure represents. In the frontend app
* this will currently always be 'user'.
*/
type: 'user';
/**
* The entityRef of the user in the catalog.
* For example User:default/sandra
*/
userEntityRef: string;
/**
* The user and group entities that the user claims ownership through
*/
ownershipEntityRefs: string[];
};