class IdentitySource
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.APIGateway.IdentitySource |
Java | software.amazon.awscdk.services.apigateway.IdentitySource |
Python | aws_cdk.aws_apigateway.IdentitySource |
TypeScript (source) | @aws-cdk/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
Name | Description |
---|---|
static context(context) | Provides a properly formatted request context identity source. |
static header(headerName) | Provides a properly formatted header identity source. |
static query | Provides a properly formatted query string identity source. |
static stage | 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 theIdentitySource
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 theIdentitySource
will represent.
Returns
string
Provides a properly formatted header identity source.
String(queryString)
static querypublic static queryString(queryString: string): string
Parameters
- queryString
string
— the name of the query string theIdentitySource
will represent.
Returns
string
Provides a properly formatted query string identity source.
Variable(stageVariable)
static stagepublic static stageVariable(stageVariable: string): string
Parameters
- stageVariable
string
— the name of the stage variable theIdentitySource
will represent.
Returns
string
Provides a properly formatted API Gateway stage variable identity source.