Skip to content

Commit

Permalink
feat: sort order of auth modes
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch committed Oct 18, 2024
1 parent 42526fa commit 72ad88b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ describe('metrics metadata', () => {
`),
authorizationModes: {
defaultAuthorizationMode: 'API_KEY',
// assert output authorizationModes is sorted correctly
// aws_lambda should be last in list
lambdaConfig: {
function: new NodejsFunction(stack, 'TestAuthorizer', { entry: path.join(__dirname, 'authorizer.ts') }),
ttl: Duration.days(7),
},
apiKeyConfig: { expires: Duration.days(7) },
iamConfig: {
identityPoolId: 'abc',
Expand All @@ -342,10 +348,6 @@ describe('metrics metadata', () => {
assumedBy: new ArnPrincipal('aws:iam::1234:root'),
}),
},
lambdaConfig: {
function: new NodejsFunction(stack, 'TestAuthorizer', { entry: path.join(__dirname, 'authorizer.ts') }),
ttl: Duration.days(7),
},
},
});
const template = Template.fromStack(stack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export const getMetadataAuthorizationModes = (authorizationModes: AuthorizationM
const authModes = Object.keys(authorizationModes)
.map((mode) => configKeyToAuthMode[mode])
// remove values not found in mapping
.filter((mode) => !!mode);
.filter((mode) => !!mode)
.sort();
return authModes.join(',');
};

Expand Down

0 comments on commit 72ad88b

Please sign in to comment.