Class TokenAuthorizer.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<TokenAuthorizer>
- Enclosing class:
TokenAuthorizer
TokenAuthorizer
.-
Method Summary
Modifier and TypeMethodDescriptionassumeRole
(IRole assumeRole) An optional IAM role for APIGateway to assume before calling the Lambda-based authorizer.authorizerName
(String authorizerName) An optional human friendly name for the authorizer.build()
static TokenAuthorizer.Builder
The handler for the authorizer lambda function.identitySource
(String identitySource) The request header mapping expression for the bearer token.resultsCacheTtl
(Duration resultsCacheTtl) How long APIGateway should cache the results.validationRegex
(String validationRegex) An optional regex to be matched against the authorization token.
-
Method Details
-
create
@Stability(Stable) public static TokenAuthorizer.Builder create(software.constructs.Construct scope, String id) - Parameters:
scope
- This parameter is required.id
- This parameter is required.- Returns:
- a new instance of
TokenAuthorizer.Builder
.
-
handler
The handler for the authorizer lambda function.The handler must follow a very specific protocol on the input it receives and the output it needs to produce. API Gateway has documented the handler's input specification
invalid @link
{@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-input.html
invalid @link
{@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html
- Parameters:
handler
- The handler for the authorizer lambda function. This parameter is required.- Returns:
this
-
assumeRole
An optional IAM role for APIGateway to assume before calling the Lambda-based authorizer.The IAM role must be assumable by 'apigateway.amazonaws.com'.
Default: - A resource policy is added to the Lambda function allowing apigateway.amazonaws.com to invoke the function.
- Parameters:
assumeRole
- An optional IAM role for APIGateway to assume before calling the Lambda-based authorizer. This parameter is required.- Returns:
this
-
authorizerName
An optional human friendly name for the authorizer.Note that, this is not the primary identifier of the authorizer.
Default: - the unique construcrt ID
- Parameters:
authorizerName
- An optional human friendly name for the authorizer. This parameter is required.- Returns:
this
-
resultsCacheTtl
How long APIGateway should cache the results.Max 1 hour. Disable caching by setting this to 0.
Default: Duration.minutes(5)
- Parameters:
resultsCacheTtl
- How long APIGateway should cache the results. This parameter is required.- Returns:
this
-
identitySource
The request header mapping expression for the bearer token.This is typically passed as part of the header, in which case this should be
method.request.header.Authorizer
where Authorizer is the header containing the bearer token.Default: `IdentitySource.header('Authorization')`
- Parameters:
identitySource
- The request header mapping expression for the bearer token. This parameter is required.- Returns:
this
- See Also:
-
validationRegex
An optional regex to be matched against the authorization token.When matched the authorizer lambda is invoked, otherwise a 401 Unauthorized is returned to the client.
Default: - no regex filter will be applied.
- Parameters:
validationRegex
- An optional regex to be matched against the authorization token. This parameter is required.- Returns:
this
-
build
- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<TokenAuthorizer>
- Returns:
- a newly built instance of
TokenAuthorizer
.
-