feat: Add RFC 8414 OAuth 2.0 Authorization Server Metadata endpoint#1665
Open
zacharypodbela wants to merge 2 commits intodjango-oauth:masterfrom
Open
feat: Add RFC 8414 OAuth 2.0 Authorization Server Metadata endpoint#1665zacharypodbela wants to merge 2 commits intodjango-oauth:masterfrom
zacharypodbela wants to merge 2 commits intodjango-oauth:masterfrom
Conversation
Implements the /.well-known/oauth-authorization-server discovery endpoint per RFC 8414. Unlike the existing OIDC discovery endpoint, this is available regardless of whether OIDC is enabled. - Add OAuthServerMetadataView and ServerMetadataViewMixin in new metadata.py - Refactor ConnectDiscoveryInfoView to use ServerMetadataViewMixin, removing duplicated URL-building logic - Add OAUTH2_RESPONSE_TYPES_SUPPORTED, OAUTH2_GRANT_TYPES_SUPPORTED, and OAUTH2_TOKEN_ENDPOINT_AUTH_METHODS_SUPPORTED settings with defaults - Add oauth2_metadata_issuer() helper to OAuth2ProviderSettings - Register endpoint in base_urlpatterns as oauth-server-metadata Closes django-oauth#1099 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Add oauth2_server_metadata.rst with endpoint description and example response - Link from index.rst toctree after oidc - Document OAUTH2_RESPONSE_TYPES_SUPPORTED, OAUTH2_GRANT_TYPES_SUPPORTED, and OAUTH2_TOKEN_ENDPOINT_AUTH_METHODS_SUPPORTED in settings.rst Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Author
|
@dopry could I get a review on this? |
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
Implements the
/.well-known/oauth-authorization-serverdiscovery endpoint per RFC 8414 — OAuth 2.0 Authorization Server Metadata.Closes #1099
Changes
oauth2_provider/views/metadata.py— containsServerMetadataViewMixin(shared URL-building logic for discovery views) andOAuthServerMetadataView(the RFC 8414 endpoint). The view is available regardless of whether OIDC is enabled and has noOIDCOnlyMixindependency.ConnectDiscoveryInfoView— now inheritsServerMetadataViewMixin, eliminating the duplicated if/else URL-building logic that previously existed for the request-relative vsOIDC_ISS_ENDPOINT-anchored cases.OAUTH2_RESPONSE_TYPES_SUPPORTEDOAUTH2_GRANT_TYPES_SUPPORTEDOAUTH2_TOKEN_ENDPOINT_AUTH_METHODS_SUPPORTEDoauth2_metadata_issuer()helper onOAuth2ProviderSettings, mirroring the existingoidc_issuer().oauth-server-metadataregistered inbase_urlpatterns.OIDC_ISS_ENDPOINT),jwks_uriconditional on RSA key presence, CORS header, and availability when OIDC is disabled.Relationship to OIDC discovery
RFC 8414 is the OAuth 2.0 equivalent of OpenID Connect discovery. The key differences from
ConnectDiscoveryInfoView:/.well-known/openid-configuration/.well-known/oauth-authorization-serveruserinfo_endpointjwks_urigrant_types_supportedrevocation_endpointintrospection_endpoint