Conversation
…raction - Replace customize_routes([]) with clean get_routes() method - Remove confusing setup_auth_middleware_and_routes() helper function - Inline auth setup logic directly in create_sse_app and create_streamable_http_app - Simplify AuthProvider base class with optional required_scopes - Add RemoteAuthProvider for TokenVerifier + OAuth metadata composition - Update all auth providers to use new get_routes() interface - Remove unused resource_server_url parameters from app creators - Delete obsolete test_auth_setup.py since helper function removed Benefits: - Cleaner API: get_routes() tells exactly what it does - Less abstraction: Eliminated confusing 4-tuple return - Better separation of concerns: Each provider owns its routes - More readable: Inline logic is clearer than mystery functions - Composable design: TokenVerifier + metadata = RemoteAuthProvider
- AuthKitProvider is now a clean RemoteAuthProvider subclass - Override get_oauth_authorization_server_routes() for AuthKit metadata forwarding - Add get_oauth_authorization_server_routes() and get_protected_resource_routes() to RemoteAuthProvider - get_routes() now combines both OAuth authorization server and protected resource routes - Eliminate code duplication: AuthKitProvider no longer needs to implement get_routes() - Clean composition pattern: TokenVerifier + metadata + OAuth endpoints = RemoteAuthProvider Benefits: - AuthKitProvider is now just RemoteAuthProvider + OAuth metadata forwarding - Reusable pattern for other providers that need both protected resource and OAuth metadata - Standardized route creation using MCP SDK's create_protected_resource_routes() - Clean inheritance hierarchy with clear separation of concerns
Contributor
|
Any plans to tie this in more directly with the session context? |
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.
This enhancement introduces
RemoteAuthProvider, a new base class that simplifies integration with external identity providers by composing token verification with OAuth discovery metadata. This creates standardized OAuth 2.0 Protected Resource endpoints while maintaining clean separation of concerns.The new architecture makes it easier to build authentication providers that work with external identity services.
RemoteAuthProviderhandles OAuth metadata generation and MCP protocol integration, while delegating token validation to configurable underlying verifiers.New
RemoteAuthProviderpattern:Key enhancements:
The changes maintain full backward compatibility while providing a cleaner foundation for building custom external identity provider integrations.