Interface CredentialBrokerAsyncClient

All Superinterfaces:
AutoCloseable, AwsClient, SdkAutoCloseable, SdkClient

@Generated("software.amazon.awssdk:codegen") @SdkPublicApi @ThreadSafe public interface CredentialBrokerAsyncClient extends AwsClient
Service client for accessing AWS IAM CredentialBroker asynchronously. This can be created using the static builder() method.The asynchronous client performs non-blocking I/O when configured with any SdkAsyncHttpClient supported in the SDK. However, full non-blocking is not guaranteed as the async client may perform blocking calls in some cases such as credentials retrieval and endpoint discovery as part of the async API call.

AWS IAM CredentialBroker

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 Details

  • Method Details

    • completeOAuthSessionBinding

      default CompletableFuture<CompleteOAuthSessionBindingResponse> completeOAuthSessionBinding(CompleteOAuthSessionBindingRequest completeOAuthSessionBindingRequest)

      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:
      A Java Future containing the result of the CompleteOAuthSessionBinding operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ThrottlingException The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.
      • ServiceUnavailableException A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, server_error, or temporarily_unavailable). Retryable: the same request may succeed later.
      • ResourceNotFoundException The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.
      • InternalServerException The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.
      • AccessDeniedException The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.
      • ConflictException The request conflicts with the current state of the resource. Nothing was changed. Depending on reason, the request may succeed if retried once the resource reaches a settled state, or it may require different input (for example a name that is not already taken).
      • ValidationException The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • CredentialBrokerException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • completeOAuthSessionBinding

      default CompletableFuture<CompleteOAuthSessionBindingResponse> completeOAuthSessionBinding(Consumer<CompleteOAuthSessionBindingRequest.Builder> completeOAuthSessionBindingRequest)

      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.Builder avoiding the need to create one manually via CompleteOAuthSessionBindingRequest.builder()

      Parameters:
      completeOAuthSessionBindingRequest - A Consumer that will call methods on CompleteOAuthSessionBindingRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the CompleteOAuthSessionBinding operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ThrottlingException The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.
      • ServiceUnavailableException A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, server_error, or temporarily_unavailable). Retryable: the same request may succeed later.
      • ResourceNotFoundException The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.
      • InternalServerException The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.
      • AccessDeniedException The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.
      • ConflictException The request conflicts with the current state of the resource. Nothing was changed. Depending on reason, the request may succeed if retried once the resource reaches a settled state, or it may require different input (for example a name that is not already taken).
      • ValidationException The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • CredentialBrokerException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • getApiKey

      default CompletableFuture<GetApiKeyResponse> getApiKey(GetApiKeyRequest getApiKeyRequest)

      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:
      A Java Future containing the result of the GetApiKey operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ThrottlingException The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.
      • ResourceNotFoundException The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.
      • InternalServerException The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.
      • AccessDeniedException The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.
      • ValidationException The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • CredentialBrokerException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • getApiKey

      default CompletableFuture<GetApiKeyResponse> getApiKey(Consumer<GetApiKeyRequest.Builder> getApiKeyRequest)

      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.Builder avoiding the need to create one manually via GetApiKeyRequest.builder()

      Parameters:
      getApiKeyRequest - A Consumer that will call methods on GetApiKeyRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the GetApiKey operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ThrottlingException The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.
      • ResourceNotFoundException The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.
      • InternalServerException The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.
      • AccessDeniedException The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.
      • ValidationException The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • CredentialBrokerException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • getOAuthToken

      default CompletableFuture<GetOAuthTokenResponse> getOAuthToken(GetOAuthTokenRequest getOAuthTokenRequest)

      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 forceAuthentication to 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:
      A Java Future containing the result of the GetOAuthToken operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ServiceQuotaExceededException The request would exceed a service quota, so it was rejected and nothing was created or changed. Delete resources that are no longer needed, or request a quota increase in Service Quotas using serviceCode and quotaCode, then retry.
      • ThrottlingException The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.
      • ServiceUnavailableException A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, server_error, or temporarily_unavailable). Retryable: the same request may succeed later.
      • ResourceNotFoundException The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.
      • InternalServerException The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.
      • AccessDeniedException The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.
      • ValidationException The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • CredentialBrokerException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • getOAuthToken

      default CompletableFuture<GetOAuthTokenResponse> getOAuthToken(Consumer<GetOAuthTokenRequest.Builder> getOAuthTokenRequest)

      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 forceAuthentication to 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.Builder avoiding the need to create one manually via GetOAuthTokenRequest.builder()

      Parameters:
      getOAuthTokenRequest - A Consumer that will call methods on GetOAuthTokenRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the GetOAuthToken operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ServiceQuotaExceededException The request would exceed a service quota, so it was rejected and nothing was created or changed. Delete resources that are no longer needed, or request a quota increase in Service Quotas using serviceCode and quotaCode, then retry.
      • ThrottlingException The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.
      • ServiceUnavailableException A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, server_error, or temporarily_unavailable). Retryable: the same request may succeed later.
      • ResourceNotFoundException The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.
      • InternalServerException The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.
      • AccessDeniedException The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.
      • ValidationException The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • CredentialBrokerException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • startOAuthSession

      default CompletableFuture<StartOAuthSessionResponse> startOAuthSession(StartOAuthSessionRequest startOAuthSessionRequest)

      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 CompleteOAuthSessionBinding with SESSION_STATE_CONFLICT.

      Parameters:
      startOAuthSessionRequest -
      Returns:
      A Java Future containing the result of the StartOAuthSession operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ThrottlingException The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.
      • ServiceUnavailableException A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, server_error, or temporarily_unavailable). Retryable: the same request may succeed later.
      • ResourceNotFoundException The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.
      • InternalServerException The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.
      • AccessDeniedException The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.
      • ValidationException The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • CredentialBrokerException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • startOAuthSession

      default CompletableFuture<StartOAuthSessionResponse> startOAuthSession(Consumer<StartOAuthSessionRequest.Builder> startOAuthSessionRequest)

      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 CompleteOAuthSessionBinding with SESSION_STATE_CONFLICT.


      This is a convenience which creates an instance of the StartOAuthSessionRequest.Builder avoiding the need to create one manually via StartOAuthSessionRequest.builder()

      Parameters:
      startOAuthSessionRequest - A Consumer that will call methods on StartOAuthSessionRequest.Builder to create a request.
      Returns:
      A Java Future containing the result of the StartOAuthSession operation returned by the service.
      The CompletableFuture returned by this method can be completed exceptionally with the following exceptions. The exception returned is wrapped with CompletionException, so you need to invoke Throwable.getCause() to retrieve the underlying exception.
      • ThrottlingException The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.
      • ServiceUnavailableException A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, server_error, or temporarily_unavailable). Retryable: the same request may succeed later.
      • ResourceNotFoundException The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.
      • InternalServerException The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.
      • AccessDeniedException The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.
      • ValidationException The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.
      • SdkException Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for catch all scenarios.
      • SdkClientException If any client side error occurs such as an IO related failure, failure to get credentials, etc.
      • CredentialBrokerException Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type.
      See Also:
    • serviceClientConfiguration

      default CredentialBrokerServiceClientConfiguration serviceClientConfiguration()
      Description copied from interface: SdkClient
      The SDK service client configuration exposes client settings to the user, e.g., ClientOverrideConfiguration
      Specified by:
      serviceClientConfiguration in interface AwsClient
      Specified by:
      serviceClientConfiguration in interface SdkClient
      Returns:
      SdkServiceClientConfiguration
    • create

      static CredentialBrokerAsyncClient create()
      Create a CredentialBrokerAsyncClient with the region loaded from the DefaultAwsRegionProviderChain and credentials loaded from the DefaultCredentialsProvider.
    • builder

      Create a builder that can be used to configure and create a CredentialBrokerAsyncClient.