(apigatewayv2): Allow to set Lambda authorizer for WebSocket API
See original GitHub issuePlease allow us to set a Lambda authorizer for a WebSocket API. Currently we cannot set it because there’s no interface for it.
Use Case
Restrict access to a WebSocket API by cognito auth or other auth method.
Proposed Solution
Setting an authorizer for a WebSocket API is simple.
You must only set authorizationType
and authorizerId
when creating a CfnRoute
to $connect
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html
Because you can only set authorizer for $connect
route.
And there’s only one authorizer type; LambdaAuthorizer.
Other
- 👋 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 2 years ago
- Reactions:15
- Comments:8 (4 by maintainers)
Top Results From Across the Web
AWS::ApiGatewayV2::Authorizer - AWS CloudFormation
The AWS::ApiGatewayV2::Authorizer resource creates an authorizer for a WebSocket API or an HTTP API. To learn more, see Controlling and managing access to...
Read more >Working with Amazon Lambda authorizers for HTTP APIs
You can enable caching for a Lambda authorizer by specifying an authorizerResultTtlInSeconds. When caching is enabled for an authorizer, API Gateway uses the ......
Read more >Cannot Create Lambda Authorizer Using API Gateway ...
I cannot add a lambda authorizer to my WebSocket API from the AWS Console. When I click the `Create` button, I get a...
Read more >REST API (API Gateway v1)
HTTP Endpoints with Custom Authorizers. Custom Authorizers allow you to run an AWS Lambda Function before your targeted AWS Lambda Function. This is...
Read more >aws_apigatewayv2_authorizer | Resources | hashicorp/aws
Manages an Amazon API Gateway Version 2 authorizer. ... Basic WebSocket API ... Supported only for HTTP API Lambda authorizers. authorizer_uri - (Optional) ......
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
@wakeupmh Hi, here’s an example for that. https://github.com/aws-samples/websocket-api-cognito-auth-sample/tree/main/cdk
You have to create a Lambda function to verify JWTs (implementation is very simple thanks to aws-jwt-veryfy lib), and use the function as a Lambda authorizer.
Also there is a sample for adding Lambda authorizer to a WebSocket API written in TypeScript. https://github.com/aws-samples/websocket-api-cognito-auth-sample/blob/main/cdk/lib/construct/websocket.ts