Skip to content
v2.277.0

AuthorizationType Enum ​

Example ​

ts
const userPool = new cognito.UserPool(this, 'UserPool');

const auth = new apigateway.CognitoUserPoolsAuthorizer(this, 'booksAuthorizer', {
  cognitoUserPools: [userPool]
});

declare const books: apigateway.Resource;
books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), {
  authorizer: auth,
  authorizationType: apigateway.AuthorizationType.COGNITO,
});
python
# books: apigateway.Resource
user_pool = cognito.UserPool(self, "UserPool")

auth = apigateway.CognitoUserPoolsAuthorizer(self, "booksAuthorizer",
    cognito_user_pools=[user_pool]
)
books.add_method("GET", apigateway.HttpIntegration("http://amazon.com"),
    authorizer=auth,
    authorization_type=apigateway.AuthorizationType.COGNITO
)
java
Resource books;
UserPool userPool = new UserPool(this, "UserPool");

CognitoUserPoolsAuthorizer auth = CognitoUserPoolsAuthorizer.Builder.create(this, "booksAuthorizer")
        .cognitoUserPools(List.of(userPool))
        .build();
books.addMethod("GET", new HttpIntegration("http://amazon.com"), MethodOptions.builder()
        .authorizer(auth)
        .authorizationType(AuthorizationType.COGNITO)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
Resource books;
var userPool = new UserPool(this, "UserPool");

var auth = new CognitoUserPoolsAuthorizer(this, "booksAuthorizer", new CognitoUserPoolsAuthorizerProps {
    CognitoUserPools = new [] { userPool }
});
books.AddMethod("GET", new HttpIntegration("http://amazon.com"), new MethodOptions {
    Authorizer = auth,
    AuthorizationType = AuthorizationType.COGNITO
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var books Resource
userPool := cognito.NewUserPool(this, jsii.String("UserPool"))

auth := apigateway.NewCognitoUserPoolsAuthorizer(this, jsii.String("booksAuthorizer"), &CognitoUserPoolsAuthorizerProps{
	CognitoUserPools: []IUserPool{
		userPool,
	},
})
books.AddMethod(jsii.String("GET"), apigateway.NewHttpIntegration(jsii.String("http://amazon.com")), &MethodOptions{
	Authorizer: auth,
	AuthorizationType: apigateway.AuthorizationType_COGNITO,
})

Members ​

MemberDescription
NONEOpen access.
IAMUse AWS IAM permissions.
CUSTOMUse a custom authorizer.
COGNITOUse an AWS Cognito user pool.

Referenced by ​

  • Authorizer.authorizationTypeauthorization_typeauthorizationTypeAuthorizationTypeAuthorizationType
  • CognitoUserPoolsAuthorizer.authorizationTypeauthorization_typeauthorizationTypeAuthorizationTypeAuthorizationType
  • IAuthorizer.authorizationTypeauthorization_typeauthorizationTypeAuthorizationTypeAuthorizationType
  • MethodOptions.authorizationTypeauthorization_typeauthorizationTypeAuthorizationTypeAuthorizationType