Conversation
|
|
Referenced issues are closed or don't exist. Please ensure there is an open issue related to this change to avoid significant delays or closure. |
This branch has not been deployed
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.



Issue number: Follow-up to #8466 and #8469; implements the deferred outbound OAuth client.
Summary
Lambda functions calling an OAuth2-protected API currently need to manage token exchange, secret retrieval, token lifetimes, and concurrent refresh themselves. This adds
OAuth2Clientunderutilities.auth_alpha.oauth2Changes
client_credentialsgrant withclient_secret_basic, configurable scopes, and mutually exclusiveaudienceor RFC 8707resourceselection.auth_headers()for application-owned HTTP clients and a synchronous HTTPSrequest()helper. Disable redirects and downstream retries, reject competing Authorization headers, and use separate acquisition and downstream budgets.[oauth2]extra requiring only urllib3, dependency-isolation tests, functional and local TLS tests, Lambda examples, API documentation, and a downstream MCP example.Only client-credentials acquisition is included. Interactive grants, delegated token exchange, introspection, other client authentication methods, and a native async API remain outside this change.
User experience
Install
aws-lambda-powertools[oauth2]and configure a client outside the Lambda handler:Applications can instead obtain headers with
inventory_api.auth_headers(). The guide includes a Parameters secret loader, testing examples, and guidance on trusted destinations, secret rotation, provider resource selection, and timeout limitations. The namespace remains experimental and its API may change before GA.Validation
Validation uses a local TLS token endpoint. Live identity-provider interoperability and AWS deployment tests were not run. The documentation build retains existing warnings about unrelated links and external assets.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.