Interface CredentialBrokerClient
- All Superinterfaces:
AutoCloseable,AwsClient,SdkAutoCloseable,SdkClient
builder()
method.
AWS IAM CredentialBroker manages credentials that your workloads use to call non-AWS parties. A workload presents its AWS IAM credentials, and the broker returns a credential obtained from the third party — exchanging and refreshing it against the authorization server on the workload's behalf — so the workload never holds the third party's long-lived secrets. Credential providers are configured with the AWS IAM CredentialBroker Control API. The operations here retrieve credentials from a provider that already exists.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValue for looking up the service's metadata from theServiceMetadataProvider.static final String -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a builder that can be used to configure and create aCredentialBrokerClient.completeOAuthSessionBinding(Consumer<CompleteOAuthSessionBindingRequest.Builder> completeOAuthSessionBindingRequest) Completes a consent session.completeOAuthSessionBinding(CompleteOAuthSessionBindingRequest completeOAuthSessionBindingRequest) Completes a consent session.static CredentialBrokerClientcreate()Create aCredentialBrokerClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider.default GetApiKeyResponsegetApiKey(Consumer<GetApiKeyRequest.Builder> getApiKeyRequest) Retrieves the API key held by an API key credential provider.default GetApiKeyResponsegetApiKey(GetApiKeyRequest getApiKeyRequest) Retrieves the API key held by an API key credential provider.default GetOAuthTokenResponsegetOAuthToken(Consumer<GetOAuthTokenRequest.Builder> getOAuthTokenRequest) Retrieves an OAuth access token from a credential provider.default GetOAuthTokenResponsegetOAuthToken(GetOAuthTokenRequest getOAuthTokenRequest) Retrieves an OAuth access token from a credential provider.The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfigurationstatic ServiceMetadatadefault StartOAuthSessionResponsestartOAuthSession(Consumer<StartOAuthSessionRequest.Builder> startOAuthSessionRequest) Starts a consent session so an end user can authorize the broker to obtain tokens on their behalf.default StartOAuthSessionResponsestartOAuthSession(StartOAuthSessionRequest startOAuthSessionRequest) Starts a consent session so an end user can authorize the broker to obtain tokens on their behalf.Methods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
closeMethods inherited from interface software.amazon.awssdk.core.SdkClient
serviceName
-
Field Details
-
SERVICE_NAME
- See Also:
-
SERVICE_METADATA_ID
Value for looking up the service's metadata from theServiceMetadataProvider.- See Also:
-
-
Method Details
-
completeOAuthSessionBinding
default CompleteOAuthSessionBindingResponse completeOAuthSessionBinding(CompleteOAuthSessionBindingRequest completeOAuthSessionBindingRequest) throws ThrottlingException, ServiceUnavailableException, ResourceNotFoundException, InternalServerException, AccessDeniedException, ConflictException, ValidationException, AwsServiceException, SdkClientException, CredentialBrokerException Completes a consent session. Call this from the handler at your session-binding URL, over a session carrying the same end-user identity that started the flow. On a match the broker obtains the token and holds it for later retrieval. On a mismatch it fails with AccessDeniedException and reason SESSION_BINDING_IDENTITY_MISMATCH, and no token is kept.
- Parameters:
completeOAuthSessionBindingRequest-- Returns:
- Result of the CompleteOAuthSessionBinding operation returned by the service.
- See Also:
-
completeOAuthSessionBinding
default CompleteOAuthSessionBindingResponse completeOAuthSessionBinding(Consumer<CompleteOAuthSessionBindingRequest.Builder> completeOAuthSessionBindingRequest) throws ThrottlingException, ServiceUnavailableException, ResourceNotFoundException, InternalServerException, AccessDeniedException, ConflictException, ValidationException, AwsServiceException, SdkClientException, CredentialBrokerException Completes a consent session. Call this from the handler at your session-binding URL, over a session carrying the same end-user identity that started the flow. On a match the broker obtains the token and holds it for later retrieval. On a mismatch it fails with AccessDeniedException and reason SESSION_BINDING_IDENTITY_MISMATCH, and no token is kept.
This is a convenience which creates an instance of the
CompleteOAuthSessionBindingRequest.Builderavoiding the need to create one manually viaCompleteOAuthSessionBindingRequest.builder()- Parameters:
completeOAuthSessionBindingRequest- AConsumerthat will call methods onCompleteOAuthSessionBindingRequest.Builderto create a request.- Returns:
- Result of the CompleteOAuthSessionBinding operation returned by the service.
- See Also:
-
getApiKey
default GetApiKeyResponse getApiKey(GetApiKeyRequest getApiKeyRequest) throws ThrottlingException, ResourceNotFoundException, InternalServerException, AccessDeniedException, ValidationException, AwsServiceException, SdkClientException, CredentialBrokerException Retrieves the API key held by an API key credential provider. The broker reads the key from the AWS Secrets Manager secret the provider was configured with and returns it, so your workload does not need its own access to that secret.
- Parameters:
getApiKeyRequest-- Returns:
- Result of the GetApiKey operation returned by the service.
- See Also:
-
getApiKey
default GetApiKeyResponse getApiKey(Consumer<GetApiKeyRequest.Builder> getApiKeyRequest) throws ThrottlingException, ResourceNotFoundException, InternalServerException, AccessDeniedException, ValidationException, AwsServiceException, SdkClientException, CredentialBrokerException Retrieves the API key held by an API key credential provider. The broker reads the key from the AWS Secrets Manager secret the provider was configured with and returns it, so your workload does not need its own access to that secret.
This is a convenience which creates an instance of the
GetApiKeyRequest.Builderavoiding the need to create one manually viaGetApiKeyRequest.builder()- Parameters:
getApiKeyRequest- AConsumerthat will call methods onGetApiKeyRequest.Builderto create a request.- Returns:
- Result of the GetApiKey operation returned by the service.
- See Also:
-
getOAuthToken
default GetOAuthTokenResponse getOAuthToken(GetOAuthTokenRequest getOAuthTokenRequest) throws ServiceQuotaExceededException, ThrottlingException, ServiceUnavailableException, ResourceNotFoundException, InternalServerException, AccessDeniedException, ValidationException, AwsServiceException, SdkClientException, CredentialBrokerException Retrieves an OAuth access token from a credential provider. The broker authenticates to the provider's authorization server with the client credentials configured on the provider, obtains a token, and returns it — so your workload never handles the provider's client secret.
The broker caches the access token it obtains until that token expires, or for up to one hour when the token's own lifetime is longer than an hour. A call made while a cached token is still valid returns that token instead of requesting a new one; set
forceAuthenticationto bypass the cache and force a fresh request to the authorization server.The grant type you name must be one the provider allows. CLIENT_CREDENTIALS returns a token representing the workload itself; TOKEN_EXCHANGE returns a token that preserves the identity of the caller the workload is acting for; AUTHORIZATION_CODE returns a token representing an end user who granted consent, and requires a consent session that user has already completed, named in
sessionUri; JWT_AUTHORIZATION_GRANT presents a signed JWT as the grant, so no client secret is sent on the token request. Of the supported vendors, only Microsoft Entra ID accepts this grant today: Entra implements on-behalf-of delegation with the RFC 7523 JWT bearer grant (urn:ietf:params:oauth:grant-type:jwt-bearer), where other authorization servers use RFC 8693 token exchange.- Parameters:
getOAuthTokenRequest-- Returns:
- Result of the GetOAuthToken operation returned by the service.
- See Also:
-
getOAuthToken
default GetOAuthTokenResponse getOAuthToken(Consumer<GetOAuthTokenRequest.Builder> getOAuthTokenRequest) throws ServiceQuotaExceededException, ThrottlingException, ServiceUnavailableException, ResourceNotFoundException, InternalServerException, AccessDeniedException, ValidationException, AwsServiceException, SdkClientException, CredentialBrokerException Retrieves an OAuth access token from a credential provider. The broker authenticates to the provider's authorization server with the client credentials configured on the provider, obtains a token, and returns it — so your workload never handles the provider's client secret.
The broker caches the access token it obtains until that token expires, or for up to one hour when the token's own lifetime is longer than an hour. A call made while a cached token is still valid returns that token instead of requesting a new one; set
forceAuthenticationto bypass the cache and force a fresh request to the authorization server.The grant type you name must be one the provider allows. CLIENT_CREDENTIALS returns a token representing the workload itself; TOKEN_EXCHANGE returns a token that preserves the identity of the caller the workload is acting for; AUTHORIZATION_CODE returns a token representing an end user who granted consent, and requires a consent session that user has already completed, named in
sessionUri; JWT_AUTHORIZATION_GRANT presents a signed JWT as the grant, so no client secret is sent on the token request. Of the supported vendors, only Microsoft Entra ID accepts this grant today: Entra implements on-behalf-of delegation with the RFC 7523 JWT bearer grant (urn:ietf:params:oauth:grant-type:jwt-bearer), where other authorization servers use RFC 8693 token exchange.
This is a convenience which creates an instance of the
GetOAuthTokenRequest.Builderavoiding the need to create one manually viaGetOAuthTokenRequest.builder()- Parameters:
getOAuthTokenRequest- AConsumerthat will call methods onGetOAuthTokenRequest.Builderto create a request.- Returns:
- Result of the GetOAuthToken operation returned by the service.
- See Also:
-
startOAuthSession
default StartOAuthSessionResponse startOAuthSession(StartOAuthSessionRequest startOAuthSessionRequest) throws ThrottlingException, ServiceUnavailableException, ResourceNotFoundException, InternalServerException, AccessDeniedException, ValidationException, AwsServiceException, SdkClientException, CredentialBrokerException Starts a consent session so an end user can authorize the broker to obtain tokens on their behalf. Returns a URL to send the user's browser to, and a handle identifying the session.
Call this when GetOAuthToken returns no token for a provider that requires user consent. When a valid token is already available, this returns it directly and no consent is needed.
The operation is not idempotent and takes no idempotency token: it is an OAuth consent-flow step rather than durable resource creation. A replayed session is rejected by
CompleteOAuthSessionBindingwithSESSION_STATE_CONFLICT.- Parameters:
startOAuthSessionRequest-- Returns:
- Result of the StartOAuthSession operation returned by the service.
- See Also:
-
startOAuthSession
default StartOAuthSessionResponse startOAuthSession(Consumer<StartOAuthSessionRequest.Builder> startOAuthSessionRequest) throws ThrottlingException, ServiceUnavailableException, ResourceNotFoundException, InternalServerException, AccessDeniedException, ValidationException, AwsServiceException, SdkClientException, CredentialBrokerException Starts a consent session so an end user can authorize the broker to obtain tokens on their behalf. Returns a URL to send the user's browser to, and a handle identifying the session.
Call this when GetOAuthToken returns no token for a provider that requires user consent. When a valid token is already available, this returns it directly and no consent is needed.
The operation is not idempotent and takes no idempotency token: it is an OAuth consent-flow step rather than durable resource creation. A replayed session is rejected by
CompleteOAuthSessionBindingwithSESSION_STATE_CONFLICT.
This is a convenience which creates an instance of the
StartOAuthSessionRequest.Builderavoiding the need to create one manually viaStartOAuthSessionRequest.builder()- Parameters:
startOAuthSessionRequest- AConsumerthat will call methods onStartOAuthSessionRequest.Builderto create a request.- Returns:
- Result of the StartOAuthSession operation returned by the service.
- See Also:
-
create
Create aCredentialBrokerClientwith the region loaded from theDefaultAwsRegionProviderChainand credentials loaded from theDefaultCredentialsProvider. -
builder
Create a builder that can be used to configure and create aCredentialBrokerClient. -
serviceMetadata
-
serviceClientConfiguration
Description copied from interface:SdkClientThe SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration- Specified by:
serviceClientConfigurationin interfaceAwsClient- Specified by:
serviceClientConfigurationin interfaceSdkClient- Returns:
- SdkServiceClientConfiguration
-