Class RequestAuthorizer.Builder

java.lang.Object
software.amazon.awscdk.services.apigateway.RequestAuthorizer.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<RequestAuthorizer>
Enclosing class:
RequestAuthorizer

@Stability(Stable) public static final class RequestAuthorizer.Builder extends Object implements software.amazon.jsii.Builder<RequestAuthorizer>
A fluent builder for RequestAuthorizer.
  • 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

      @Stability(Stable) public RequestAuthorizer.Builder handler(IFunction 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

      @Stability(Stable) public RequestAuthorizer.Builder assumeRole(IRole 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

      @Stability(Stable) public RequestAuthorizer.Builder authorizerName(String 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

      @Stability(Stable) public RequestAuthorizer.Builder resultsCacheTtl(Duration 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

      @Stability(Stable) public RequestAuthorizer.Builder identitySources(List<String> 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

      @Stability(Stable) public RequestAuthorizer build()
      Specified by:
      build in interface software.amazon.jsii.Builder<RequestAuthorizer>
      Returns:
      a newly built instance of RequestAuthorizer.