aws-cdk-lib.aws_apigateway.CognitoUserPoolsAuthorizerProps

interface CognitoUserPoolsAuthorizerProps

LanguageType name
.NETAmazon.CDK.AWS.APIGateway.CognitoUserPoolsAuthorizerProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#CognitoUserPoolsAuthorizerProps
Javasoftware.amazon.awscdk.services.apigateway.CognitoUserPoolsAuthorizerProps
Pythonaws_cdk.aws_apigateway.CognitoUserPoolsAuthorizerProps
TypeScript (source)aws-cdk-lib » aws_apigateway » CognitoUserPoolsAuthorizerProps

Properties for CognitoUserPoolsAuthorizer.

Example

const userPool = new cognito.UserPool(this, 'UserPool');

const auth = new apigateway.CognitoUserPoolsAuthorizer(this, 'booksAuthorizer', {
  cognitoUserPools: [userPool]
});

declare const books: apigateway.Resource;
books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), {
  authorizer: auth,
  authorizationType: apigateway.AuthorizationType.COGNITO,
});

Properties

NameTypeDescription
cognitoUserPoolsIUserPool[]The user pools to associate with this authorizer.
authorizerName?stringAn optional human friendly name for the authorizer.
identitySource?stringThe request header mapping expression for the bearer token.
resultsCacheTtl?DurationHow long APIGateway should cache the results.

cognitoUserPools

Type: IUserPool[]

The user pools to associate with this authorizer.


authorizerName?

Type: string (optional, default: the unique construct ID)

An optional human friendly name for the authorizer.

Note that, this is not the primary identifier of the authorizer.


identitySource?

Type: string (optional, default: IdentitySource.header('Authorization'))

The request header mapping expression for the bearer token.

This is typically passed as part of the header, in which case this should be method.request.header.Authorizer where Authorizer is the header containing the bearer token.

See also: https://docs.aws.amazon.com/apigateway/api-reference/link-relation/authorizer-create/#identitySource


resultsCacheTtl?

Type: Duration (optional, default: Duration.minutes(5))

How long APIGateway should cache the results.

Max 1 hour. Disable caching by setting this to 0.