Class WebSocketLambdaAuthorizer
Authorize WebSocket Api routes via a lambda function.
Implements
Namespace: Amazon.CDK.AwsApigatewayv2Authorizers
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class WebSocketLambdaAuthorizer : DeputyBase, IWebSocketRouteAuthorizer
Syntax (vb)
Public Class WebSocketLambdaAuthorizer Inherits DeputyBase Implements IWebSocketRouteAuthorizer
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AwsApigatewayv2Authorizers;
using Amazon.CDK.AwsApigatewayv2Integrations;
// This function handles your auth logic
Function authHandler;
// This function handles your WebSocket requests
Function handler;
var authorizer = new WebSocketLambdaAuthorizer("Authorizer", authHandler);
var integration = new WebSocketLambdaIntegration("Integration", handler);
new WebSocketApi(this, "WebSocketApi", new WebSocketApiProps {
ConnectRouteOptions = new WebSocketRouteOptions {
Integration = integration,
Authorizer = authorizer
}
});
Synopsis
Constructors
WebSocketLambdaAuthorizer(string, IFunction, IWebSocketLambdaAuthorizerProps?) | Authorize WebSocket Api routes via a lambda function. |
Methods
Bind(IWebSocketRouteAuthorizerBindOptions) | Bind this authorizer to a specified WebSocket route. |
Constructors
WebSocketLambdaAuthorizer(string, IFunction, IWebSocketLambdaAuthorizerProps?)
Authorize WebSocket Api routes via a lambda function.
public WebSocketLambdaAuthorizer(string id, IFunction handler, IWebSocketLambdaAuthorizerProps? props = null)
Parameters
- id string
- handler IFunction
- props IWebSocketLambdaAuthorizerProps
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AwsApigatewayv2Authorizers;
using Amazon.CDK.AwsApigatewayv2Integrations;
// This function handles your auth logic
Function authHandler;
// This function handles your WebSocket requests
Function handler;
var authorizer = new WebSocketLambdaAuthorizer("Authorizer", authHandler);
var integration = new WebSocketLambdaIntegration("Integration", handler);
new WebSocketApi(this, "WebSocketApi", new WebSocketApiProps {
ConnectRouteOptions = new WebSocketRouteOptions {
Integration = integration,
Authorizer = authorizer
}
});
Methods
Bind(IWebSocketRouteAuthorizerBindOptions)
Bind this authorizer to a specified WebSocket route.
public virtual IWebSocketRouteAuthorizerConfig Bind(IWebSocketRouteAuthorizerBindOptions options)
Parameters
Returns
IWebSocketRouteAuthorizerConfig
Remarks
ExampleMetadata: infused