Merge pull request #16614 from backstage/freben/unpack-props
🧹 unpack props inside component bodies
This commit is contained in:
@@ -29,11 +29,9 @@ export class DefaultIdentityClient implements IdentityApi {
|
||||
authenticate(token: string | undefined): Promise<BackstageIdentityResponse>;
|
||||
static create(options: IdentityClientOptions): DefaultIdentityClient;
|
||||
// (undocumented)
|
||||
getIdentity({
|
||||
request,
|
||||
}: IdentityApiGetIdentityRequest): Promise<
|
||||
BackstageIdentityResponse | undefined
|
||||
>;
|
||||
getIdentity(
|
||||
options: IdentityApiGetIdentityRequest,
|
||||
): Promise<BackstageIdentityResponse | undefined>;
|
||||
}
|
||||
|
||||
// @public
|
||||
|
||||
@@ -78,13 +78,16 @@ export class DefaultIdentityClient implements IdentityApi {
|
||||
: ['ES256'];
|
||||
}
|
||||
|
||||
async getIdentity({ request }: IdentityApiGetIdentityRequest) {
|
||||
if (!request.headers.authorization) {
|
||||
async getIdentity(options: IdentityApiGetIdentityRequest) {
|
||||
const {
|
||||
request: { headers },
|
||||
} = options;
|
||||
if (!headers.authorization) {
|
||||
return undefined;
|
||||
}
|
||||
try {
|
||||
return await this.authenticate(
|
||||
getBearerTokenFromAuthorizationHeader(request.headers.authorization),
|
||||
getBearerTokenFromAuthorizationHeader(headers.authorization),
|
||||
);
|
||||
} catch (e) {
|
||||
throw new AuthenticationError(e.message);
|
||||
|
||||
Reference in New Issue
Block a user