Class GatewayCredentialProvider
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.bedrockagentcore.GatewayCredentialProvider
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.129.0 (build eaca441)",
date="2026-05-19T08:18:44.409Z")
@Stability(Stable)
public abstract class GatewayCredentialProvider
extends software.amazon.jsii.JsiiObject
Factory class for creating different Gateway Credential Providers.
Example:
Gateway gateway = Gateway.Builder.create(this, "MyGateway")
.gatewayName("my-gateway")
.build();
// OAuth2 (recommended): use OAuth2CredentialProvider + bindForGatewayOAuthTarget, or ARNs from console/API
String oauthProviderArn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/oauth2credentialprovider/my-oauth";
String oauthSecretArn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-oauth-secret-abc123";
// Add an MCP server target directly to the gateway
GatewayTarget mcpTarget = gateway.addMcpServerTarget("MyMcpServer", AddMcpServerTargetOptions.builder()
.gatewayTargetName("my-mcp-server")
.description("External MCP server integration")
.endpoint("https://my-mcp-server.example.com")
.credentialProviderConfigurations(List.of(GatewayCredentialProvider.fromOauthIdentityArn(OAuthConfiguration.builder()
.providerArn(oauthProviderArn)
.secretArn(oauthSecretArn)
.scopes(List.of("mcp-runtime-server/invoke"))
.build())))
.build());
// Grant sync permission to a Lambda function that will trigger synchronization
Function syncFunction = Function.Builder.create(this, "SyncFunction")
.runtime(Runtime.PYTHON_3_12)
.handler("index.handler")
.code(Code.fromInline("\nimport boto3\n\ndef handler(event, context):\n client = boto3.client('bedrock-agentcore')\n response = client.synchronize_gateway_targets(\n gatewayIdentifier=event['gatewayId'],\n targetIds=[event['targetId']]\n )\n return response\n "))
.build();
mcpTarget.grantSync(syncFunction);
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedGatewayCredentialProvider(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedGatewayCredentialProvider(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionstatic ICredentialProviderConfigfromApiKeyIdentity(IApiKeyCredentialProvider provider) Create an API key outbound auth configuration from a Token VaultIApiKeyCredentialProviderconstruct.static ICredentialProviderConfigfromApiKeyIdentity(IApiKeyCredentialProvider provider, FromApiKeyIdentityOptions options) Create an API key outbound auth configuration from a Token VaultIApiKeyCredentialProviderconstruct.static ICredentialProviderConfigCreate an API key credential provider from Identity ARN Use this method when you have the Identity ARN as a string.static ICredentialProviderConfigCreate an IAM role credential provider.static ICredentialProviderConfigfromOauthIdentity(IOAuth2CredentialProvider provider, FromOauthIdentityOptions options) Create an OAuth outbound auth configuration from a Token VaultIOAuth2CredentialProviderconstruct.static ICredentialProviderConfigCreate an OAuth credential provider from Identity ARN Use this method when you have the Identity ARN as a string.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
GatewayCredentialProvider
protected GatewayCredentialProvider(software.amazon.jsii.JsiiObjectRef objRef) -
GatewayCredentialProvider
protected GatewayCredentialProvider(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
GatewayCredentialProvider
@Stability(Stable) protected GatewayCredentialProvider()
-
-
Method Details
-
fromApiKeyIdentity
@Stability(Stable) @NotNull public static ICredentialProviderConfig fromApiKeyIdentity(@NotNull IApiKeyCredentialProvider provider, @Nullable FromApiKeyIdentityOptions options) Create an API key outbound auth configuration from a Token VaultIApiKeyCredentialProviderconstruct.Prefer this over
when the provider is defined in CDK.invalid reference
GatewayCredentialProvider.fromApiKeyIdentityArn- Parameters:
provider- This parameter is required.options-
-
fromApiKeyIdentity
@Stability(Stable) @NotNull public static ICredentialProviderConfig fromApiKeyIdentity(@NotNull IApiKeyCredentialProvider provider) Create an API key outbound auth configuration from a Token VaultIApiKeyCredentialProviderconstruct.Prefer this over
when the provider is defined in CDK.invalid reference
GatewayCredentialProvider.fromApiKeyIdentityArn- Parameters:
provider- This parameter is required.
-
fromApiKeyIdentityArn
@Stability(Stable) @NotNull public static ICredentialProviderConfig fromApiKeyIdentityArn(@NotNull ApiKeyCredentialProviderOptions props) Create an API key credential provider from Identity ARN Use this method when you have the Identity ARN as a string.- Parameters:
props-- The configuration properties for the API key credential provider.
- Returns:
- ICredentialProviderConfig configured for API key authentication
-
fromIamRole
Create an IAM role credential provider.- Returns:
- IIamRoleCredentialProvider configured for IAM role authentication
-
fromOauthIdentity
@Stability(Stable) @NotNull public static ICredentialProviderConfig fromOauthIdentity(@NotNull IOAuth2CredentialProvider provider, @NotNull FromOauthIdentityOptions options) Create an OAuth outbound auth configuration from a Token VaultIOAuth2CredentialProviderconstruct.Prefer this over
when the provider is defined in CDK.invalid reference
GatewayCredentialProvider.fromOauthIdentityArn- Parameters:
provider- This parameter is required.options- This parameter is required.
-
fromOauthIdentityArn
@Stability(Stable) @NotNull public static ICredentialProviderConfig fromOauthIdentityArn(@NotNull OAuthConfiguration props) Create an OAuth credential provider from Identity ARN Use this method when you have the Identity ARN as a string.- Parameters:
props-- The configuration properties for the OAuth credential provider.
- Returns:
- ICredentialProviderConfig configured for OAuth authentication
-