RFC 8414 OAuth 2.0 Authorization Server Metadata.
(request: HttpRequest)
| 24 | @csrf_exempt |
| 25 | @require_GET |
| 26 | def authorization_server_metadata(request: HttpRequest) -> JsonResponse: |
| 27 | """RFC 8414 OAuth 2.0 Authorization Server Metadata.""" |
| 28 | oauth = OAuthConfig.from_settings() |
| 29 | |
| 30 | metadata = { |
| 31 | "issuer": oauth.api_url, |
| 32 | "authorization_endpoint": f"{oauth.frontend_url}/oauth/authorize/", |
| 33 | "token_endpoint": f"{oauth.api_url}/o/token/", |
| 34 | "registration_endpoint": f"{oauth.api_url}/o/register/", |
| 35 | "revocation_endpoint": f"{oauth.api_url}/o/revoke_token/", |
| 36 | "introspection_endpoint": f"{oauth.api_url}/o/introspect/", |
| 37 | "scopes_supported": list(oauth.scopes.keys()), |
| 38 | "response_types_supported": ["code"], |
| 39 | "grant_types_supported": ["authorization_code", "refresh_token"], |
| 40 | "code_challenge_methods_supported": ["S256"], |
| 41 | "token_endpoint_auth_methods_supported": [ |
| 42 | "client_secret_basic", |
| 43 | "client_secret_post", |
| 44 | "none", |
| 45 | ], |
| 46 | "introspection_endpoint_auth_methods_supported": ["none"], |
| 47 | } |
| 48 | |
| 49 | return JsonResponse(metadata) |
| 50 | |
| 51 | |
| 52 | class OAuthAuthorizeView(OAuthLibMixin, APIView): # type: ignore[misc] |
nothing calls this directly
no test coverage detected
searching dependent graphs…