Class: AWSCDK::APIGatewayv2::HttpAuthorizerProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
api_gatewayv2/http_authorizer_props.rb

Overview

Properties to initialize an instance of HttpAuthorizer.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_api:, identity_source:, type:, authorizer_name: nil, authorizer_uri: nil, enable_simple_responses: nil, jwt_audience: nil, jwt_issuer: nil, payload_format_version: nil, results_cache_ttl: nil, role: nil) ⇒ HttpAuthorizerProps

Returns a new instance of HttpAuthorizerProps.

Parameters:

  • http_api (AWSCDK::APIGatewayv2::IHttpAPIRef)

    HTTP Api to attach the authorizer to.

  • identity_source (Array<String>)

    The identity source for which authorization is requested.

  • type (AWSCDK::APIGatewayv2::HttpAuthorizerType)

    The type of authorizer.

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

    Name of the authorizer.

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

    The authorizer's Uniform Resource Identifier (URI).

  • enable_simple_responses (Boolean, nil) (defaults to: nil)

    Specifies whether a Lambda authorizer returns a response in a simple format.

  • jwt_audience (Array<String>, nil) (defaults to: nil)

    A list of the intended recipients of the JWT.

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

    The base domain of the identity provider that issues JWT.

  • payload_format_version (AWSCDK::APIGatewayv2::AuthorizerPayloadVersion, nil) (defaults to: nil)

    Specifies the format of the payload sent to an HTTP API Lambda authorizer.

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

    How long APIGateway should cache the results.

  • role (AWSCDK::Interfaces::AWSIAM::IRoleRef, nil) (defaults to: nil)

    The IAM role that the API Gateway service assumes while invoking the authorizer.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'api_gatewayv2/http_authorizer_props.rb', line 18

def initialize(http_api:, identity_source:, type:, authorizer_name: nil, authorizer_uri: nil, enable_simple_responses: nil, jwt_audience: nil, jwt_issuer: nil, payload_format_version: nil, results_cache_ttl: nil, role: nil)
  @http_api = http_api
  Jsii::Type.check_type(@http_api, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheXYyLklIdHRwQXBpUmVmIn0=")), "httpApi")
  @identity_source = identity_source
  Jsii::Type.check_type(@identity_source, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "identitySource")
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheXYyLkh0dHBBdXRob3JpemVyVHlwZSJ9")), "type")
  @authorizer_name = authorizer_name
  Jsii::Type.check_type(@authorizer_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "authorizerName") unless @authorizer_name.nil?
  @authorizer_uri = authorizer_uri
  Jsii::Type.check_type(@authorizer_uri, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "authorizerUri") unless @authorizer_uri.nil?
  @enable_simple_responses = enable_simple_responses
  Jsii::Type.check_type(@enable_simple_responses, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableSimpleResponses") unless @enable_simple_responses.nil?
  @jwt_audience = jwt_audience
  Jsii::Type.check_type(@jwt_audience, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "jwtAudience") unless @jwt_audience.nil?
  @jwt_issuer = jwt_issuer
  Jsii::Type.check_type(@jwt_issuer, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "jwtIssuer") unless @jwt_issuer.nil?
  @payload_format_version = payload_format_version
  Jsii::Type.check_type(@payload_format_version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXBpZ2F0ZXdheXYyLkF1dGhvcml6ZXJQYXlsb2FkVmVyc2lvbiJ9")), "payloadFormatVersion") unless @payload_format_version.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?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19pYW0uSVJvbGVSZWYifQ==")), "role") unless @role.nil?
end

Instance Attribute Details

#authorizer_nameString? (readonly)

Note:

Default: - id of the HttpAuthorizer construct.

Name of the authorizer.

Returns:

  • (String, nil)


60
61
62
# File 'api_gatewayv2/http_authorizer_props.rb', line 60

def authorizer_name
  @authorizer_name
end

#authorizer_uriString? (readonly)

Note:

Default: - required for Request authorizer types

The authorizer's Uniform Resource Identifier (URI).

For REQUEST authorizers, this must be a well-formed Lambda function URI.

Returns:

  • (String, nil)


67
68
69
# File 'api_gatewayv2/http_authorizer_props.rb', line 67

def authorizer_uri
  @authorizer_uri
