Conversation
Add OAuth2 Client Credentials flow implementation with TokenProvider and Verifier traits support. Includes token caching, automatic renewal, and comprehensive error handling. Features: - OAuth2TokenProvider implementing TokenProvider trait - OAuth2Verifier leveraging existing JWT infrastructure - Thread-safe token caching with configurable buffer time - Form-encoded requests following RFC 6749 standard - Integration with existing JwtBuilder pattern - 13 comprehensive unit tests covering all scenarios The implementation supports client_id/client_secret authentication, automatic token renewal, and public key resolution for verification. Fixes: agntcy#400 Signed-off-by: Rahul Sharma <er.csrahul@gmail.com>
Apply cargo fmt to fix trailing spaces and line formatting issues identified by CI lint checks. No functional changes, only formatting improvements. Signed-off-by: Rahul Sharma <er.csrahul@gmail.com>
Contributor
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.
Description
This PR implements the OAuth2 Client Credentials flow identity provider as requested in issue #400. The implementation provides both
TokenProviderandVerifiertraits support with comprehensive token caching and error handling.Core Implementation
TokenProvidertrait with client_id/client_secret authenticationVerifiertrait leveraging existing JWT infrastructureFiles Modified
data-plane/core/auth/src/oauth2.rs- New OAuth2 implementation (704 lines)data-plane/core/auth/src/errors.rs- Added OAuth2-specific error typesdata-plane/core/auth/src/lib.rs- Added module exports for easy accessdata-plane/core/auth/src/builder.rs- Extended builder pattern for OAuth2 supportTesting
All tests pass with comprehensive coverage:
Test scenarios include:
Usage Example
Type of Change
Checklist
Fixes: #400