CognitoAuthorizerProps Struct
Properties for configuring a Cognito authorizer.
| Source | lib/gateway/inbound-auth/authorizer.ts |
|---|
Example
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
# 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
// 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();
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 }
};
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
allowedAudiencesoptionalstring[]allowed_audiencesoptionaltyping.List[str]allowedAudiencesoptionalList<String>AllowedAudiencesoptionalstring[]AllowedAudiencesoptional*[]*string #The allowed audiences for JWT validation.
Default: No audience validation
allowedClientsoptionalIUserPoolClient[]allowed_clientsoptionaltyping.List[IUserPoolClient]allowedClientsoptionalList<IUserPoolClient>AllowedClientsoptionalIUserPoolClient[]AllowedClientsoptional*[]IUserPoolClient #The allowed User Pool clients.
Default: All clients are allowed
allowedScopesoptionalstring[]allowed_scopesoptionaltyping.List[str]allowedScopesoptionalList<String>AllowedScopesoptionalstring[]AllowedScopesoptional*[]*string #The allowed scopes for JWT validation.
Default: No scope validation
customClaimsoptionalGatewayCustomClaim[]custom_claimsoptionaltyping.List[GatewayCustomClaim]customClaimsoptionalList<GatewayCustomClaim>CustomClaimsoptionalGatewayCustomClaim[]CustomClaimsoptional*[]GatewayCustomClaim #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.