feat(apigatewayv2): Lambda authorizer for WebSocket API #16886
feat(apigatewayv2): Lambda authorizer for WebSocket API #16886mergify[bot] merged 16 commits intoaws:masterfrom
Conversation
|
This is perfect! Exactly what I need right now. I was planning to start a PR for myself. Any chance we can prioritize this? |
| '$request.header.Authorization', | ||
| ], | ||
| type: WebSocketAuthorizerType.LAMBDA, | ||
| authorizerName: this.props.authorizerName, |
There was a problem hiding this comment.
Should fall back to the new id constructor arg.
| /** | ||
| * The name of the authorizer | ||
| */ | ||
| readonly authorizerName: string; |
There was a problem hiding this comment.
We need to make this API consistent with HttpLambdaAuthorizer/HttpLambdaAuthorizerProps:
- Move
handlerto the constructor ofWebSocketLambdaAuthorizer. - Pass an
idto the constructor ofWebSocketLambdaAuthorizer.
| const id = this.props.authorizerName; | ||
|
|
||
| this.webSocketApi = options.route.webSocketApi; | ||
| this.authorizer = new WebSocketAuthorizer(options.scope, id, { |
There was a problem hiding this comment.
When you add the new id constructor arg, replace id with this.id.
Pull request has been modified.
|
@otaviomacedo |
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
… `WebSocketLambdaAuthorizer` (#18315) We introduced `WebSocketLambdaAuthorizer` in #16886 with an incorrect default `identitySource`, according to these [docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-authorizer.html#cfn-apigatewayv2-authorizer-identitysource). The result is that using the default `identitySource` results in a deploy-time failure. This PR fixes the error and adds documentation for the syntax for all `identitySource` possibilities. I can confirm that this default successfully passes `cdk deploy` on my local app. Fixes #18307. BREAKING CHANGE: `WebSocketLambdaAuthorizerProps.identitySource` default changes from `['$request.header.Authorization']` to `['route.request.header.Authorization']`. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
closes aws#13869 By this PR, you will be able to enable WebSocket authorizer as the below code: ```ts const integration = new LambdaWebSocketIntegration({ handler, }); const authorizer = new WebSocketLambdaAuthorizer('Authorizer', authHandler); new WebSocketApi(stack, 'WebSocketApi', { connectRouteOptions: { integration, authorizer, }, }); ``` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
… `WebSocketLambdaAuthorizer` (aws#18315) We introduced `WebSocketLambdaAuthorizer` in aws#16886 with an incorrect default `identitySource`, according to these [docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-authorizer.html#cfn-apigatewayv2-authorizer-identitysource). The result is that using the default `identitySource` results in a deploy-time failure. This PR fixes the error and adds documentation for the syntax for all `identitySource` possibilities. I can confirm that this default successfully passes `cdk deploy` on my local app. Fixes aws#18307. BREAKING CHANGE: `WebSocketLambdaAuthorizerProps.identitySource` default changes from `['$request.header.Authorization']` to `['route.request.header.Authorization']`. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
closes #13869
By this PR, you will be able to enable WebSocket authorizer as the below code:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license