Show / Hide Table of Contents

Interface IAppSyncLambdaAuthorizerConfig

Configuration for Lambda authorization in AppSync.

Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IAppSyncLambdaAuthorizerConfig
Syntax (vb)
Public Interface IAppSyncLambdaAuthorizerConfig
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 handler;


             var iamProvider = new AppSyncAuthProvider {
                 AuthorizationType = AppSyncAuthorizationType.IAM
             };

             var apiKeyProvider = new AppSyncAuthProvider {
                 AuthorizationType = AppSyncAuthorizationType.API_KEY
             };

             var lambdaProvider = new AppSyncAuthProvider {
                 AuthorizationType = AppSyncAuthorizationType.LAMBDA,
                 LambdaAuthorizerConfig = new AppSyncLambdaAuthorizerConfig {
                     Handler = handler,
                     ResultsCacheTtl = Duration.Minutes(6),
                     ValidationRegex = "test"
                 }
             };

             var api = new EventApi(this, "api", new EventApiProps {
                 ApiName = "api",
                 AuthorizationConfig = new EventApiAuthConfig {
                     // set auth providers
                     AuthProviders = new [] { iamProvider, apiKeyProvider, lambdaProvider },
                     ConnectionAuthModeTypes = new [] { AppSyncAuthorizationType.IAM },
                     DefaultPublishAuthModeTypes = new [] { AppSyncAuthorizationType.API_KEY },
                     DefaultSubscribeAuthModeTypes = new [] { AppSyncAuthorizationType.LAMBDA }
                 }
             });

             api.AddChannelNamespace("default");

Synopsis

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.

Properties

Handler

The authorizer lambda function.

IFunction Handler { get; }
Property Value

IFunction

Remarks

See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-lambdaauthorizerconfig.html

ResultsCacheTtl

How long the results are cached.

Duration? ResultsCacheTtl { get; }
Property Value

Duration

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.

string? ValidationRegex { get; }
Property Value

string

Remarks

Default: - no regex filter will be applied.

Back to top Generated by DocFX