Class: AWSCDK::APIGateway::CognitoUserPoolsAuthorizerProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
api_gateway/cognito_user_pools_authorizer_props.rb

Overview

Properties for CognitoUserPoolsAuthorizer.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cognito_user_pools:, authorizer_name: nil, identity_source: nil, results_cache_ttl: nil) ⇒ CognitoUserPoolsAuthorizerProps

Returns a new instance of CognitoUserPoolsAuthorizerProps.

Parameters:

  • cognito_user_pools (Array<AWSCDK::Cognito::IUserPool>)

    The user pools to associate with this authorizer.

  • authorizer_name (String, nil) (defaults to: nil)

    An optional human friendly name for the authorizer.

  • identity_source (String, nil) (defaults to: nil)

    The request header mapping expression for the bearer token.

  • results_cache_ttl (AWSCDK::Duration, nil) (defaults to: nil)

    How long APIGateway should cache the results.



11
12
13
14
15
16
17
18
19
20
# File 'api_gateway/cognito_user_pools_authorizer_props.rb', line 11

def initialize(cognito_user_pools:, authorizer_name: nil, identity_source: nil, results_cache_ttl: nil)
  @cognito_user_pools = cognito_user_pools
  Jsii::Type.check_type(@cognito_user_pools, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2duaXRvLklVc2VyUG9vbCJ9LCJraW5kIjoiYXJyYXkifX0=")), "cognitoUserPools")
  @authorizer_name = authorizer_name
  Jsii::Type.check_type(@authorizer_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "authorizerName") unless @authorizer_name.nil?
  @identity_source = identity_source
  Jsii::Type.check_type(@identity_source, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "identitySource") unless @identity_source.nil?
  @results_cache_ttl = results_cache_ttl
  Jsii::Type.check_type(@results_cache_ttl, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "resultsCacheTtl") unless @results_cache_ttl.nil?
end

Instance Attribute Details

#authorizer_nameString? (readonly)

Note:

Default: - the unique construct ID

An optional human friendly name for the authorizer.

Note that, this is not the primary identifier of the authorizer.

Returns:

  • (String, nil)


32
33
34
# File 'api_gateway/cognito_user_pools_authorizer_props.rb', line 32

def authorizer_name
  @authorizer_name
end

#cognito_user_poolsArray<AWSCDK::Cognito::IUserPool> (readonly)

The user pools to associate with this authorizer.

Returns:



25
26
27
# File 'api_gateway/cognito_user_pools_authorizer_props.rb', line 25

def cognito_user_pools
  @cognito_user_pools
end

#identity_sourceString? (readonly)

Note:

Default: IdentitySource.header('Authorization')

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.



41
42
43
# File 'api_gateway/cognito_user_pools_authorizer_props.rb', line 41

def identity_source
  @identity_source
end

#results_cache_ttlAWSCDK::Duration? (readonly)

Note:

Default: Duration.minutes(5)

How long APIGateway should cache the results.

Max 1 hour. Disable caching by setting this to 0.

Returns:



49
50
51
# File 'api_gateway/cognito_user_pools_authorizer_props.rb', line 49

def results_cache_ttl
  @results_cache_ttl
end

Class Method Details

.jsii_propertiesObject



51
52
53
54
55
56
57
58
# File 'api_gateway/cognito_user_pools_authorizer_props.rb', line 51

def self.jsii_properties
  {
    :cognito_user_pools => "cognitoUserPools",
    :authorizer_name => "authorizerName",
    :identity_source => "identitySource",
    :results_cache_ttl => "resultsCacheTtl",
  }
end

Instance Method Details

#to_jsiiObject



60
61
62
63
64
65
66
67
68
69
# File 'api_gateway/cognito_user_pools_authorizer_props.rb', line 60

def to_jsii
  result = {}
  result.merge!({
    "cognitoUserPools" => @cognito_user_pools,
    "authorizerName" => @authorizer_name,
    "identitySource" => @identity_source,
    "resultsCacheTtl" => @results_cache_ttl,
  })
  result.compact
end