@Stability(value=Stable) public static final class TokenAuthorizer.Builder extends Object implements software.amazon.jsii.Builder<TokenAuthorizer>
TokenAuthorizer.| Modifier and Type | Method and Description |
|---|---|
TokenAuthorizer.Builder |
assumeRole(IRole assumeRole)
An optional IAM role for APIGateway to assume before calling the Lambda-based authorizer.
|
TokenAuthorizer.Builder |
authorizerName(String authorizerName)
An optional human friendly name for the authorizer.
|
TokenAuthorizer |
build() |
static TokenAuthorizer.Builder |
create(software.constructs.Construct scope,
String id) |
TokenAuthorizer.Builder |
handler(IFunction handler)
The handler for the authorizer lambda function.
|
TokenAuthorizer.Builder |
identitySource(String identitySource)
The request header mapping expression for the bearer token.
|
TokenAuthorizer.Builder |
resultsCacheTtl(Duration resultsCacheTtl)
How long APIGateway should cache the results.
|
TokenAuthorizer.Builder |
validationRegex(String validationRegex)
An optional regex to be matched against the authorization token.
|
@Stability(value=Stable) public static TokenAuthorizer.Builder create(software.constructs.Construct scope, String id)
scope - This parameter is required.id - This parameter is required.TokenAuthorizer.Builder.@Stability(value=Stable) public TokenAuthorizer.Builder handler(IFunction handler)
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 {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-input.html | here} and output specification {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html | here}.
handler - The handler for the authorizer lambda function. This parameter is required.this@Stability(value=Stable) public TokenAuthorizer.Builder assumeRole(IRole assumeRole)
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.
assumeRole - An optional IAM role for APIGateway to assume before calling the Lambda-based authorizer. This parameter is required.this@Stability(value=Stable) public TokenAuthorizer.Builder authorizerName(String authorizerName)
Note that, this is not the primary identifier of the authorizer.
Default: - the unique construcrt ID
authorizerName - An optional human friendly name for the authorizer. This parameter is required.this@Stability(value=Stable) public TokenAuthorizer.Builder resultsCacheTtl(Duration resultsCacheTtl)
Max 1 hour. Disable caching by setting this to 0.
Default: Duration.minutes(5)
resultsCacheTtl - How long APIGateway should cache the results. This parameter is required.this@Stability(value=Stable) public TokenAuthorizer.Builder identitySource(String identitySource)
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')`
identitySource - The request header mapping expression for the bearer token. This parameter is required.this@Stability(value=Stable) public TokenAuthorizer.Builder validationRegex(String validationRegex)
When matched the authorizer lambda is invoked, otherwise a 401 Unauthorized is returned to the client.
Default: - no regex filter will be applied.
validationRegex - An optional regex to be matched against the authorization token. This parameter is required.this@Stability(value=Stable) public TokenAuthorizer build()
build in interface software.amazon.jsii.Builder<TokenAuthorizer>Copyright © 2022. All rights reserved.