Class: AWSCDK::APIGatewayv2::CfnAuthorizerProps

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

Overview

Properties for defining a CfnAuthorizer.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_id:, authorizer_type:, name:, authorizer_credentials_arn: nil, authorizer_payload_format_version: nil, authorizer_result_ttl_in_seconds: nil, authorizer_uri: nil, enable_simple_responses: nil, identity_source: nil, identity_validation_expression: nil, jwt_configuration: nil) ⇒ CfnAuthorizerProps

Returns a new instance of CfnAuthorizerProps.

Parameters:

  • api_id (String, AWSCDK::Interfaces::AWSApigatewayv2::IAPIRef)

    The API identifier.

  • authorizer_type (String)

    The authorizer type.

  • name (String)

    The name of the authorizer.

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

    Specifies the required credentials as an IAM role for API Gateway to invoke the authorizer.

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

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

  • authorizer_result_ttl_in_seconds (Numeric, nil) (defaults to: nil)

    The time to live (TTL) for cached authorizer results, in seconds.

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

    The authorizer's Uniform Resource Identifier (URI).

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

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

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

    The identity source for which authorization is requested.

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

    This parameter is not used.

  • jwt_configuration (AWSCDK::IResolvable, AWSCDK::APIGatewayv2::CfnAuthorizer::JWTConfigurationProperty, nil) (defaults to: nil)

    The JWTConfiguration property specifies the configuration of a JWT authorizer.



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

