[@aws-cdk/aws-apigatewayv2] support authorizers for HTTP API
See original GitHub issueI want to be able to add an authorizer when calling the addRoutes method. Similar to what is done in the apigateway construct: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apigateway.MethodOptions.html
Use Case
There are no straightforward to add an authorizer on HTTP API routes. This is an important security feature. Workaround are already available in blogposts: https://dev.to/martzcodes/token-authorizers-with-apigatewayv2-tricks-apigwv1-doesn-t-want-you-to-know-41jn
Proposed Solution
One solution would be to add an authorizer
property on the addRoutes
method:
const api = new HttpApi(this, 'Api', { .. });
const authorizer = new CfnAuthorizer(this, 'ApiAuthorizer', { ... });
api.addRoutes({
path: '/route',
methods: [ HttpMethod.GET ],
integration: new LambdaProxyIntegration({ handler: Example }),
authorizer: authorizer,
});
- 👋 I may be able to implement this feature request
- ⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 3 years ago
- Reactions:45
- Comments:38 (15 by maintainers)
Top Results From Across the Web
aws-cdk/aws-apigatewayv2-authorizers module
API Gateway supports multiple mechanisms for controlling and managing access to your HTTP API. They are mainly classified into Lambda Authorizers, ...
Read more >@aws-cdk/aws-apigatewayv2-authorizers - npm
API Gateway supports multiple mechanisms for controlling and managing access to your HTTP API. They are mainly classified into Lambda ...
Read more >@aws-cdk/aws-apigatewayv2-authorizers NPM | npm.io
API Gateway supports multiple mechanisms for controlling and managing access to your HTTP API. They are mainly classified into Lambda Authorizers, JWT ...
Read more >AWS API with lambda Authorizer simple CDK code
Amazon API Gateway is an AWS service for creating, publishing, maintaining, monitoring, and securing REST, HTTP, and WebSocket APIs at any scale.
Read more >@aws-cdk/aws-apigatewayv2 - NPM Package Overview
Amazon API Gateway is an AWS service for creating, publishing, maintaining, monitoring, and securing REST, HTTP, and WebSocket APIs at any ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
any updates on adding authorizer to http api route?
Hey all, we just merged https://github.com/aws/aws-cdk/pull/10972 which introduces support for JWT authorizers, and a convenience cognito user pool authorizer. Just the
REQUEST
authorizer needed to completely close this ticket