HttpLambdaAuthorizerProps
- class aws_cdk.aws_apigatewayv2_authorizers.HttpLambdaAuthorizerProps(*, authorizer_name=None, identity_source=None, response_types=None, results_cache_ttl=None)
Bases:
object
(experimental) Properties to initialize HttpTokenAuthorizer.
- Parameters:
authorizer_name (
Optional
[str
]) – (experimental) Friendly authorizer name. Default: - same value asid
passed in the constructor.identity_source (
Optional
[Sequence
[str
]]) – (experimental) The identity source for which authorization is requested. Default: [‘$request.header.Authorization’]response_types (
Optional
[Sequence
[HttpLambdaResponseType
]]) – (experimental) The types of responses the lambda can return. If HttpLambdaResponseType.SIMPLE is included then response format 2.0 will be used. Default: [HttpLambdaResponseType.IAM]results_cache_ttl (
Optional
[Duration
]) – (experimental) How long APIGateway should cache the results. Max 1 hour. Disable caching by setting this toDuration.seconds(0)
. Default: Duration.minutes(5)
- Stability:
experimental
- ExampleMetadata:
infused
Example:
from aws_cdk.aws_apigatewayv2_authorizers import HttpLambdaAuthorizer, HttpLambdaResponseType from aws_cdk.aws_apigatewayv2_integrations import HttpUrlIntegration # This function handles your auth logic # auth_handler: lambda.Function authorizer = HttpLambdaAuthorizer("BooksAuthorizer", auth_handler, response_types=[HttpLambdaResponseType.SIMPLE] ) api = apigwv2.HttpApi(self, "HttpApi") api.add_routes( integration=HttpUrlIntegration("BooksIntegration", "https://get-books-proxy.myproxy.internal"), path="/books", authorizer=authorizer )
Attributes
- authorizer_name
(experimental) Friendly authorizer name.
- Default:
same value as
id
passed in the constructor.
- Stability:
experimental
- identity_source
(experimental) The identity source for which authorization is requested.
- Default:
[‘$request.header.Authorization’]
- Stability:
experimental
- response_types
(experimental) The types of responses the lambda can return.
If HttpLambdaResponseType.SIMPLE is included then response format 2.0 will be used.
- Default:
[HttpLambdaResponseType.IAM]
- See:
- Stability:
experimental
- results_cache_ttl
(experimental) How long APIGateway should cache the results.
Max 1 hour. Disable caching by setting this to
Duration.seconds(0)
.- Default:
Duration.minutes(5)
- Stability:
experimental