class HttpLambdaAuthorizer
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.APIGatewayv2.Authorizers.HttpLambdaAuthorizer |
Java | software.amazon.awscdk.services.apigatewayv2.authorizers.HttpLambdaAuthorizer |
Python | aws_cdk.aws_apigatewayv2_authorizers.HttpLambdaAuthorizer |
TypeScript (source) | @aws-cdk/aws-apigatewayv2-authorizers 禄 HttpLambdaAuthorizer |
Implements
IHttp
Authorize Http Api routes via a lambda function.
Example
import { HttpLambdaAuthorizer, HttpLambdaResponseType } from '@aws-cdk/aws-apigatewayv2-authorizers';
import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations';
// This function handles your auth logic
declare const authHandler: lambda.Function;
const authorizer = new HttpLambdaAuthorizer('BooksAuthorizer', authHandler, {
responseTypes: [HttpLambdaResponseType.SIMPLE], // Define if returns simple and/or iam response
});
const api = new apigwv2.HttpApi(this, 'HttpApi');
api.addRoutes({
integration: new HttpUrlIntegration('BooksIntegration', 'https://get-books-proxy.myproxy.internal'),
path: '/books',
authorizer,
});
Initializer
new HttpLambdaAuthorizer(id: string, handler: IFunction, props?: HttpLambdaAuthorizerProps)
Parameters
- id
string
鈥� The id of the underlying construct. - handler
IFunction
- props
Http
鈥� Properties to configure the authorizer.Lambda Authorizer Props
Initialize a lambda authorizer to be bound with HTTP route.
Methods
Name | Description |
---|---|
bind(options) | Bind this authorizer to a specified Http route. |
bind(options)
public bind(options: HttpRouteAuthorizerBindOptions): HttpRouteAuthorizerConfig
Parameters
- options
Http
Route Authorizer Bind Options
Returns
Bind this authorizer to a specified Http route.