unpack props inside component bodies

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2023-02-27 15:31:15 +01:00
parent babbaa9391
commit 65454876fb
51 changed files with 253 additions and 297 deletions
+3 -5
View File
@@ -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);