authorizers
Creates, updates, deletes, gets or lists an authorizers resource.
Overview
| Name | authorizers |
| Type | Resource |
| Id | aws.apigatewayv2.authorizers |
Fields
The following fields are returned by SELECT queries:
- get_authorizer
- get_authorizers
| Name | Datatype | Description |
|---|---|---|
authorizer_credentials_arn | string | Represents an Amazon Resource Name (ARN). |
authorizer_id | string | The identifier. |
authorizer_payload_format_version | string | A string with a length between [1-64]. |
authorizer_result_ttl_in_seconds | integer | An integer with a value between [0-3600]. |
authorizer_type | string | 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). (REQUEST, JWT) |
authorizer_uri | string | A string representation of a URI with a length between [1-2048]. |
enable_simple_responses | boolean | 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. Supported only for HTTP APIs. To learn more, see Working with AWS Lambda authorizers for HTTP APIs |
identity_source | array | The identity source for which authorization is requested. For the REQUEST authorizer, this is required when authorization caching is enabled. The value is a comma-separated string of one or more mapping expressions of the specified request parameters. For example, if an Auth header, a Name query string parameter are defined as identity sources, this value is $method.request.header.Auth, $method.request.querystring.Name. These parameters will be used to derive the authorization caching key and to perform runtime validation of the REQUEST authorizer by verifying all of the identity-related request parameters are present, 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. The valid value is a string of comma-separated mapping expressions of the specified request parameters. When the authorization caching is not enabled, this property is optional. |
identity_validation_expression | string | A string with a length between [0-1024]. |
jwt_configuration | object | Represents the configuration of a JWT authorizer. Required for the JWT authorizer type. Supported only for HTTP APIs. |
name | string | A string with a length between [1-128]. |
| Name | Datatype | Description |
|---|---|---|
authorizer_credentials_arn | string | Represents an Amazon Resource Name (ARN). |
authorizer_id | string | The identifier. |
authorizer_payload_format_version | string | A string with a length between [1-64]. |
authorizer_result_ttl_in_seconds | integer | An integer with a value between [0-3600]. |
authorizer_type | string | 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). (REQUEST, JWT) |
authorizer_uri | string | A string representation of a URI with a length between [1-2048]. |
enable_simple_responses | boolean | 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. Supported only for HTTP APIs. To learn more, see Working with AWS Lambda authorizers for HTTP APIs |
identity_source | array | The identity source for which authorization is requested. For the REQUEST authorizer, this is required when authorization caching is enabled. The value is a comma-separated string of one or more mapping expressions of the specified request parameters. For example, if an Auth header, a Name query string parameter are defined as identity sources, this value is $method.request.header.Auth, $method.request.querystring.Name. These parameters will be used to derive the authorization caching key and to perform runtime validation of the REQUEST authorizer by verifying all of the identity-related request parameters are present, 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. The valid value is a string of comma-separated mapping expressions of the specified request parameters. When the authorization caching is not enabled, this property is optional. |
identity_validation_expression | string | A string with a length between [0-1024]. |
jwt_configuration | object | Represents the configuration of a JWT authorizer. Required for the JWT authorizer type. Supported only for HTTP APIs. |
name | string | A string with a length between [1-128]. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_authorizer | select | api_id, authorizer_id, region | Gets an Authorizer. | |
get_authorizers | select | api_id, region | maxResults, nextToken | Gets the Authorizers for an API. |
create_authorizer | insert | api_id, region, AuthorizerType, IdentitySource | Creates an Authorizer for an API. | |
update_authorizer | update | api_id, authorizer_id, region | Updates an Authorizer. | |
delete_authorizer | delete | api_id, authorizer_id, region | Deletes an Authorizer. | |
reset_authorizers_cache | exec | api_id, stage_name, region | Resets all authorizer cache entries on a stage. Supported only for HTTP APIs. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
api_id | string | The API identifier. |
authorizer_id | string | The authorizer identifier. |
region | string | AWS region (default: us-east-1) |
stage_name | string | The stage name. Stage names can contain only alphanumeric characters, hyphens, and underscores, or be $default. Maximum length is 128 characters. |
maxResults | string | The maximum number of elements to be returned for this resource. |
nextToken | string | The next page of elements from this collection. Not valid for the last element of the collection. |
SELECT examples
- get_authorizer
- get_authorizers
Gets an Authorizer.
SELECT
authorizer_credentials_arn,
authorizer_id,
authorizer_payload_format_version,
authorizer_result_ttl_in_seconds,
authorizer_type,
authorizer_uri,
enable_simple_responses,
identity_source,
identity_validation_expression,
jwt_configuration,
name
FROM aws.apigatewayv2.authorizers
WHERE api_id = '{{ api_id }}' -- required
AND authorizer_id = '{{ authorizer_id }}' -- required
AND region = '{{ region }}' -- required
;
Gets the Authorizers for an API.
SELECT
authorizer_credentials_arn,
authorizer_id,
authorizer_payload_format_version,
authorizer_result_ttl_in_seconds,
authorizer_type,
authorizer_uri,
enable_simple_responses,
identity_source,
identity_validation_expression,
jwt_configuration,
name
FROM aws.apigatewayv2.authorizers
WHERE api_id = '{{ api_id }}' -- required
AND region = '{{ region }}' -- required
AND maxResults = '{{ maxResults }}'
AND nextToken = '{{ nextToken }}'
;
INSERT examples
- create_authorizer
- Manifest
Creates an Authorizer for an API.
INSERT INTO aws.apigatewayv2.authorizers (
AuthorizerCredentialsArn,
AuthorizerPayloadFormatVersion,
AuthorizerResultTtlInSeconds,
AuthorizerType,
AuthorizerUri,
EnableSimpleResponses,
IdentitySource,
IdentityValidationExpression,
JwtConfiguration,
Name,
api_id,
region
)
SELECT
'{{ AuthorizerCredentialsArn }}',
'{{ AuthorizerPayloadFormatVersion }}',
{{ AuthorizerResultTtlInSeconds }},
'{{ AuthorizerType }}' /* required */,
'{{ AuthorizerUri }}',
{{ EnableSimpleResponses }},
'{{ IdentitySource }}' /* required */,
'{{ IdentityValidationExpression }}',
'{{ JwtConfiguration }}',
'{{ Name }}',
'{{ api_id }}',
'{{ region }}'
RETURNING
authorizer_credentials_arn,
authorizer_id,
authorizer_payload_format_version,
authorizer_result_ttl_in_seconds,
authorizer_type,
authorizer_uri,
enable_simple_responses,
identity_source,
identity_validation_expression,
jwt_configuration,
name
;
# Description fields are for documentation purposes
- name: authorizers
props:
- name: api_id
value: "{{ api_id }}"
description: Required parameter for the authorizers resource.
- name: region
value: "{{ region }}"
description: Required parameter for the authorizers resource.
- name: AuthorizerCredentialsArn
value: "{{ AuthorizerCredentialsArn }}"
description: |
Represents an Amazon Resource Name (ARN).
- name: AuthorizerPayloadFormatVersion
value: "{{ AuthorizerPayloadFormatVersion }}"
description: |
A string with a length between [1-64].
- name: AuthorizerResultTtlInSeconds
value: {{ AuthorizerResultTtlInSeconds }}
description: |
An integer with a value between [0-3600].
- name: AuthorizerType
value: "{{ AuthorizerType }}"
description: |
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).
valid_values: ['REQUEST', 'JWT']
- name: AuthorizerUri
value: "{{ AuthorizerUri }}"
description: |
A string representation of a URI with a length between [1-2048].
- name: EnableSimpleResponses
value: {{ EnableSimpleResponses }}
- name: IdentitySource
value:
- "{{ IdentitySource }}"
description: |
The identity source for which authorization is requested. For the REQUEST authorizer, this is required when authorization caching is enabled. The value is a comma-separated string of one or more mapping expressions of the specified request parameters. For example, if an Auth header, a Name query string parameter are defined as identity sources, this value is $method.request.header.Auth, $method.request.querystring.Name. These parameters will be used to derive the authorization caching key and to perform runtime validation of the REQUEST authorizer by verifying all of the identity-related request parameters are present, 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. The valid value is a string of comma-separated mapping expressions of the specified request parameters. When the authorization caching is not enabled, this property is optional.
- name: IdentityValidationExpression
value: "{{ IdentityValidationExpression }}"
description: |
A string with a length between [0-1024].
- name: JwtConfiguration
description: |
Represents the configuration of a JWT authorizer. Required for the JWT authorizer type. Supported only for HTTP APIs.
value:
Audience:
- "{{ Audience }}"
Issuer: "{{ Issuer }}"
- name: Name
value: "{{ Name }}"
description: |
A string with a length between [1-128].
UPDATE examples
- update_authorizer
Updates an Authorizer.
UPDATE aws.apigatewayv2.authorizers
SET
AuthorizerCredentialsArn = '{{ AuthorizerCredentialsArn }}',
AuthorizerPayloadFormatVersion = '{{ AuthorizerPayloadFormatVersion }}',
AuthorizerResultTtlInSeconds = {{ AuthorizerResultTtlInSeconds }},
AuthorizerType = '{{ AuthorizerType }}',
AuthorizerUri = '{{ AuthorizerUri }}',
EnableSimpleResponses = {{ EnableSimpleResponses }},
IdentitySource = '{{ IdentitySource }}',
IdentityValidationExpression = '{{ IdentityValidationExpression }}',
JwtConfiguration = '{{ JwtConfiguration }}',
Name = '{{ Name }}'
WHERE
api_id = '{{ api_id }}' --required
AND authorizer_id = '{{ authorizer_id }}' --required
AND region = '{{ region }}' --required
RETURNING
authorizer_credentials_arn,
authorizer_id,
authorizer_payload_format_version,
authorizer_result_ttl_in_seconds,
authorizer_type,
authorizer_uri,
enable_simple_responses,
identity_source,
identity_validation_expression,
jwt_configuration,
name;
DELETE examples
- delete_authorizer
Deletes an Authorizer.
DELETE FROM aws.apigatewayv2.authorizers
WHERE api_id = '{{ api_id }}' --required
AND authorizer_id = '{{ authorizer_id }}' --required
AND region = '{{ region }}' --required
;
Lifecycle Methods
- reset_authorizers_cache
Resets all authorizer cache entries on a stage. Supported only for HTTP APIs.
EXEC aws.apigatewayv2.authorizers.reset_authorizers_cache
@api_id='{{ api_id }}' --required,
@stage_name='{{ stage_name }}' --required,
@region='{{ region }}' --required
;