This commit is contained in:
Joren de Graaf
2026-10-09 14:43:46 +02:00
parent c825cd474e
commit 559c51e9bb
20 changed files with 322 additions and 27 deletions
+21
View File
@@ -0,0 +1,21 @@
"""Adapt CIMD method negotiation for DOT's public-client-only implementation."""
from oauth2_provider.cimd import SafeMetadataFetcher
from oauth2_provider.settings import oauth2_settings
class CompatibleCIMDFetcher(SafeMetadataFetcher):
def fetch(self, client_id):
metadata, max_age = super().fetch(client_id)
methods = metadata.get('token_endpoint_auth_methods_supported')
if (
metadata.get('token_endpoint_auth_method') != 'none'
and isinstance(methods, list)
and 'none' in methods
and 'none' in oauth2_settings.OAUTH2_TOKEN_ENDPOINT_AUTH_METHODS_SUPPORTED
):
# DOT 3.4 accepts only public CIMD clients. The plural metadata
# field explicitly allows this method even when the legacy singular
# field prefers private_key_jwt, which this server does not offer.
metadata = {**metadata, 'token_endpoint_auth_method': 'none'}
return metadata, max_age