class WebSocketLambdaAuthorizer
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.APIGatewayv2.Authorizers.WebSocketLambdaAuthorizer |
Java | software.amazon.awscdk.services.apigatewayv2.authorizers.WebSocketLambdaAuthorizer |
Python | aws_cdk.aws_apigatewayv2_authorizers.WebSocketLambdaAuthorizer |
TypeScript (source) | @aws-cdk/aws-apigatewayv2-authorizers » WebSocketLambdaAuthorizer |
Implements
IWeb
Authorize WebSocket Api routes via a lambda function.
Example
import { WebSocketLambdaAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers';
import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations';
// This function handles your auth logic
declare const authHandler: lambda.Function;
// This function handles your WebSocket requests
declare const handler: lambda.Function;
const authorizer = new WebSocketLambdaAuthorizer('Authorizer', authHandler);
const integration = new WebSocketLambdaIntegration(
'Integration',
handler,
);
new apigwv2.WebSocketApi(this, 'WebSocketApi', {
connectRouteOptions: {
integration,
authorizer,
},
});
Initializer
new WebSocketLambdaAuthorizer(id: string, handler: IFunction, props?: WebSocketLambdaAuthorizerProps)
Parameters
- id
string
- handler
IFunction
- props
Web
Socket Lambda Authorizer Props
Methods
Name | Description |
---|---|
bind(options) | Bind this authorizer to a specified WebSocket route. |
bind(options)
public bind(options: WebSocketRouteAuthorizerBindOptions): WebSocketRouteAuthorizerConfig
Parameters
Returns
Bind this authorizer to a specified WebSocket route.