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