Bases: Authorizer
Request-based lambda authorizer that recognizes the callerâs identity via request parameters, such as headers, paths, query strings, stage variables, or context variables.
Based on the request, authorization is performed by a lambda function.
AWS::ApiGateway::Authorizer
infused
Example:
# auth_fn: lambda.Function # books: apigateway.Resource auth = apigateway.RequestAuthorizer(self, "booksAuthorizer", handler=auth_fn, identity_sources=[apigateway.IdentitySource.header("Authorization")] ) books.add_method("GET", apigateway.HttpIntegration("http://amazon.com"), authorizer=auth )
scope (Construct
)
id (str
)
identity_sources (Sequence
[str
]) â An array of request header mapping expressions for identities. 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.
handler (IFunction
) â The handler for the authorizer lambda function. The handler must follow a very specific protocol on the input it receives and the output it needs to produce. API Gateway has documented the handlerâs input specification {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-input.html | here} and output specification {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html | here}.
assume_role (Optional
[IRole
]) â An optional IAM role for APIGateway to assume before calling the Lambda-based authorizer. The IAM role must be assumable by âapigateway.amazonaws.comâ. Default: - A resource policy is added to the Lambda function allowing apigateway.amazonaws.com to invoke the function.
authorizer_name (Optional
[str
]) â An optional human friendly name for the authorizer. Note that, this is not the primary identifier of the authorizer. Default: - the unique construcrt ID
results_cache_ttl (Optional
[Duration
]) â How long APIGateway should cache the results. Max 1 hour. Disable caching by setting this to 0. Default: Duration.minutes(5)
Methods
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because youâve removed it from the CDK application or because youâve made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
policy (RemovalPolicy
)
None
Returns a string representation of this construct.
str
Attributes
The authorization type of this authorizer.
The ARN of the authorizer to be used in permission policies, such as IAM and resource-based grants.
The id of the authorizer.
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
The construct tree node associated with this construct.
The stack in which this resource is defined.
Static Methods
Return whether the given object is an Authorizer.
x (Any
)
bool
Return whether the given object is a Construct.
x (Any
)
bool
Check whether the given construct is a Resource.
construct (IConstruct
)
bool
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4