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