Skip to content

Instantly share code, notes, and snippets.

@cal0610
Last active November 2, 2022 03:34
Show Gist options
  • Save cal0610/4448d14eb4a5a9139c26d32c64d2c3d9 to your computer and use it in GitHub Desktop.
Save cal0610/4448d14eb4a5a9139c26d32c64d2c3d9 to your computer and use it in GitHub Desktop.
lambda authoriser
const medium_username = ssm.StringParameter.fromStringParameterName(this, 'medium_username', 'medium_username');
const medium_password = ssm.StringParameter.fromStringParameterName(this, 'medium_password', 'medium_password');
const authorizerFn = new NodejsFunction(this, 'BasicAuthAuthorizer', {
entry: join(__dirname, '..', 'lambda', '/authorizer.ts'),
handler: 'authorizer',
environment: {
medium_username: medium_username.stringValue,
medium_password: medium_password.stringValue,
},
});
const authorizer = new TokenAuthorizer(this, 'token-authorizer', {
handler: authorizerFn,
identitySource: 'method.request.header.Authorization',
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment