Skip to content

Conversation

@rutu1717
Copy link
Contributor

Change OAuthHandler signature from func(context.Context, OAuthHandlerArgs) to func(req *http.Request, res *http.Response).

  • Remove OAuthHandlerArgs struct
  • Update HTTPTransport to pass req and resp to handler
  • Update tests to use new signature
  • Handler can now call oauthex.GetProtectedResourceMetadataFromHeader with proper validation against request URL

This change fixes an impedance mismatch between OAuthHandler and the protected resource metadata functions of the oauthex package. The new signature allows handlers to properly validate resource metadata against the request URL, as required by RFC 9728.

Fixes #600

Change OAuthHandler signature from func(context.Context, OAuthHandlerArgs)
to func(req *http.Request, res *http.Response).

- Remove OAuthHandlerArgs struct
- Update HTTPTransport to pass req and resp to handler
- Update tests to use new signature
- Handler can now call oauthex.GetProtectedResourceMetadataFromHeader
  with proper validation against request URL

This change fixes an impedance mismatch between OAuthHandler and the
protected resource metadata functions of the oauthex package. The new
signature allows handlers to properly validate resource metadata against
the request URL, as required by RFC 9728.

Fixes modelcontextprotocol#600
@findleyr findleyr requested review from findleyr and jba October 28, 2025 21:03
@findleyr
Copy link
Contributor

@jba this LGTM, but I'm new to this code. Unless you have comments, I'll merge this tomorrow morning to include in the v1.1.0 release.

@findleyr findleyr merged commit 72afbc9 into modelcontextprotocol:main Oct 29, 2025
5 checks passed
@jba
Copy link
Contributor

jba commented Oct 29, 2025

(better late than never) yes, I'm pretty convinced this is the right choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auth.OAuthHandler should take http Request and Response

3 participants