Skip to content

Commit

Permalink
Hardcode 'tokenSourceExpression' - will add discussion to PR description
Browse files Browse the repository at this point in the history
  • Loading branch information
Happy0 committed Jan 23, 2024
1 parent 8eac066 commit 8022ad5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
17 changes: 0 additions & 17 deletions packages/aws/src/api-gateway/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export type JWTAuthorizerConfig = {
type: "jwt";
name: string;
tokenSourceExpression: string;
issuer: string;
audience: string[];
scopes: string[];
Expand All @@ -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[],
Expand Down
2 changes: 1 addition & 1 deletion packages/aws/src/api-gateway/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 8022ad5

Please sign in to comment.