fix(core): drop trailing slashes when deriving the PRM well-known path - #16
Closed
RobertoIskandarani wants to merge 1 commit into
Closed
fix(core): drop trailing slashes when deriving the PRM well-known path#16RobertoIskandarani wants to merge 1 commit into
RobertoIskandarani wants to merge 1 commit into
Conversation
RFC 9728 section 3 inserts the well-known segment between the authority and the resource path. Resource identifiers that differ only by a trailing slash must resolve to the same metadata document, so ProtectedResourceMetadata.wellKnownPath now drops trailing slashes from the resource path before appending it: https://api.example.com/mcp/ -> /.well-known/oauth-protected-resource/mcp https://api.example.com/ -> /.well-known/oauth-protected-resource This matches the derivation already shipped by the TypeScript, Python, and Rust SDKs. Only the well-known path derivation normalizes; the resource field in the PRM document and issuer/resource identity comparisons remain exact-string. wellKnownUrl now delegates the normalization to wellKnownPath instead of pre-stripping a single trailing slash itself.
Collaborator
Author
|
Moving to the internal review flow. |
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.
What
ProtectedResourceMetadata.wellKnownPathnow drops trailing slashes from the resource path when deriving the RFC 9728 well-known PRM path:https://api.example.com/mcp/→/.well-known/oauth-protected-resource/mcp(previously/mcp/)https://api.example.com/→/.well-known/oauth-protected-resource(unchanged)wellKnownUrlpreviously carried its own partial normalization (a single-slash strip); it now delegates entirely towellKnownPath. All PRM path consumers (AuthplaneResource.prmPath()/prmUrl(), the MCP setup, both Spring configs) route through this single method.Why
This aligns java-sdk with the family convention already shipped in ts-sdk, python-sdk, and rust-sdk: identifiers differing only by a trailing slash resolve to the same metadata document. Without this, a resource configured as
.../mcp/serves its PRM at a route a client deriving from.../mcpnever probes, and discovery 404s.The conformance catalog pins this in
rfc9728-well-known-path-must-derive-from-resource-uri(AuthPlane/conformance#3).Scope boundary: only the well-known path derivation normalizes. The
resourcefield inside the PRM document and issuer/resource identity comparisons (RFC 8414/9728 §3.3, RFC 9068iss) remain exact-string.MetadataUrlBuilder.buildMetadataUrl(RFC 8414) already stripped the issuer's trailing slash — no change there.Validation
mvn test -B: BUILD SUCCESS — core 730, mcp 62, spring 115 (907 tests, 0 failures; 1 pre-existing unrelated skip).Rfc9728ConformanceTest(pinned to catalog caserfc9728-well-known-path-must-derive-from-resource-uri) extended with both trailing-slash assertions.