From 8022ad5eec2366d8e45b3ee8fc6dc60c4dc3089c Mon Sep 17 00:00:00 2001 From: Gordon Martin Date: Tue, 23 Jan 2024 19:54:55 +0000 Subject: [PATCH] Hardcode 'tokenSourceExpression' - will add discussion to PR description --- packages/aws/src/api-gateway/auth.ts | 17 ----------------- packages/aws/src/api-gateway/utils.ts | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/packages/aws/src/api-gateway/auth.ts b/packages/aws/src/api-gateway/auth.ts index 693e886..4e36bb3 100644 --- a/packages/aws/src/api-gateway/auth.ts +++ b/packages/aws/src/api-gateway/auth.ts @@ -1,7 +1,6 @@ export type JWTAuthorizerConfig = { type: "jwt"; name: string; - tokenSourceExpression: string; issuer: string; audience: string[]; scopes: string[]; @@ -23,27 +22,11 @@ export const jwtAuthorizerConfig = ( ({ type: "jwt", name: name, - tokenSourceExpression: `$request.header.Authorization`, issuer: issuer, scopes: scopes, audience: audience, }) as const; -export const jwtWebsocketAuthorizerConfig = ( - name: string, - authorizationQueryParamField = "Authorization", - issuer: string, - scopes: [], - audience: string[], -) => ({ - type: "jwt" as "jwt", - name: name, - tokenSourceExpression: `$request.querystring.${authorizationQueryParamField}`, - issuer: issuer, - scopes: scopes, - audience: audience, -}); - export const NO_AUTH = { type: "NONE", scopes: [] as string[], diff --git a/packages/aws/src/api-gateway/utils.ts b/packages/aws/src/api-gateway/utils.ts index bea4974..cde70c4 100644 --- a/packages/aws/src/api-gateway/utils.ts +++ b/packages/aws/src/api-gateway/utils.ts @@ -6,7 +6,7 @@ export const mapAuthConfig = (config: JWTAuthorizerConfig) => { return { Name: config.name, AuthorizerType: jwtType, - IdentitySource: [config.tokenSourceExpression], + IdentitySource: ["$request.header.Authorization"], JwtConfiguration: { Audience: config.audience, Issuer: config.issuer,