aws_apigatewayv2: add authorizer to route with HttpApi
See original GitHub issueThe Question
How do I add an authorizer to a route in my HttpApi (with cdk using python)?
http_api = _apigw2.HttpApi(self, "ApiGwId",
api_name="HttpGateway",
cors_preflight=cors_preflight,
)
authorizer = _apigw2.CfnAuthorizer(self, "MyAuthorizer",
api_id=http_api.http_api_id,
authorizer_type="JWT",
jwt_configuration={
"audience": [user_pool_client.user_pool_client_id], "issuer": "myissuer"},
identity_source=[
'$request.header.Authorization'],
name="Myauthorizer",
)
http_api.add_routes(
path='/example',
methods=[_apigw2.HttpMethod.GET],
integration=my_lambda_integration,
)
–>
Environment
- CDK CLI Version: 1.45.0
- Module Version: 1.45.0
- Node.js Version: v14.0.0
- OS: WSL2 in Windows 10
- Language (Version): Python (3.7.3)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
aws-cdk/aws-apigatewayv2-authorizers module
You can set an authorizer to your WebSocket API's $connect route to control access to your API. Lambda Authorizer. Lambda authorizers use a...
Read more >[@aws-cdk/aws-apigatewayv2] support authorizers for HTTP API
I want to be able to add an authorizer when calling the addRoutes method. Similar to what is done in the apigateway construct: ......
Read more >@aws-cdk/aws-apigatewayv2-authorizers-alpha - npm
Access control for Http Apis is managed by restricting which routes can be invoked via. Authorizers and scopes can either be applied to...
Read more >HTTP API Gateway - How to map authorizer to route in ...
As it's currently written, it's hard to tell exactly what you're asking. – Community Bot. Sep 20 at 11:15. Add a comment ...
Read more >terraform-aws-modules/apigateway-v2/aws | Terraform Registry
Terraform module to create an AWS API Gateway v2 (HTTP/WebSocket) ... timeout_milliseconds = 12000 } "GET /some-route-with-authorizer" ...
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
@noorsheikh Here is a sample project in typescript with auth https://github.com/stilren/typescript-cdk-react/blob/master/backend/lib/backend-stack.ts
Figured it out: