Class RequestAuthorizer
Request-based lambda authorizer that recognizes the caller's identity via request parameters, such as headers, paths, query strings, stage variables, or context variables.
Inherited Members
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class RequestAuthorizer : Authorizer, IResource, IAuthorizer
Syntax (vb)
Public Class RequestAuthorizer
Inherits Authorizer
Implements IResource, IAuthorizer
Remarks
Based on the request, authorization is performed by a lambda function.
Resource: AWS::ApiGateway::Authorizer
ExampleMetadata: infused
Examples
Function authFn;
Resource books;
var auth = new RequestAuthorizer(this, "booksAuthorizer", new RequestAuthorizerProps {
Handler = authFn,
IdentitySources = new [] { IdentitySource.Header("Authorization") }
});
books.AddMethod("GET", new HttpIntegration("http://amazon.com"), new MethodOptions {
Authorizer = auth
});
Synopsis
Constructors
RequestAuthorizer(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
RequestAuthorizer(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
RequestAuthorizer(Construct, String, IRequestAuthorizerProps) |
Properties
AuthorizerArn | The ARN of the authorizer to be used in permission policies, such as IAM and resource-based grants. |
AuthorizerId | The id of the authorizer. |
AuthorizerProps | |
Handler | The Lambda function handler that this authorizer uses. |
RestApiId | |
Role | The IAM role that the API Gateway service assumes while invoking the Lambda function. |
Methods
LazyRestApiId() | Returns a token that resolves to the Rest Api Id at the time of synthesis. |
SetupPermissions() | Sets up the permissions necessary for the API Gateway service to invoke the Lambda function. |
Constructors
RequestAuthorizer(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected RequestAuthorizer(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
RequestAuthorizer(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected RequestAuthorizer(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
RequestAuthorizer(Construct, String, IRequestAuthorizerProps)
public RequestAuthorizer(Construct scope, string id, IRequestAuthorizerProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IRequestAuthorizerProps
Properties
AuthorizerArn
The ARN of the authorizer to be used in permission policies, such as IAM and resource-based grants.
public virtual string AuthorizerArn { get; }
Property Value
System.String
AuthorizerId
The id of the authorizer.
public override string AuthorizerId { get; }
Property Value
System.String
Overrides
AuthorizerProps
Handler
The Lambda function handler that this authorizer uses.
protected virtual IFunction Handler { get; }
Property Value
RestApiId
protected virtual string RestApiId { get; set; }
Property Value
System.String
Role
The IAM role that the API Gateway service assumes while invoking the Lambda function.
protected virtual IRole Role { get; }
Property Value
Methods
LazyRestApiId()
Returns a token that resolves to the Rest Api Id at the time of synthesis.
protected virtual string LazyRestApiId()
Returns
System.String
Remarks
Throws an error, during token resolution, if no RestApi is attached to this authorizer.
SetupPermissions()
Sets up the permissions necessary for the API Gateway service to invoke the Lambda function.
protected virtual void SetupPermissions()