AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

HttpAuthorizer

An authorizer for Http Apis.

Import

import { HttpAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2';

Or use the module namespace:

import * as apigatewayv2 from 'aws-cdk-lib/aws-apigatewayv2';
// apigatewayv2.HttpAuthorizer

Properties

Configuration passed to the constructor as HttpAuthorizerProps.

httpApiRequired
IHttpApiRef

HTTP Api to attach the authorizer to.

identitySourceRequired
string[]

The identity source for which authorization is requested.

typeRequired
HttpAuthorizerType

The type of authorizer.

authorizerNameOptional
string

Name of the authorizer.

Default: - id of the HttpAuthorizer construct.

authorizerUriOptional
string

The authorizer's Uniform Resource Identifier (URI). For REQUEST authorizers, this must be a well-formed Lambda function URI.

Default: - required for Request authorizer types

enableSimpleResponsesOptional
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.

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

jwtAudienceOptional
string[]

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.

Default: - required for JWT authorizer typess.

jwtIssuerOptional
string

The base domain of the identity provider that issues JWT.

Default: - required for JWT authorizer types.

payloadFormatVersionOptional
AuthorizerPayloadVersion

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

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

resultsCacheTtlOptional
Duration

How long APIGateway should cache the results. Max 1 hour.

Default: - API Gateway will not cache authorizer responses

roleOptional
IRoleRef

The IAM role that the API Gateway service assumes while invoking the authorizer. Supported only for REQUEST authorizers.

Default: - No role

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter