adding express.Request back to interface

I tried to use the node-fetch request, however the express handlers
appear to be passing down express.Request so its seems to be the right
choice.

Signed-off-by: Brian Fletcher <brian@roadie.io>
This commit is contained in:
Brian Fletcher
2022-08-16 11:58:59 +01:00
parent c7e6c23c38
commit 90223b820b
4 changed files with 12 additions and 4 deletions
@@ -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;
+4 -1
View File
@@ -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<BackstageIdentityResponse | undefined>;
getIdentity(
req: Request<any>,
): Promise<BackstageIdentityResponse | undefined>;
}