Class TokenAuthorizer
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.apigateway.Authorizer
software.amazon.awscdk.services.apigateway.TokenAuthorizer
- All Implemented Interfaces:
IConstruct
,IDependable
,IResource
,IAuthorizer
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:45.128Z")
@Stability(Stable)
public class TokenAuthorizer
extends Authorizer
implements IAuthorizer
Token based lambda authorizer that recognizes the caller's identity as a bearer token, such as a JSON Web Token (JWT) or an OAuth token.
Based on the token, authorization is performed by a lambda function.
Example:
Function authFn; Resource books; TokenAuthorizer auth = TokenAuthorizer.Builder.create(this, "booksAuthorizer") .handler(authFn) .build(); books.addMethod("GET", new HttpIntegration("http://amazon.com"), MethodOptions.builder() .authorizer(auth) .build());
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.apigateway.IAuthorizer
IAuthorizer.Jsii$Default, IAuthorizer.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IResource
IResource.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionprotected
TokenAuthorizer
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
TokenAuthorizer
(software.amazon.jsii.JsiiObjectRef objRef) TokenAuthorizer
(software.constructs.Construct scope, String id, TokenAuthorizerProps 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 IFunction
The Lambda function handler that this authorizer uses.protected String
protected IRole
getRole()
The IAM role that the API Gateway service assumes while invoking the Lambda function.protected String
Returns a token that resolves to the Rest Api Id at the time of synthesis.protected void
setRestApiId
(String value) protected void
Sets 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, isAuthorizer
Methods inherited from class software.amazon.awscdk.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.constructs.Construct
toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.awscdk.services.apigateway.IAuthorizer
getAuthorizationType
Methods inherited from interface software.amazon.awscdk.core.IConstruct
getNode
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
TokenAuthorizer
protected TokenAuthorizer(software.amazon.jsii.JsiiObjectRef objRef) -
TokenAuthorizer
protected TokenAuthorizer(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
TokenAuthorizer
@Stability(Stable) public TokenAuthorizer(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull TokenAuthorizerProps 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:
getAuthorizerId
in interfaceIAuthorizer
- Specified by:
getAuthorizerId
in classAuthorizer
-
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
-