@aws-cdk_aws-apigatewayv2-authorizers-alpha.WebSocketLambdaAuthorizer

class WebSocketLambdaAuthorizer 🔹

LanguageType name
.NETAmazon.CDK.AWS.Apigatewayv2.Authorizers.Alpha.WebSocketLambdaAuthorizer
Gogithub.com/aws/aws-cdk-go/awscdkapigatewayv2authorizersalpha/v2#WebSocketLambdaAuthorizer
Javasoftware.amazon.awscdk.services.apigatewayv2.authorizers.alpha.WebSocketLambdaAuthorizer
Pythonaws_cdk.aws_apigatewayv2_authorizers_alpha.WebSocketLambdaAuthorizer
TypeScript (source)@aws-cdk/aws-apigatewayv2-authorizers-alpha » WebSocketLambdaAuthorizer

Implements IWebSocketRouteAuthorizer

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 WebSocketLambdaAuthorizerProps

Methods

NameDescription
bind(options)🔹Bind this authorizer to a specified WebSocket route.

bind(options)🔹

public bind(options: WebSocketRouteAuthorizerBindOptions): WebSocketRouteAuthorizerConfig

Parameters

  • options WebSocketRouteAuthorizerBindOptions

Returns

  • WebSocketRouteAuthorizerConfig

Bind this authorizer to a specified WebSocket route.