Class RequestAuthorizer
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.apigateway.Authorizer
software.amazon.awscdk.services.apigateway.RequestAuthorizer
- All Implemented Interfaces:
IEnvironmentAware,IResource,IAuthorizer,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)",
date="2025-12-05T10:47:11.572Z")
@Stability(Stable)
public class RequestAuthorizer
extends Authorizer
implements IAuthorizer
Request-based lambda authorizer that recognizes the caller's identity via request parameters, such as headers, paths, query strings, stage variables, or context variables.
Based on the request, authorization is performed by a lambda function.
Example:
Function authFn;
Resource books;
RequestAuthorizer auth = RequestAuthorizer.Builder.create(this, "booksAuthorizer")
.handler(authFn)
.identitySources(List.of(IdentitySource.header("Authorization")))
.build();
books.addMethod("GET", new HttpIntegration("http://amazon.com"), MethodOptions.builder()
.authorizer(auth)
.build());
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.apigateway.IAuthorizer
IAuthorizer.Jsii$Default, IAuthorizer.Jsii$ProxyNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRequestAuthorizer(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedRequestAuthorizer(software.amazon.jsii.JsiiObjectRef objRef) RequestAuthorizer(software.constructs.Construct scope, String id, RequestAuthorizerProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe ARN of the authorizer to be used in permission policies, such as IAM and resource-based grants.The id of the authorizer.protected CfnAuthorizerPropsprotected IFunctionThe Lambda function handler that this authorizer uses.protected Stringprotected IRolegetRole()The IAM role that the API Gateway service assumes while invoking the Lambda function.protected StringReturns a token that resolves to the Rest Api Id at the time of synthesis.protected voidsetRestApiId(String value) protected voidSets up the permissions necessary for the API Gateway service to invoke the Lambda function.Methods inherited from class software.amazon.awscdk.services.apigateway.Authorizer
getAuthorizationType, isAuthorizerMethods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.services.apigateway.IAuthorizer
getAuthorizationTypeMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
RequestAuthorizer
protected RequestAuthorizer(software.amazon.jsii.JsiiObjectRef objRef) -
RequestAuthorizer
protected RequestAuthorizer(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
RequestAuthorizer
@Stability(Stable) public RequestAuthorizer(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull RequestAuthorizerProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
lazyRestApiId
Returns a token that resolves to the Rest Api Id at the time of synthesis.Throws an error, during token resolution, if no RestApi is attached to this authorizer.
-
setupPermissions
@Stability(Stable) protected void setupPermissions()Sets up the permissions necessary for the API Gateway service to invoke the Lambda function. -
getAuthorizerArn
The ARN of the authorizer to be used in permission policies, such as IAM and resource-based grants. -
getAuthorizerId
The id of the authorizer.- Specified by:
getAuthorizerIdin interfaceIAuthorizer- Specified by:
getAuthorizerIdin classAuthorizer
-
getAuthorizerProps
-
getHandler
The Lambda function handler that this authorizer uses. -
getRole
The IAM role that the API Gateway service assumes while invoking the Lambda function. -
getRestApiId
-
setRestApiId
-