@aws-cdk_aws-apigatewayv2-alpha.HttpAuthorizer

class HttpAuthorizer (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Apigatewayv2.Alpha.HttpAuthorizer
Gogithub.com/aws/aws-cdk-go/awscdkapigatewayv2alpha/v2#HttpAuthorizer
Javasoftware.amazon.awscdk.services.apigatewayv2.alpha.HttpAuthorizer
Pythonaws_cdk.aws_apigatewayv2_alpha.HttpAuthorizer
TypeScript (source)@aws-cdk/aws-apigatewayv2-alpha ยป HttpAuthorizer

Implements IConstruct, IDependable, IResource, IHttpAuthorizer, IAuthorizer

An authorizer for Http Apis.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as apigatewayv2_alpha from '@aws-cdk/aws-apigatewayv2-alpha';
import * as cdk from 'aws-cdk-lib';

declare const httpApi: apigatewayv2_alpha.HttpApi;
const httpAuthorizer = new apigatewayv2_alpha.HttpAuthorizer(this, 'MyHttpAuthorizer', {
  httpApi: httpApi,
  identitySource: ['identitySource'],
  type: apigatewayv2_alpha.HttpAuthorizerType.IAM,

  // the properties below are optional
  authorizerName: 'authorizerName',
  authorizerUri: 'authorizerUri',
  enableSimpleResponses: false,
  jwtAudience: ['jwtAudience'],
  jwtIssuer: 'jwtIssuer',
  payloadFormatVersion: apigatewayv2_alpha.AuthorizerPayloadVersion.VERSION_1_0,
  resultsCacheTtl: cdk.Duration.minutes(30),
});

Initializer

new HttpAuthorizer(scope: Construct, id: string, props: HttpAuthorizerProps)

Parameters

  • scope Construct
  • id string
  • props HttpAuthorizerProps

Construct Props

NameTypeDescription
httpApi๐Ÿ”นIHttpApiHTTP Api to attach the authorizer to.
identitySource๐Ÿ”นstring[]The identity source for which authorization is requested.
type๐Ÿ”นHttpAuthorizerTypeThe type of authorizer.
authorizerName?๐Ÿ”นstringName of the authorizer.
authorizerUri?๐Ÿ”นstringThe authorizer's Uniform Resource Identifier (URI).
enableSimpleResponses?๐Ÿ”นbooleanSpecifies whether a Lambda authorizer returns a response in a simple format.
jwtAudience?๐Ÿ”นstring[]A list of the intended recipients of the JWT.
jwtIssuer?๐Ÿ”นstringThe base domain of the identity provider that issues JWT.
payloadFormatVersion?๐Ÿ”นAuthorizerPayloadVersionSpecifies the format of the payload sent to an HTTP API Lambda authorizer.
resultsCacheTtl?๐Ÿ”นDurationHow long APIGateway should cache the results.

httpApi๐Ÿ”น

Type: IHttpApi

HTTP Api to attach the authorizer to.


identitySource๐Ÿ”น

Type: string[]

The identity source for which authorization is requested.

See also: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-authorizer.html#cfn-apigatewayv2-authorizer-identitysource


type๐Ÿ”น

Type: HttpAuthorizerType

The type of authorizer.


authorizerName?๐Ÿ”น

Type: string (optional, default: id of the HttpAuthorizer construct.)

Name of the authorizer.


authorizerUri?๐Ÿ”น

Type: string (optional, 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.


enableSimpleResponses?๐Ÿ”น

Type: boolean (optional, 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.


jwtAudience?๐Ÿ”น

Type: string[] (optional, 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.


jwtIssuer?๐Ÿ”น

Type: string (optional, default: required for JWT authorizer types.)

The base domain of the identity provider that issues JWT.


payloadFormatVersion?๐Ÿ”น

Type: AuthorizerPayloadVersion (optional, 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.


resultsCacheTtl?๐Ÿ”น

Type: Duration (optional, default: API Gateway will not cache authorizer responses)

How long APIGateway should cache the results.

Max 1 hour.

Properties

NameTypeDescription
authorizerId๐Ÿ”นstringId of the Authorizer.
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
node๐Ÿ”นNodeThe tree node.
stack๐Ÿ”นStackThe stack in which this resource is defined.

authorizerId๐Ÿ”น

Type: string

Id of the Authorizer.


env๐Ÿ”น

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node๐Ÿ”น

Type: Node

The tree node.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
toString()๐Ÿ”นReturns a string representation of this construct.
static fromHttpAuthorizerAttributes(scope, id, attrs)๐Ÿ”นImport an existing HTTP Authorizer into this CDK app.

applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromHttpAuthorizerAttributes(scope, id, attrs)๐Ÿ”น

public static fromHttpAuthorizerAttributes(scope: Construct, id: string, attrs: HttpAuthorizerAttributes): IHttpRouteAuthorizer

Parameters

  • scope Construct
  • id string
  • attrs HttpAuthorizerAttributes

Returns

  • IHttpRouteAuthorizer

Import an existing HTTP Authorizer into this CDK app.