Adds support for loading AWS bearer tokens via session constructor params#4761
Open
jacoblee93 wants to merge 1 commit intoboto:developfrom
Open
Adds support for loading AWS bearer tokens via session constructor params#4761jacoblee93 wants to merge 1 commit intoboto:developfrom
jacoblee93 wants to merge 1 commit intoboto:developfrom
Conversation
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Predicated on: boto/botocore#3671
Issue #, if available:
#4723
Description of changes:
Add support for
aws_bearer_tokenas an explicit parameter onSession,Session.client(), andSession.resource(), enabling per-session and per-client bearer token authentication for services that support it (e.g. Bedrock).Motivation
Currently, bearer tokens for services like Bedrock can only be configured via environment variables (e.g.
AWS_BEARER_TOKEN_BEDROCK). This is a problem for multi-tenant systems that need different tokens for different clients within the same process — the environment variable is global and not thread-safe.This PR adds an explicit
aws_bearer_tokenparameter that follows the same pattern asaws_access_key_idandaws_secret_access_key: it can be set at the session level or overridden per-client.Changes
aws_bearer_tokenparameter toSession.__init__(),Session.client(), andSession.resource()is not Nonefor precedence checks so that empty string is treated as an explicit valueNone, for compatibility with older botocore versions that don't support it (same pattern asaws_account_id)Depends on: corresponding botocore PR that adds
aws_bearer_tokentoSession.create_client()Usage