@Generated(value="jsii-pacmak/1.70.0 (build 03c2f6f)", date="2022-11-01T13:16:42.859Z") @Stability(value=Experimental) public interface LambdaAuthorizerConfig extends software.amazon.jsii.JsiiSerializable
Note that you can only have a single AWS Lambda function configured to authorize your API.
Example:
import software.amazon.awscdk.core.*;
Function authFunction;
GraphqlApi.Builder.create(this, "api")
.name("api")
.schema(Schema.fromAsset(join(__dirname, "appsync.test.graphql")))
.authorizationConfig(AuthorizationConfig.builder()
.defaultAuthorization(AuthorizationMode.builder()
.authorizationType(AuthorizationType.LAMBDA)
.lambdaAuthorizerConfig(LambdaAuthorizerConfig.builder()
.handler(authFunction)
.build())
.build())
.build())
.build();
| Modifier and Type | Interface and Description |
|---|---|
static class |
LambdaAuthorizerConfig.Builder
A builder for
LambdaAuthorizerConfig |
static class |
LambdaAuthorizerConfig.Jsii$Proxy
An implementation for
LambdaAuthorizerConfig |
| Modifier and Type | Method and Description |
|---|---|
static LambdaAuthorizerConfig.Builder |
builder() |
IFunction |
getHandler()
(experimental) The authorizer lambda function.
|
default Duration |
getResultsCacheTtl()
(experimental) How long the results are cached.
|
default String |
getValidationRegex()
(experimental) A regular expression for validation of tokens before the Lambda function is called.
|
@Stability(value=Experimental) @NotNull IFunction getHandler()
Note: This Lambda function must have the following resource-based policy assigned to it. When configuring Lambda authorizers in the console, this is done for you. To do so with the AWS CLI, run the following:
aws lambda add-permission --function-name "arn:aws:lambda:us-east-2:111122223333:function:my-function" --statement-id "appsync" --principal appsync.amazonaws.com --action lambda:InvokeFunction
@Stability(value=Experimental) @Nullable default Duration getResultsCacheTtl()
Disable caching by setting this to 0.
Default: Duration.minutes(5)
@Stability(value=Experimental) @Nullable default String getValidationRegex()
Default: - no regex filter will be applied.
@Stability(value=Experimental) static LambdaAuthorizerConfig.Builder builder()
LambdaAuthorizerConfig.Builder of LambdaAuthorizerConfigCopyright © 2022. All rights reserved.