Class LambdaAuthorizerConfig
(experimental) Configuration for Lambda authorization in AppSync.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.AWS.AppSync.dll
Syntax (csharp)
public class LambdaAuthorizerConfig : Object, ILambdaAuthorizerConfig
Syntax (vb)
Public Class LambdaAuthorizerConfig
Inherits Object
Implements ILambdaAuthorizerConfig
Remarks
Note that you can only have a single AWS Lambda function configured to authorize your API.
Stability: Experimental
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Lambda;
Function authFunction;
new GraphqlApi(this, "api", new GraphqlApiProps {
Name = "api",
Schema = Schema.FromAsset(Join(__dirname, "appsync.test.graphql")),
AuthorizationConfig = new AuthorizationConfig {
DefaultAuthorization = new AuthorizationMode {
AuthorizationType = AuthorizationType.LAMBDA,
LambdaAuthorizerConfig = new LambdaAuthorizerConfig {
Handler = authFunction
}
}
}
});
Synopsis
Constructors
LambdaAuthorizerConfig() |
Properties
Handler | (experimental) The authorizer lambda function. |
ResultsCacheTtl | (experimental) How long the results are cached. |
ValidationRegex | (experimental) A regular expression for validation of tokens before the Lambda function is called. |
Constructors
LambdaAuthorizerConfig()
public LambdaAuthorizerConfig()
Properties
Handler
(experimental) The authorizer lambda function.
public IFunction Handler { get; set; }
Property Value
Remarks
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: Experimental
ResultsCacheTtl
(experimental) How long the results are cached.
public Duration ResultsCacheTtl { get; set; }
Property Value
Remarks
Disable caching by setting this to 0.
Default: Duration.minutes(5)
Stability: Experimental
ValidationRegex
(experimental) A regular expression for validation of tokens before the Lambda function is called.
public string ValidationRegex { get; set; }
Property Value
System.String
Remarks
Default: - no regex filter will be applied.
Stability: Experimental