@aws-cdk_aws-apigatewayv2-authorizers-alpha.WebSocketLambdaAuthorizer
class WebSocketLambdaAuthorizer
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Apigatewayv2.Authorizers.Alpha.WebSocketLambdaAuthorizer |
![]() | github.com/aws/aws-cdk-go/awscdkapigatewayv2authorizersalpha/v2#WebSocketLambdaAuthorizer |
![]() | software.amazon.awscdk.services.apigatewayv2.authorizers.alpha.WebSocketLambdaAuthorizer |
![]() | aws_cdk.aws_apigatewayv2_authorizers_alpha.WebSocketLambdaAuthorizer |
![]() | @aws-cdk/aws-apigatewayv2-authorizers-alpha » WebSocketLambdaAuthorizer |
Implements
IWeb
Authorize WebSocket Api routes via a lambda function.
Example
import { WebSocketLambdaAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers-alpha';
import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha';
// 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.