aws-cdk-lib.aws_apigateway.IdentitySource

class IdentitySource

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

Represents an identity source.

The source can be specified either as a literal value (e.g: Auth) which cannot be blank, or as an unresolved string token.

Example

declare const authFn: lambda.Function;
declare const books: apigateway.Resource;

const auth = new apigateway.RequestAuthorizer(this, 'booksAuthorizer', {
  handler: authFn,
  identitySources: [apigateway.IdentitySource.header('Authorization')]
});

books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), {
  authorizer: auth
});

Initializer

new IdentitySource()

Methods

NameDescription
static context(context)Provides a properly formatted request context identity source.
static header(headerName)Provides a properly formatted header identity source.
static queryString(queryString)Provides a properly formatted query string identity source.
static stageVariable(stageVariable)Provides a properly formatted API Gateway stage variable identity source.

static context(context)

public static context(context: string): string

Parameters

  • context string — the name of the context variable the IdentitySource will represent.

Returns

  • string

Provides a properly formatted request context identity source.


static header(headerName)

public static header(headerName: string): string

Parameters

  • headerName string — the name of the header the IdentitySource will represent.

Returns

  • string

Provides a properly formatted header identity source.


static queryString(queryString)

public static queryString(queryString: string): string

Parameters

  • queryString string — the name of the query string the IdentitySource will represent.

Returns

  • string

Provides a properly formatted query string identity source.


static stageVariable(stageVariable)

public static stageVariable(stageVariable: string): string

Parameters

  • stageVariable string — the name of the stage variable the IdentitySource will represent.

Returns

  • string

Provides a properly formatted API Gateway stage variable identity source.