# CognitoAuthorizerProps

Properties for configuring a Cognito authorizer.

Used as argument in: [GatewayAuthorizer.usingCognito](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.GatewayAuthorizer.html#usingcognito)

- Source: [`lib/gateway/inbound-auth/authorizer.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-bedrock-agentcore-alpha/lib/gateway/inbound-auth/authorizer.ts#L171)

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as bedrock_agentcore_alpha from '@aws-cdk/aws-bedrock-agentcore-alpha';
import { aws_cognito as cognito } from 'aws-cdk-lib';

declare const gatewayCustomClaim: bedrock_agentcore_alpha.GatewayCustomClaim;
declare const userPool: cognito.UserPool;
declare const userPoolClient: cognito.UserPoolClient;
const cognitoAuthorizerProps: bedrock_agentcore_alpha.CognitoAuthorizerProps = {
  userPool: userPool,

  // the properties below are optional
  allowedAudiences: ['allowedAudiences'],
  allowedClients: [userPoolClient],
  allowedScopes: ['allowedScopes'],
  customClaims: [gatewayCustomClaim],
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_bedrock_agentcore_alpha as bedrock_agentcore_alpha
from aws_cdk import aws_cognito as cognito

# gateway_custom_claim: bedrock_agentcore_alpha.GatewayCustomClaim
# user_pool: cognito.UserPool
# user_pool_client: cognito.UserPoolClient

cognito_authorizer_props = bedrock_agentcore_alpha.CognitoAuthorizerProps(
    user_pool=user_pool,

    # the properties below are optional
    allowed_audiences=["allowedAudiences"],
    allowed_clients=[user_pool_client],
    allowed_scopes=["allowedScopes"],
    custom_claims=[gateway_custom_claim]
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.agentcore.alpha.*;
import software.amazon.awscdk.services.cognito.*;

GatewayCustomClaim gatewayCustomClaim;
UserPool userPool;
UserPoolClient userPoolClient;

CognitoAuthorizerProps cognitoAuthorizerProps = CognitoAuthorizerProps.builder()
        .userPool(userPool)

        // the properties below are optional
        .allowedAudiences(List.of("allowedAudiences"))
        .allowedClients(List.of(userPoolClient))
        .allowedScopes(List.of("allowedScopes"))
        .customClaims(List.of(gatewayCustomClaim))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Agentcore.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Bedrock.Agentcore.Alpha;
using Amazon.CDK.AWS.Cognito;

GatewayCustomClaim gatewayCustomClaim;
UserPool userPool;
UserPoolClient userPoolClient;

var cognitoAuthorizerProps = new CognitoAuthorizerProps {
    UserPool = userPool,

    // the properties below are optional
    AllowedAudiences = new [] { "allowedAudiences" },
    AllowedClients = new [] { userPoolClient },
    AllowedScopes = new [] { "allowedScopes" },
    CustomClaims = new [] { gatewayCustomClaim }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_agentcore_alpha "github.com/aws/aws-cdk-go/awsbedrockagentcorealpha"
import "github.com/aws/aws-cdk-go/awscdk"

var gatewayCustomClaim GatewayCustomClaim
var userPool UserPool
var userPoolClient UserPoolClient

cognitoAuthorizerProps := &CognitoAuthorizerProps{
	UserPool: userPool,

	// the properties below are optional
	AllowedAudiences: []*string{
		jsii.String("allowedAudiences"),
	},
	AllowedClients: []IUserPoolClient{
		userPoolClient,
	},
	AllowedScopes: []*string{
		jsii.String("allowedScopes"),
	},
	CustomClaims: []GatewayCustomClaim{
		gatewayCustomClaim,
	},
}
```

## Properties

- `allowedAudiences`: string[] — The allowed audiences for JWT validation.

  **Default:** No audience validation

- `allowedClients`: [IUserPoolClient](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.IUserPoolClient.html)[] — The allowed User Pool clients.

  **Default:** All clients are allowed

- `allowedScopes`: string[] — The allowed scopes for JWT validation.

  **Default:** No scope validation

- `customClaims`: [GatewayCustomClaim](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.GatewayCustomClaim.html)[] — Custom claims for additional JWT token validation.

  **Default:** No custom claim validation

  Allows you to validate additional fields in JWT tokens beyond the standard audience, client, and scope validations.

- `userPool`: [IUserPool](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.IUserPool.html) (required) — The Cognito User Pool to use for authentication.
