Class TokenAuthorizer.Builder

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

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

      @Stability(Stable) public TokenAuthorizer.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

      invalid @link
      {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-input.html
      | here} and output specification
      invalid @link
      {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html
      | here}.

      Parameters:
      handler - The handler for the authorizer lambda function. This parameter is required.
      Returns:
      this
    • assumeRole

      @Stability(Stable) public TokenAuthorizer.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 TokenAuthorizer.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 construcrt ID

      Parameters:
      authorizerName - An optional human friendly name for the authorizer. This parameter is required.
      Returns:
      this
    • resultsCacheTtl

      @Stability(Stable) public TokenAuthorizer.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
    • identitySource

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

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

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