end

#enable_simple_responsesBoolean? (readonly)

Note:

Default: - The lambda authorizer must return an IAM policy as its response

Specifies whether a Lambda authorizer returns a response in a simple format.

If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy.

Returns:

  • (Boolean, nil)


74
75
76
# File 'api_gatewayv2/http_authorizer_props.rb', line 74

def enable_simple_responses
  @enable_simple_responses
end

#http_apiAWSCDK::APIGatewayv2::IHttpAPIRef (readonly)

HTTP Api to attach the authorizer to.



46
47
48
# File 'api_gatewayv2/http_authorizer_props.rb', line 46

def http_api
  @http_api
end

#identity_sourceArray<String> (readonly)

The identity source for which authorization is requested.



51
52
53
# File 'api_gatewayv2/http_authorizer_props.rb', line 51

def identity_source
  @identity_source
end

#jwt_audienceArray<String>? (readonly)

Note:

Default: - required for JWT authorizer typess.

A list of the intended recipients of the JWT.

A valid JWT must provide an aud that matches at least one entry in this list.

Returns:

  • (Array<String>, nil)


81
82
83
# File 'api_gatewayv2/http_authorizer_props.rb', line 81

def jwt_audience
  @jwt_audience
end

#jwt_issuerString? (readonly)

Note:

Default: - required for JWT authorizer types.

The base domain of the identity provider that issues JWT.

Returns:

  • (String, nil)


86
87
88
# File 'api_gatewayv2/http_authorizer_props.rb', line 86

def jwt_issuer
  @jwt_issuer
end

#payload_format_versionAWSCDK::APIGatewayv2::AuthorizerPayloadVersion? (readonly)

Note:

Default: AuthorizerPayloadVersion.VERSION_2_0 if the authorizer type is HttpAuthorizerType.LAMBDA

Specifies the format of the payload sent to an HTTP API Lambda authorizer.



91
92
93
# File 'api_gatewayv2/http_authorizer_props.rb', line 91

def payload_format_version
  @payload_format_version
end

#results_cache_ttlAWSCDK::Duration? (readonly)

Note:

Default: - API Gateway will not cache authorizer responses

How long APIGateway should cache the results.

Max 1 hour.

Returns:



98
99
100
# File 'api_gatewayv2/http_authorizer_props.rb', line 98

def results_cache_ttl
  @results_cache_ttl
end

#roleAWSCDK::Interfaces::AWSIAM::IRoleRef? (readonly)

Note:

Default: - No role

The IAM role that the API Gateway service assumes while invoking the authorizer.

Supported only for REQUEST authorizers.



105
106
107
# File 'api_gatewayv2/http_authorizer_props.rb', line 105

def role
  @role
end

#typeAWSCDK::APIGatewayv2::HttpAuthorizerType (readonly)

The type of authorizer.



55
56
57
# File 'api_gatewayv2/http_authorizer_props.rb', line 55

def type
  @type
end

Class Method Details

.jsii_propertiesObject



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'api_gatewayv2/http_authorizer_props.rb', line 107

def self.jsii_properties
  {
    :http_api => "httpApi",
    :identity_source => "identitySource",
    :type => "type",
    :authorizer_name => "authorizerName",
    :authorizer_uri => "authorizerUri",
    :enable_simple_responses => "enableSimpleResponses",
    :jwt_audience => "jwtAudience",
    :jwt_issuer => "jwtIssuer",
    :payload_format_version => "payloadFormatVersion",
    :results_cache_ttl => "resultsCacheTtl",
    :role => "role",
  }
end

Instance Method Details

#to_jsiiObject



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'api_gatewayv2/http_authorizer_props.rb', line 123

def to_jsii
  result = {}
  result.merge!({
    "httpApi" => @http_api,
    "identitySource" => @identity_source,
    "type" => @type,
    "authorizerName" => @authorizer_name,
    "authorizerUri" => @authorizer_uri,
    "enableSimpleResponses" => @enable_simple_responses,
    "jwtAudience" => @jwt_audience,
    "jwtIssuer" => @jwt_issuer,
    "payloadFormatVersion" => @payload_format_version,
    "resultsCacheTtl" => @results_cache_ttl,
    "role" => @role,
  })
  result.compact
end