Experimental
@aws-cdk/aws-bedrock-agentcore-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
RuntimeAuthorizerConfiguration Class
Abstract base class for runtime authorizer configurations.
Provides static factory methods to create different authentication types.
| Source | lib/runtime/inbound-auth/runtime-authorizer-configuration.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 runtimeCustomClaim: bedrock_agentcore_alpha.RuntimeCustomClaim;
declare const userPool: cognito.UserPool;
declare const userPoolClient: cognito.UserPoolClient;
const runtimeAuthorizerConfiguration = bedrock_agentcore_alpha.RuntimeAuthorizerConfiguration.usingCognito(userPool, [userPoolClient], /* all optional props */ ['allowedAudience'], /* all optional props */ ['allowedScopes'], /* all optional props */ [runtimeCustomClaim]);
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
# runtime_custom_claim: bedrock_agentcore_alpha.RuntimeCustomClaim
# user_pool: cognito.UserPool
# user_pool_client: cognito.UserPoolClient
runtime_authorizer_configuration = bedrock_agentcore_alpha.RuntimeAuthorizerConfiguration.using_cognito(user_pool, [user_pool_client], ["allowedAudience"], ["allowedScopes"], [runtime_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.*;
RuntimeCustomClaim runtimeCustomClaim;
UserPool userPool;
UserPoolClient userPoolClient;
RuntimeAuthorizerConfiguration runtimeAuthorizerConfiguration = RuntimeAuthorizerConfiguration.usingCognito(userPool, List.of(userPoolClient), List.of("allowedAudience"), List.of("allowedScopes"), List.of(runtimeCustomClaim));
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;
RuntimeCustomClaim runtimeCustomClaim;
UserPool userPool;
UserPoolClient userPoolClient;
var runtimeAuthorizerConfiguration = RuntimeAuthorizerConfiguration.UsingCognito(userPool, new [] { userPoolClient }, new [] { "allowedAudience" }, new [] { "allowedScopes" }, new [] { runtimeCustomClaim });
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 runtimeCustomClaim RuntimeCustomClaim
var userPool UserPool
var userPoolClient UserPoolClient
runtimeAuthorizerConfiguration := bedrock_agentcore_alpha.RuntimeAuthorizerConfiguration_UsingCognito(userPool, []IUserPoolClient{
userPoolClient,
}, []*string{
jsii.String("allowedAudience"),
}, []*string{
jsii.String("allowedScopes"),
}, []RuntimeCustomClaim{
runtimeCustomClaim,
})
Initializer
ts
new RuntimeAuthorizerConfiguration()
python
RuntimeAuthorizerConfiguration()
java
new RuntimeAuthorizerConfiguration()
csharp
new RuntimeAuthorizerConfiguration()
go
NewRuntimeAuthorizerConfiguration()
Methods
usingCognito(userPool: IUserPool, userPoolClients: IUserPoolClient[], allowedAudience?: string[], allowedScopes?: string[], customClaims?: RuntimeCustomClaim[]): RuntimeAuthorizerConfiguration // chainable@staticmethod def using_cognito(user_pool: IUserPool, user_pool_clients: typing.List[IUserPoolClient], allowed_audience: typing.Optional[typing.List[str]] = None, allowed_scopes: typing.Optional[typing.List[str]] = None, custom_claims: typing.Optional[typing.List[RuntimeCustomClaim]] = None) -> RuntimeAuthorizerConfigurationpublic static RuntimeAuthorizerConfiguration usingCognito(IUserPool userPool, List<IUserPoolClient> userPoolClients, List<String> allowedAudience, List<String> allowedScopes, List<RuntimeCustomClaim> customClaims)public static RuntimeAuthorizerConfiguration UsingCognito(IUserPool userPool, IUserPoolClient[] userPoolClients, string[]? allowedAudience = null, string[]? allowedScopes = null, RuntimeCustomClaim[]? customClaims = null)func UsingCognito(UserPool IUserPool, UserPoolClients *[]IUserPoolClient, AllowedAudience *[]*string, AllowedScopes *[]*string, CustomClaims *[]RuntimeCustomClaim) RuntimeAuthorizerConfiguration static #Use AWS Cognito User Pool authentication.
Validates Cognito-issued JWT tokens.
5 parameters · returns
Parameters
userPooluser_pooluserPooluserPoolUserPool— The Cognito User Pool.userPoolClientsuser_pool_clientsuserPoolClientsuserPoolClientsUserPoolClients— The Cognito User Pool App Clients.allowedAudienceallowed_audienceallowedAudienceallowedAudienceAllowedAudience— Optional array of allowed audiences.allowedScopesallowed_scopesallowedScopesallowedScopesAllowedScopes— Optional array of allowed scopes.customClaimscustom_claimscustomClaimscustomClaimsCustomClaims— Optional array of custom claim validations.
Returns: RuntimeAuthorizerConfiguration for Cognito authentication
usingIAM(): RuntimeAuthorizerConfiguration // chainable@staticmethod def using_iam() -> RuntimeAuthorizerConfigurationpublic static RuntimeAuthorizerConfiguration usingIAM()public static RuntimeAuthorizerConfiguration UsingIAM()func UsingIAM() RuntimeAuthorizerConfiguration static #Use IAM authentication (default).
Requires AWS credentials to sign requests using SigV4.
returns
Returns: RuntimeAuthorizerConfiguration for IAM authentication
usingJWT(discoveryUrl: string, allowedClients?: string[], allowedAudience?: string[], allowedScopes?: string[], customClaims?: RuntimeCustomClaim[]): RuntimeAuthorizerConfiguration // chainable@staticmethod def using_jwt(discovery_url: str, allowed_clients: typing.Optional[typing.List[str]] = None, allowed_audience: typing.Optional[typing.List[str]] = None, allowed_scopes: typing.Optional[typing.List[str]] = None, custom_claims: typing.Optional[typing.List[RuntimeCustomClaim]] = None) -> RuntimeAuthorizerConfigurationpublic static RuntimeAuthorizerConfiguration usingJWT(String discoveryUrl, List<String> allowedClients, List<String> allowedAudience, List<String> allowedScopes, List<RuntimeCustomClaim> customClaims)public static RuntimeAuthorizerConfiguration UsingJWT(string discoveryUrl, string[]? allowedClients = null, string[]? allowedAudience = null, string[]? allowedScopes = null, RuntimeCustomClaim[]? customClaims = null)func UsingJWT(DiscoveryUrl *string, AllowedClients *[]*string, AllowedAudience *[]*string, AllowedScopes *[]*string, CustomClaims *[]RuntimeCustomClaim) RuntimeAuthorizerConfiguration static #Use custom JWT authentication.
Validates JWT tokens against the specified OIDC provider.
5 parameters · returns
Parameters
discoveryUrldiscovery_urldiscoveryUrldiscoveryUrlDiscoveryUrl— The OIDC discovery URL (must end with /.well-known/openid-configuration).allowedClientsallowed_clientsallowedClientsallowedClientsAllowedClients— Optional array of allowed client IDs.allowedAudienceallowed_audienceallowedAudienceallowedAudienceAllowedAudience— Optional array of allowed audiences.allowedScopesallowed_scopesallowedScopesallowedScopesAllowedScopes— Optional array of allowed scopes.customClaimscustom_claimscustomClaimscustomClaimsCustomClaims— Optional array of custom claim validations.
Returns: RuntimeAuthorizerConfiguration for JWT authentication
usingOAuth(discoveryUrl: string, clientId: string, allowedAudience?: string[], allowedScopes?: string[], customClaims?: RuntimeCustomClaim[]): RuntimeAuthorizerConfiguration // chainable@staticmethod def using_o_auth(discovery_url: str, client_id: str, allowed_audience: typing.Optional[typing.List[str]] = None, allowed_scopes: typing.Optional[typing.List[str]] = None, custom_claims: typing.Optional[typing.List[RuntimeCustomClaim]] = None) -> RuntimeAuthorizerConfigurationpublic static RuntimeAuthorizerConfiguration usingOAuth(String discoveryUrl, String clientId, List<String> allowedAudience, List<String> allowedScopes, List<RuntimeCustomClaim> customClaims)public static RuntimeAuthorizerConfiguration UsingOAuth(string discoveryUrl, string clientId, string[]? allowedAudience = null, string[]? allowedScopes = null, RuntimeCustomClaim[]? customClaims = null)func UsingOAuth(DiscoveryUrl *string, ClientId *string, AllowedAudience *[]*string, AllowedScopes *[]*string, CustomClaims *[]RuntimeCustomClaim) RuntimeAuthorizerConfiguration static #Use OAuth 2.0 authentication. Supports various OAuth providers.
5 parameters · returns
Parameters
discoveryUrldiscovery_urldiscoveryUrldiscoveryUrlDiscoveryUrl— The OIDC discovery URL (must end with /.well-known/openid-configuration).clientIdclient_idclientIdclientIdClientId— OAuth client ID.allowedAudienceallowed_audienceallowedAudienceallowedAudienceAllowedAudience— Optional array of allowed audiences.allowedScopesallowed_scopesallowedScopesallowedScopesAllowedScopes— Optional array of allowed scopes.customClaimscustom_claimscustomClaimscustomClaimsCustomClaims— Optional array of custom claim validations.
Returns: RuntimeAuthorizerConfiguration for OAuth authentication