def initialize(api_id:, authorizer_type:, name:, authorizer_credentials_arn: nil, authorizer_payload_format_version: nil, authorizer_result_ttl_in_seconds: nil, authorizer_uri: nil, enable_simple_responses: nil, identity_source: nil, identity_validation_expression: nil, jwt_configuration: nil)
  @api_id = api_id
  Jsii::Type.check_type(@api_id, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19hcGlnYXRld2F5djIuSUFwaVJlZiJ9XX19")), "apiId")
  @authorizer_type = authorizer_type
  Jsii::Type.check_type(@authorizer_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "authorizerType")
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  @authorizer_credentials_arn = authorizer_credentials_arn
  Jsii::Type.check_type(@authorizer_credentials_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "authorizerCredentialsArn") unless @authorizer_credentials_arn.nil?
  @authorizer_payload_format_version = authorizer_payload_format_version
  Jsii::Type.check_type(@authorizer_payload_format_version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "authorizerPayloadFormatVersion") unless @authorizer_payload_format_version.nil?
  @authorizer_result_ttl_in_seconds = authorizer_result_ttl_in_seconds
  Jsii::Type.check_type(@authorizer_result_ttl_in_seconds, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "authorizerResultTtlInSeconds") unless @authorizer_result_ttl_in_seconds.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("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "enableSimpleResponses") unless @enable_simple_responses.nil?
  @identity_source = identity_source
  Jsii::Type.check_type(@identity_source, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "identitySource") unless @identity_source.nil?
  @identity_validation_expression = identity_validation_expression
  Jsii::Type.check_type(@identity_validation_expression, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "identityValidationExpression") unless @identity_validation_expression.nil?
  @jwt_configuration = jwt_configuration.is_a?(Hash) ? ::AWSCDK::APIGatewayv2::CfnAuthorizer::JWTConfigurationProperty.new(**jwt_configuration.transform_keys(&:to_sym)) : jwt_configuration
  Jsii::Type.check_type(@jwt_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hcGlnYXRld2F5djIuQ2ZuQXV0aG9yaXplci5KV1RDb25maWd1cmF0aW9uUHJvcGVydHkifV19fQ==")), "jwtConfiguration") unless @jwt_configuration.nil?
end

Instance Attribute Details

#api_idString, AWSCDK::Interfaces::AWSApigatewayv2::IAPIRef (readonly)

The API identifier.



49
50
51
# File 'api_gatewayv2/cfn_authorizer_props.rb', line 49

def api_id
  @api_id
end

#authorizer_credentials_arnString? (readonly)

Specifies the required credentials as an IAM role for API Gateway to invoke the authorizer.

To specify an IAM role for API Gateway to assume, use the role's Amazon Resource Name (ARN). To use resource-based permissions on the Lambda function, specify null. Supported only for REQUEST authorizers.



68
69
70
# File 'api_gatewayv2/cfn_authorizer_props.rb', line 68

def authorizer_credentials_arn
  @authorizer_credentials_arn
end

#authorizer_payload_format_versionString? (readonly)

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

Required for HTTP API Lambda authorizers. Supported values are 1.0 and 2.0 . To learn more, see Working with AWS Lambda authorizers for HTTP APIs .



75
76
77
# File 'api_gatewayv2/cfn_authorizer_props.rb', line 75

def authorizer_payload_format_version
  @authorizer_payload_format_version
end

#authorizer_result_ttl_in_secondsNumeric? (readonly)

The time to live (TTL) for cached authorizer results, in seconds.

If it equals 0, authorization caching is disabled. If it is greater than 0, API Gateway caches authorizer responses. The maximum value is 3600, or 1 hour. Supported only for HTTP API Lambda authorizers.



82
83
84
# File 'api_gatewayv2/cfn_authorizer_props.rb', line 82

def authorizer_result_ttl_in_seconds
  @authorizer_result_ttl_in_seconds
end

#authorizer_typeString (readonly)

The authorizer type.

Specify REQUEST for a Lambda function using incoming request parameters. Specify JWT to use JSON Web Tokens (supported only for HTTP APIs).



56
57
58
# File 'api_gatewayv2/cfn_authorizer_props.rb', line 56

def authorizer_type
  @authorizer_type
end

#authorizer_uriString? (readonly)

The authorizer's Uniform Resource Identifier (URI).

For REQUEST authorizers, this must be a well-formed Lambda function URI, for example, arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2: *{account_id}* :function: *{lambda_function_name}* /invocations . In general, the URI has this form: arn:aws:apigateway: *{region}* :lambda:path/ *{service_api}* , where region is the same as the region hosting the Lambda function, path indicates that the remaining substring in the URI should be treated as the path to the resource, including the initial / . For Lambda functions, this is usually of the form /2015-03-31/functions/[FunctionARN]/invocations .



89
90
91
# File 'api_gatewayv2/cfn_authorizer_props.rb', line 89

def authorizer_uri
  @authorizer_uri
end

#enable_simple_responsesBoolean, ... (readonly)

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

By default, a Lambda authorizer must return an IAM policy. If enabled, the Lambda authorizer can return a boolean value instead of an IAM policy. Supported only for HTTP APIs. To learn more, see Working with AWS Lambda authorizers for HTTP APIs .



96
97
98
# File 'api_gatewayv2/cfn_authorizer_props.rb', line 96

def enable_simple_responses
  @enable_simple_responses
end

#identity_sourceArray<String>? (readonly)

The identity source for which authorization is requested.

For a REQUEST authorizer, this is optional. The value is a set of one or more mapping expressions of the specified request parameters. The identity source can be headers, query string parameters, stage variables, and context parameters. For example, if an Auth header and a Name query string parameter are defined as identity sources, this value is route.request.header.Auth, route.request.querystring.Name for WebSocket APIs. For HTTP APIs, use selection expressions prefixed with $ , for example, $request.header.Auth , $request.querystring.Name . These parameters are used to perform runtime validation for Lambda-based authorizers by verifying all of the identity-related request parameters are present in the request, not null, and non-empty. Only when this is true does the authorizer invoke the authorizer Lambda function. Otherwise, it returns a 401 Unauthorized response without calling the Lambda function. For HTTP APIs, identity sources are also used as the cache key when caching is enabled. To learn more, see Working with AWS Lambda authorizers for HTTP APIs .

For JWT , a single entry that specifies where to extract the JSON Web Token (JWT) from inbound requests. Currently only header-based and query parameter-based selections are supported, for example $request.header.Authorization .



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

def identity_source
  @identity_source
end

#identity_validation_expressionString? (readonly)

This parameter is not used.



110
111
112
# File 'api_gatewayv2/cfn_authorizer_props.rb', line 110

def identity_validation_expression
  @identity_validation_expression
end

#jwt_configurationAWSCDK::IResolvable, ... (readonly)

The JWTConfiguration property specifies the configuration of a JWT authorizer.

Required for the JWT authorizer type. Supported only for HTTP APIs.



117
118
119
# File 'api_gatewayv2/cfn_authorizer_props.rb', line 117

def jwt_configuration
  @jwt_configuration
end

#nameString (readonly)

The name of the authorizer.



61
62
63
# File 'api_gatewayv2/cfn_authorizer_props.rb', line 61

def name
  @name
end

Class Method Details

.jsii_propertiesObject



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'api_gatewayv2/cfn_authorizer_props.rb', line 119

def self.jsii_properties
  {
    :api_id => "apiId",
    :authorizer_type => "authorizerType",
    :name => "name",
    :authorizer_credentials_arn => "authorizerCredentialsArn",
    :authorizer_payload_format_version => "authorizerPayloadFormatVersion",
    :authorizer_result_ttl_in_seconds => "authorizerResultTtlInSeconds",
    :authorizer_uri => "authorizerUri",
    :enable_simple_responses => "enableSimpleResponses",
    :identity_source => "identitySource",
    :identity_validation_expression => "identityValidationExpression",
    :jwt_configuration => "jwtConfiguration",
  }
end

Instance Method Details

#to_jsiiObject



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'api_gatewayv2/cfn_authorizer_props.rb', line 135

def to_jsii
  result = {}
  result.merge!({
    "apiId" => @api_id,
    "authorizerType" => @authorizer_type,
    "name" => @name,
    "authorizerCredentialsArn" => @authorizer_credentials_arn,
    "authorizerPayloadFormatVersion" => @authorizer_payload_format_version,
    "authorizerResultTtlInSeconds" => @authorizer_result_ttl_in_seconds,
    "authorizerUri" => @authorizer_uri,
    "enableSimpleResponses" => @enable_simple_responses,
    "identitySource" => @identity_source,
    "identityValidationExpression" => @identity_validation_expression,
    "jwtConfiguration" => @jwt_configuration,
  })
  result.compact
end