-
Notifications
You must be signed in to change notification settings - Fork 0
[pull] main from modelcontextprotocol:main #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Review these changes at https://app.gitnotebooks.com/Stars1233/python-sdk/pull/85 |
Reviewer's GuideThis PR adds OAuth 2.0 Resource Indicators support (RFC 8707) by introducing resource URL normalization and hierarchical matching utilities, extending token introspection and authorization flows to carry and strictly validate a “resource” parameter, updating server settings and CLI flags for strict validation, and covering the new logic with tests. Sequence diagram for OAuth client authorization flow with resource indicatorsequenceDiagram
participant ClientApp
participant OAuthClientProvider
participant AuthServer
ClientApp->>OAuthClientProvider: Initiate authorization
OAuthClientProvider->>AuthServer: /authorize (includes resource)
AuthServer-->>OAuthClientProvider: Authorization code
OAuthClientProvider->>AuthServer: /token (includes resource)
AuthServer-->>OAuthClientProvider: Access token (resource bound)
OAuthClientProvider-->>ClientApp: Access token
Sequence diagram for resource server token introspection with strict resource validationsequenceDiagram
participant ResourceServer
participant IntrospectionTokenVerifier
participant AuthServer
ResourceServer->>IntrospectionTokenVerifier: verify_token(token)
IntrospectionTokenVerifier->>AuthServer: /introspect
AuthServer-->>IntrospectionTokenVerifier: token data (aud = resource)
IntrospectionTokenVerifier->>IntrospectionTokenVerifier: _validate_resource(token_data)
alt Resource valid
IntrospectionTokenVerifier-->>ResourceServer: AccessToken
else Resource invalid
IntrospectionTokenVerifier-->>ResourceServer: None (reject)
end
Class diagram for updated OAuth token and authorization models (RFC 8707 support)classDiagram
class AuthorizationParams {
+str|None resource
}
class AuthorizationCode {
+str|None resource
}
class AccessToken {
+str|None resource
}
class RefreshToken {
+str|None resource
}
class AuthorizationRequest {
+str|None resource
}
class AuthorizationCodeRequest {
+str|None resource
}
class RefreshTokenRequest {
+str|None resource
}
AuthorizationParams <|-- AuthorizationCode
AuthorizationCode <|-- AccessToken
AuthorizationRequest <|-- AuthorizationCodeRequest
AuthorizationCodeRequest <|-- RefreshTokenRequest
Class diagram for IntrospectionTokenVerifier with RFC 8707 resource validationclassDiagram
class TokenVerifier {
<<abstract>>
}
class IntrospectionTokenVerifier {
-str introspection_endpoint
-str server_url
-bool validate_resource
-str resource_url
+verify_token(token: str) AccessToken|None
+_validate_resource(token_data: dict) bool
+_is_valid_resource(resource: str) bool
}
TokenVerifier <|-- IntrospectionTokenVerifier
Class diagram for new auth_utils resource utilitiesclassDiagram
class auth_utils {
+resource_url_from_server_url(url: str|HttpUrl|AnyUrl) str
+check_resource_allowed(requested_resource: str, configured_resource: str) bool
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.1)
Can you help keep this open source service alive? 💖 Please sponsor : )
Summary by Sourcery
Introduce OAuth 2.0 Resource Indicators support (RFC 8707) by adding shared utilities for resource URL handling, integrating resource parameter propagation in auth flows, and enabling optional strict resource validation in the simple-auth example.
New Features:
Enhancements:
Documentation:
Tests: