feat(auth): DCR hooks, introspection auth, and prehandler fixes#100
Open
getlarge wants to merge 3 commits intoplatformatic:mainfrom
Open
feat(auth): DCR hooks, introspection auth, and prehandler fixes#100getlarge wants to merge 3 commits intoplatformatic:mainfrom
getlarge wants to merge 3 commits intoplatformatic:mainfrom
Conversation
…on tests The MCP SDK types use discriminated unions (e.g., text | image content). TypeScript requires type narrowing before accessing type-specific properties. This fixes typecheck failures introduced by SDK type changes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add OIDC discovery to fetch endpoints from /.well-known/openid-configuration with 5-minute caching and fallback to default /oauth/* paths - Include redirect_uri in authorization request (required for OIDC 1.0) - Pass redirect_uri to token exchange (must match authorization request) - Skip /oauth/callback in auth prehandler - Add excludedPaths option for custom routes to bypass authorization (e.g., health checks) This enables compatibility with OAuth providers like Ory Hydra that use non-standard endpoint paths (e.g., /oauth2/auth instead of /oauth/authorize). Closes platformatic#95 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit adds several OAuth/DCR improvements: Patch 3.1: Skip /oauth/register in auth prehandler - DCR endpoint must be accessible before client has credentials - Fixes chicken-and-egg problem with dynamic registration Patch 3.2: Add introspectionAuth configuration - Supports bearer (API key), basic (client credentials), or none - Required for Ory Hydra admin introspection endpoint - Backwards compatible - defaults to no auth header Patch 3.3: Pass DCR request body through to dynamicClientRegistration - Client metadata is now merged with defaults (client wins) - Allows clients to specify their own redirect_uris, client_name, etc. Patch 4: Add dcrHooks for DCR proxy pattern - upstreamEndpoint: Required, bypasses OIDC discovery to avoid loops - onRequest: Hook to transform/enrich DCR request - onResponse: Hook to clean/transform DCR response (e.g., remove empty fields) - Returns 501 when not configured (prevents infinite loop) Breaking change: /oauth/register now returns 501 unless dcrHooks is configured. This prevents infinite loops when OIDC discovery points back to the MCP server. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
Adds DCR proxy hooks and introspection authentication support for Ory Hydra integration.
Changes
1. Skip
/oauth/registerin auth prehandlerDCR endpoint must be accessible before client has credentials.
2. Add
introspectionAuthconfigurationSupports bearer (API key), basic (client credentials), or none for token introspection authentication.
3. Add
dcrHooksfor DCR proxy patternEnables MCP server to act as a DCR proxy with request/response transformation.
Breaking Change
/oauth/registerreturns 501 unlessdcrHooksis configured. This prevents infinite loops when OIDC discovery points back to the MCP server.Tests
Related
🤖 Generated with Claude Code