Implement RFC 9207 issuer validation in ClientOAuthProvider#1605
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
@tarekgh @PranavSenthilnathan I updated this to make the breaking API change I suggested in my earlier comment. Let me know what you think. |
Resolves the semantic merge conflict: main's step-up scope tests used the removed AuthorizationRedirectDelegate API. Migrated them to the new AuthorizationCallbackHandler / AuthorizationCallbackContext API.
…elegate The AuthorizationRedirectDelegate type and ClientOAuthOptions.AuthorizationRedirectDelegate property were removed in favor of the new AuthorizationCallbackHandler API. Add baseline suppressions (CP0001/CP0002) so the Release pack's package validation against 1.3.0 passes.
@halter73 I have left a few comments, but in general LGTM. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
@halter73 could you please resolve the conflict to the see the CI results? |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
I addressed the PR feedback, but wait a minute before rereviewing. I'm going to add the AuthorizationRedirectDelegate back temporarily as an obsolete API for back-compat purposes. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
This should be ready for final review. I added back the old delegate as an obsolete API for better back compat. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve issuer-aware authorization callbacks across the concurrent token acquisition and DCR application type changes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
PR #1605 obsoleted ClientOAuthOptions.AuthorizationRedirectDelegate in favor of AuthorizationCallbackHandler. Migrate the two cold-start regression tests to the new context-based callback so the build passes with warnings-as-errors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Release audit: labeled |
Summary
Implements SEP-2468 and RFC 9207 issuer (
iss) parameter validation in the OAuth authorization flow.Closes #1571
Changes
AuthorizationCallbackContext: New context containing the authorization and redirect URIs.AuthorizationResult: New result containing the authorization code and optional issuer from the authorization response.ClientOAuthOptions: Adds the issuer-awareAuthorizationCallbackHandler. The existingAuthorizationRedirectDelegateremains available as an obsolete compatibility API under diagnosticMCP9007.ClientOAuthProvider: Validates authorization response issuers per RFC 9207 and authorization server metadata issuers per RFC 8414 Section 3.3.AuthorizationServerMetadata: Adds theIssuerandAuthorizationResponseIssParameterSupportedproperties.codeandiss.Migration
AuthorizationRedirectDelegateimplementations retain their original signature and continue to work, but now produce warningMCP9007. This compatibility path cannot returniss, so RFC 9207 authorization-response issuer validation is skipped when it is used. Migrate toAuthorizationCallbackHandlerfor issuer-aware authorization.AuthorizationCallbackHandlerreceives anAuthorizationCallbackContextand returns anAuthorizationResultcontaining thecodeand, when present,issquery parameters from the redirect.AuthorizationCallbackHandlerandAuthorizationRedirectDelegatecannot both be configured. Doing so throws anArgumentException.iss.RFC 9207 Behavior
issvalue that exactly matches the expected issuer.iss, the client still validates it.issueris validated exactly against the expected URI per RFC 8414 Section 3.3. The 2025-03-26 compatibility path skips this metadata comparison because its discovery URI is derived from the MCP server origin rather than Protected Resource Metadata.iss, RFC 9207 cannot protect the flow and authorization proceeds normally.