Class RequestAuthorizer.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<RequestAuthorizer>
- Enclosing class:
RequestAuthorizer
RequestAuthorizer
.-
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 RequestAuthorizer.Builder
The handler for the authorizer lambda function.identitySources
(List<String> identitySources) An array of request header mapping expressions for identities.resultsCacheTtl
(Duration resultsCacheTtl) How long APIGateway should cache the results.
-
Method Details
-
create
@Stability(Stable) public static RequestAuthorizer.Builder create(software.constructs.Construct scope, String id) - Parameters:
scope
- This parameter is required.id
- This parameter is required.- Returns:
- a new instance of
RequestAuthorizer.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 and output specification.
- 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 construct 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
-
identitySources
An array of request header mapping expressions for identities.Supported parameter types are Header, Query String, Stage Variable, and Context. For instance, extracting an authorization token from a header would use the identity source
IdentitySource.header('Authorization')
.Note: API Gateway uses the specified identity sources as the request authorizer caching key. When caching is enabled, API Gateway calls the authorizer's Lambda function only after successfully verifying that all the specified identity sources are present at runtime. If a specified identify source is missing, null, or empty, API Gateway returns a 401 Unauthorized response without calling the authorizer Lambda function.
- Parameters:
identitySources
- An array of request header mapping expressions for identities. This parameter is required.- Returns:
this
- See Also:
-
build
- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<RequestAuthorizer>
- Returns:
- a newly built instance of
RequestAuthorizer
.
-