Add ID token support for token exchange#19076
Open
bkoragan wants to merge 1 commit intospring-projects:mainfrom
Open
Add ID token support for token exchange#19076bkoragan wants to merge 1 commit intospring-projects:mainfrom
bkoragan wants to merge 1 commit intospring-projects:mainfrom
Conversation
Introduce support for exchanging externally-issued OIDC ID tokens for access tokens via the OAuth 2.0 Token Exchange Grant per RFC 8693 Section 3. - Add urn:ietf:params:oauth:token-type:id_token as a supported token type in the converter - Add OAuth2TokenExchangeSubjectTokenResolver strategy interface for resolving external subject tokens - Add OidcIdTokenSubjectTokenResolver as the default implementation using JwtDecoderFactory - Modify OAuth2TokenExchangeAuthenticationProvider to delegate to the resolver before falling back to the authorization service - Auto-wire the resolver bean in the configurer Closes spring-projectsgh-19048 Signed-off-by: Bapuji Koraganti <bapuk.2008@gmail.com>
Author
|
@jgrandja Please review and share if any feedback. Note: reference to our proposal discussion :#19048 (comment) |
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.
I discussed this approach and received positive feedback. This PR implements the proposed design.
Summary
Add support for exchanging externally-issued OIDC ID tokens for access tokens via the OAuth 2.0 Token Exchange Grant per RFC 8693 - sec 3.
New classes:
OAuth2TokenExchangeSubjectTokenResolver— strategy interface for resolving external subject tokensOAuth2TokenExchangeSubjectTokenContext— context object with resolved principal, claims, and scopesOidcIdTokenSubjectTokenResolver— default implementation usingJwtDecoderFactory<RegisteredClient>Modified classes:
OAuth2TokenExchangeAuthenticationConverter— acceptid_tokenas supported token typeOAuth2TokenExchangeAuthenticationProvider— delegate to resolver before falling back to authorization serviceOAuth2TokenEndpointConfigurer— auto-wire resolver beanDesign Decisions
final; only token resolution is pluggablenullfor unsupported types (chain-of-responsibility, same pattern asAuthenticationConverter)JwtDecoderFactory<RegisteredClient>follows the same pattern asJwtClientAssertionDecoderFactorygetOptionalBean(same as OAuth2AuthorizationService,OAuth2TokenGenerator`)Configuration Example