diff --git a/plugins/auth-node/api-report.md b/plugins/auth-node/api-report.md index 902a3ad0b0..0f1c5bb934 100644 --- a/plugins/auth-node/api-report.md +++ b/plugins/auth-node/api-report.md @@ -4,6 +4,7 @@ ```ts import { PluginEndpointDiscovery } from '@backstage/backend-common'; +import { Request as Request_2 } from 'express'; // @public export interface BackstageIdentityResponse extends BackstageSignInResult { @@ -28,7 +29,7 @@ export class DefaultIdentityClient implements IdentityApi { authenticate(token: string | undefined): Promise; static create(options: IdentityClientOptions): DefaultIdentityClient; // (undocumented) - getIdentity(req: Request): Promise; + getIdentity(req: Request_2): Promise; } // @public @@ -38,7 +39,9 @@ export function getBearerTokenFromAuthorizationHeader( // @public export interface IdentityApi { - getIdentity(req: Request): Promise; + getIdentity( + req: Request_2, + ): Promise; } // @public @deprecated diff --git a/plugins/auth-node/package.json b/plugins/auth-node/package.json index 294bc08889..2ac9a17813 100644 --- a/plugins/auth-node/package.json +++ b/plugins/auth-node/package.json @@ -26,6 +26,7 @@ "@backstage/backend-common": "^0.15.0-next.0", "@backstage/config": "^1.0.1", "@backstage/errors": "^1.1.0", + "express": "^4.17.13", "jose": "^4.6.0", "node-fetch": "^2.6.7", "winston": "^3.2.1" diff --git a/plugins/auth-node/src/DefaultIdentityClient.ts b/plugins/auth-node/src/DefaultIdentityClient.ts index 6d1394bd55..8c09157c5c 100644 --- a/plugins/auth-node/src/DefaultIdentityClient.ts +++ b/plugins/auth-node/src/DefaultIdentityClient.ts @@ -24,6 +24,7 @@ import { jwtVerify, } from 'jose'; import { GetKeyFunction } from 'jose/dist/types/types'; +import { Request } from 'express'; import { BackstageIdentityResponse } from './types'; import { getBearerTokenFromAuthorizationHeader, IdentityApi } from '.'; @@ -77,7 +78,7 @@ export class DefaultIdentityClient implements IdentityApi { async getIdentity(req: Request) { try { return await this.authenticate( - getBearerTokenFromAuthorizationHeader(req.headers.get('authorization')), + getBearerTokenFromAuthorizationHeader(req.headers.authorization), ); } catch (e) { return undefined; diff --git a/plugins/auth-node/src/IdentityApi.ts b/plugins/auth-node/src/IdentityApi.ts index 7aec553101..32a1040d18 100644 --- a/plugins/auth-node/src/IdentityApi.ts +++ b/plugins/auth-node/src/IdentityApi.ts @@ -14,6 +14,7 @@ * limitations under the License. */ import { BackstageIdentityResponse } from './types'; +import { Request } from 'express'; /** * An identity client api to authenticate Backstage @@ -28,5 +29,7 @@ export interface IdentityApi { * Returns a BackstageIdentity (user) matching the token. * The method throws an error if verification fails. */ - getIdentity(req: Request): Promise; + getIdentity( + req: Request, + ): Promise; }