Table of Contents

Class LambdaAuthorizerProps

Namespace
Amazon.CDK.AWS.APIGateway
Assembly
Amazon.CDK.AWS.APIGateway.dll

Base properties for all lambda authorizers.

public class LambdaAuthorizerProps : ILambdaAuthorizerProps
Inheritance
LambdaAuthorizerProps
Implements
Inherited Members

Examples

// The code below shows an example of how to instantiate this type.
            // The values are placeholders you should change.
            using Amazon.CDK.AWS.APIGateway;
            using Amazon.CDK.AWS.IAM;
            using Amazon.CDK.AWS.Lambda;
            using Amazon.CDK;

            Function function_;
            Role role;
            var lambdaAuthorizerProps = new LambdaAuthorizerProps {
                Handler = function_,

                // the properties below are optional
                AssumeRole = role,
                AuthorizerName = "authorizerName",
                ResultsCacheTtl = Duration.Minutes(30)
            };

Remarks

ExampleMetadata: fixture=_generated

Constructors

LambdaAuthorizerProps()

public LambdaAuthorizerProps()

Properties

AssumeRole

An optional IAM role for APIGateway to assume before calling the Lambda-based authorizer.

public IRole? AssumeRole { get; set; }

Property Value

IRole

Remarks

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.

AuthorizerName

An optional human friendly name for the authorizer.

public string? AuthorizerName { get; set; }

Property Value

string

Remarks

Note that, this is not the primary identifier of the authorizer.

Default: - the unique construcrt ID

Handler

The handler for the authorizer lambda function.

public IFunction Handler { get; set; }

Property Value

IFunction

Remarks

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}.

ResultsCacheTtl

How long APIGateway should cache the results.

public Duration? ResultsCacheTtl { get; set; }

Property Value

Duration

Remarks

Max 1 hour. Disable caching by setting this to 0.

Default: Duration.minutes(5)