class WebSocketLambdaAuthorizer
Language | Type name |
---|---|
![]() | Amazon.CDK.AwsApigatewayv2Authorizers.WebSocketLambdaAuthorizer |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsapigatewayv2authorizers#WebSocketLambdaAuthorizer |
![]() | software.amazon.awscdk.aws_apigatewayv2_authorizers.WebSocketLambdaAuthorizer |
![]() | aws_cdk.aws_apigatewayv2_authorizers.WebSocketLambdaAuthorizer |
![]() | aws-cdk-lib » aws_apigatewayv2_authorizers » WebSocketLambdaAuthorizer |
Implements
IWeb
Authorize WebSocket Api routes via a lambda function.
Example
import { WebSocketLambdaAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
import { WebSocketLambdaIntegration } from 'aws-cdk-lib/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.