feature: Added configurable token endpoint auth method selection#1496
Open
RobotechUSA wants to merge 2 commits intomodelcontextprotocol:mainfrom
Open
feature: Added configurable token endpoint auth method selection#1496RobotechUSA wants to merge 2 commits intomodelcontextprotocol:mainfrom
RobotechUSA wants to merge 2 commits intomodelcontextprotocol:mainfrom
Conversation
The OAuth client currently selects the first token endpoint authentication method advertised by the authorization server. That can fail when servers expose multiple supported methods and the caller needs to prefer a different option based on client type or credentials. Added TokenEndpointAuthMethodSelector to ClientOAuthOptions and use it in ClientOAuthProvider when resolving the token endpoint auth method. Preserve the existing behavior by defaulting to the first advertised method when no selector is provided.
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.
Summary
The OAuth client currently selects the first token endpoint authentication method advertised by the authorization server. That can fail when a server exposes multiple supported methods and the client needs to prefer a specific method based on client type or available credentials.
This change adds TokenEndpointAuthMethodSelector to ClientOAuthOptions and uses it in ClientOAuthProvider when resolving the token endpoint authentication method. Existing behavior is preserved by defaulting to the first advertised method when no selector is provided.
Motivation and Context
Some authorization servers advertise multiple token endpoint authentication methods. In those cases, always choosing the first advertised method is not flexible enough for clients that need to prefer a different supported method.
This change allows callers to control that selection without changing the default behavior for existing consumers.
How Has This Been Tested?
Validated in a downstream application that requires selecting a specific token endpoint authentication method.
Breaking Changes
This is a non-breaking change. Existing behavior is preserved when TokenEndpointAuthMethodSelector is not configured.
Types of changes
Checklist
Additional context
N/A