Interface IRequestAuthorizerProps
- Namespace
- Amazon.CDK.AWS.APIGateway
- Assembly
- Amazon.CDK.AWS.APIGateway.dll
Properties for RequestAuthorizer.
public interface IRequestAuthorizerProps : ILambdaAuthorizerProps
- Inherited Members
Examples
Function authFn;
Resource books;
var auth = new RequestAuthorizer(this, "booksAuthorizer", new RequestAuthorizerProps {
Handler = authFn,
IdentitySources = new [] { IdentitySource.Header("Authorization") }
});
books.AddMethod("GET", new HttpIntegration("http://amazon.com"), new MethodOptions {
Authorizer = auth
});
Remarks
ExampleMetadata: infused
Properties
IdentitySources
An array of request header mapping expressions for identities.
string[] IdentitySources { get; }
Property Value
- string[]
Remarks
Supported parameter types are
Header, Query String, Stage Variable, and Context. For instance, extracting an authorization
token from a header would use the identity source IdentitySource.header('Authorizer')
.
Note: API Gateway uses the specified identity sources as the request authorizer caching key. When caching is enabled, API Gateway calls the authorizer's Lambda function only after successfully verifying that all the specified identity sources are present at runtime. If a specified identify source is missing, null, or empty, API Gateway returns a 401 Unauthorized response without calling the authorizer Lambda function.
See: https://docs.aws.amazon.com/apigateway/api-reference/link-relation/authorizer-create/#identitySource