Adrián Mouly
06/15/2021, 3:20 AMcustom authorizer
, now I want to reference it from my SST stack, is there any example on how to do that?
const authorizer = new HttpLambdaAuthorizer({
authorizerName: "LambdaAuthorizer",
handler: new Function(this, "Authorizer", {
handler: "src/authorizer.main",
}),
});
Maybe I can specify the ARN somehow?Jad
06/15/2021, 6:44 AMimport * as iam from '@aws-cdk/aws-iam'
import * as lambda from '@aws-cdk/aws-lambda'
import { Duration } from '@aws-cdk/core'
const importedAuthLambda = lambda.Function.fromFunctionArn(this, "importedAuthLambda",
`arn:aws:lambda:${this.region}:${this.account}:function:project-${this.stage}-Authorizer`
)
const authorizer = new apigateway.TokenAuthorizer(this, 'Authorizer', {
handler: importedAuthLambda,
authorizerName: 'Authorizer',
resultsCacheTtl: Duration.seconds(0),
identitySource: apigateway.IdentitySource.header('Authorization'),
})
Frank
Adrián Mouly
06/15/2021, 12:44 PM