summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Huot <jonathan.huot@thomsonreuters.com>2018-12-14 13:25:43 +0100
committerJonathan Huot <jonathan.huot@thomsonreuters.com>2018-12-14 13:25:43 +0100
commitf6b6d1460755c31d522e5e01be28bfd5b1f9da33 (patch)
treeecd00a27c357078f40279afcc133ea122f4d0c24
parent7be2769bcfefc5db9b54603dbbbcd4db0d237216 (diff)
downloadoauthlib-601-pkce-support.tar.gz
Fixed OAuth2 Metadata when using PKCE and OIDC.Server601-pkce-support
-rw-r--r--oauthlib/oauth2/rfc6749/endpoints/metadata.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/oauthlib/oauth2/rfc6749/endpoints/metadata.py b/oauthlib/oauth2/rfc6749/endpoints/metadata.py
index 45cf110..60c846b 100644
--- a/oauthlib/oauth2/rfc6749/endpoints/metadata.py
+++ b/oauthlib/oauth2/rfc6749/endpoints/metadata.py
@@ -19,6 +19,7 @@ from .authorization import AuthorizationEndpoint
from .introspect import IntrospectEndpoint
from .token import TokenEndpoint
from .revocation import RevocationEndpoint
+from .. import grant_types
log = logging.getLogger(__name__)
@@ -116,8 +117,12 @@ class MetadataEndpoint(BaseEndpoint):
self.validate_metadata(claims, "response_types_supported", is_required=True, is_list=True)
self.validate_metadata(claims, "response_modes_supported", is_list=True)
if "code" in claims["response_types_supported"]:
+ code_grant = endpoint._response_types["code"]
+ if not isinstance(code_grant, grant_types.AuthorizationCodeGrant) and hasattr(code_grant, "default_grant"):
+ code_grant = code_grant.default_grant
+
claims.setdefault("code_challenge_methods_supported",
- list(endpoint._response_types["code"]._code_challenge_methods.keys()))
+ list(code_grant._code_challenge_methods.keys()))
self.validate_metadata(claims, "code_challenge_methods_supported", is_list=True)
self.validate_metadata(claims, "authorization_endpoint", is_required=True, is_url=True)