Class: Aws::CredentialBroker::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::CredentialBroker::Client
- Includes:
- Aws::ClientStubs
- Defined in:
- gems/aws-sdk-credentialbroker/lib/aws-sdk-credentialbroker/client.rb
Overview
An API client for CredentialBroker. To construct a client, you need to configure a :region and :credentials.
client = Aws::CredentialBroker::Client.new(
region: region_name,
credentials: credentials,
# ...
)
For details on configuring region and credentials see the developer guide.
See #initialize for a full list of supported configuration options.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Base
API Operations collapse
-
#complete_o_auth_session_binding(params = {}) ⇒ Types::CompleteOAuthSessionBindingResponse
Completes a consent session.
-
#get_api_key(params = {}) ⇒ Types::GetApiKeyResponse
Retrieves the API key held by an API key credential provider.
-
#get_o_auth_token(params = {}) ⇒ Types::GetOAuthTokenResponse
Retrieves an OAuth access token from a credential provider.
-
#start_o_auth_session(params = {}) ⇒ Types::StartOAuthSessionResponse
Starts a consent session so an end user can authorize the broker to obtain tokens on their behalf.
Instance Method Summary collapse
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
Methods included from Aws::ClientStubs
#api_requests, #stub_data, #stub_responses
Methods inherited from Seahorse::Client::Base
add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
479 480 481 |
# File 'gems/aws-sdk-credentialbroker/lib/aws-sdk-credentialbroker/client.rb', line 479 def initialize(*args) super end |
Instance Method Details
#complete_o_auth_session_binding(params = {}) ⇒ Types::CompleteOAuthSessionBindingResponse
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.
513 514 515 516 |
# File 'gems/aws-sdk-credentialbroker/lib/aws-sdk-credentialbroker/client.rb', line 513 def complete_o_auth_session_binding(params = {}, = {}) req = build_request(:complete_o_auth_session_binding, params) req.send_request() end |
#get_api_key(params = {}) ⇒ Types::GetApiKeyResponse
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.
545 546 547 548 |
# File 'gems/aws-sdk-credentialbroker/lib/aws-sdk-credentialbroker/client.rb', line 545 def get_api_key(params = {}, = {}) req = build_request(:get_api_key, params) req.send_request() end |
#get_o_auth_token(params = {}) ⇒ Types::GetOAuthTokenResponse
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.
640 641 642 643 |
# File 'gems/aws-sdk-credentialbroker/lib/aws-sdk-credentialbroker/client.rb', line 640 def get_o_auth_token(params = {}, = {}) req = build_request(:get_o_auth_token, params) req.send_request() end |
#start_o_auth_session(params = {}) ⇒ Types::StartOAuthSessionResponse
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.
722 723 724 725 |
# File 'gems/aws-sdk-credentialbroker/lib/aws-sdk-credentialbroker/client.rb', line 722 def start_o_auth_session(params = {}, = {}) req = build_request(:start_o_auth_session, params) req.send_request() end |