# AuthorizationType

- Source: [`aws-apigateway/lib/method.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-apigateway/lib/method.ts#L564)

## Example

TypeScript:

```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:

```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:

```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());
```

C# / .NET:

```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
});
```

Golang:

```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

| Member | Description |
| --- | --- |
| `NONE` | Open access. |
| `IAM` | Use AWS IAM permissions. |
| `CUSTOM` | Use a custom authorizer. |
| `COGNITO` | Use an AWS Cognito user pool. |

## Referenced by

- [`Authorizer`](/v2/docs/aws-cdk-lib.aws_apigateway.Authorizer).authorizationType
- [`CognitoUserPoolsAuthorizer`](/v2/docs/aws-cdk-lib.aws_apigateway.CognitoUserPoolsAuthorizer).authorizationType
- [`IAuthorizer`](/v2/docs/aws-cdk-lib.aws_apigateway.IAuthorizer).authorizationType
- [`MethodOptions`](/v2/docs/aws-cdk-lib.aws_apigateway.MethodOptions).authorizationType
