interface HttpLambdaAuthorizerProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AwsApigatewayv2Authorizers.HttpLambdaAuthorizerProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsapigatewayv2authorizers#HttpLambdaAuthorizerProps |
![]() | software.amazon.awscdk.aws_apigatewayv2_authorizers.HttpLambdaAuthorizerProps |
![]() | aws_cdk.aws_apigatewayv2_authorizers.HttpLambdaAuthorizerProps |
![]() | aws-cdk-lib » aws_apigatewayv2_authorizers » HttpLambdaAuthorizerProps |
Properties to initialize HttpTokenAuthorizer.
Example
import { HttpLambdaAuthorizer, HttpLambdaResponseType } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
import { HttpUrlIntegration } from 'aws-cdk-lib/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.example.com'),
path: '/books',
authorizer,
});
Properties
Name | Type | Description |
---|---|---|
authorizer | string | Friendly authorizer name. |
identity | string[] | The identity source for which authorization is requested. |
response | Http [] | The types of responses the lambda can return. |
results | Duration | How long APIGateway should cache the results. |
authorizerName?
Type:
string
(optional, default: same value as id
passed in the constructor.)
Friendly authorizer name.
identitySource?
Type:
string[]
(optional, default: ['$request.header.Authorization'])
The identity source for which authorization is requested.
responseTypes?
Type:
Http
[]
(optional, default: [HttpLambdaResponseType.IAM])
The types of responses the lambda can return.
If HttpLambdaResponseType.SIMPLE is included then response format 2.0 will be used.
resultsCacheTtl?
Type:
Duration
(optional, default: Duration.minutes(5))
How long APIGateway should cache the results.
Max 1 hour.
Disable caching by setting this to Duration.seconds(0)
.