Skip to content

Commit 3ac4115

Browse files
committed
Add code_challenge_methods_supported property to OIDC auto discovery
Fix #1249
1 parent 2d641f2 commit 3ac4115

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Egor Poderiagin
5252
Emanuele Palazzetti
5353
Federico Dolce
5454
Frederico Vieira
55+
Gaël Utard
5556
Hasan Ramezani
5657
Hiroki Kiyohara
5758
Hossein Shakiba

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2626
* #1311 Add option to disable client_secret hashing to allow verifying JWTs' signatures.
2727
* #1337 Gracefully handle expired or deleted refresh tokens, in `validate_user`.
2828
* #1350 Support Python 3.12 and Django 5.0
29+
* #1249 Add code_challenge_methods_supported property to auto discovery informations
30+
per [RFC 8414 section 2](https://www.rfc-editor.org/rfc/rfc8414.html#page-7)
2931

3032
### Fixed
3133
* #1322 Instructions in documentation on how to create a code challenge and code verifier

oauth2_provider/views/oidc.py

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from ..forms import ConfirmLogoutForm
2727
from ..http import OAuth2ResponseRedirect
2828
from ..models import (
29+
AbstractGrant,
2930
get_access_token_model,
3031
get_application_model,
3132
get_id_token_model,
@@ -96,6 +97,7 @@ def get(self, request, *args, **kwargs):
9697
"token_endpoint_auth_methods_supported": (
9798
oauth2_settings.OIDC_TOKEN_ENDPOINT_AUTH_METHODS_SUPPORTED
9899
),
100+
"code_challenge_methods_supported": [key for key, _ in AbstractGrant.CODE_CHALLENGE_METHODS],
99101
"claims_supported": oidc_claims,
100102
}
101103
if oauth2_settings.OIDC_RP_INITIATED_LOGOUT_ENABLED:

tests/test_oidc_views.py

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def test_get_connect_discovery_info(self):
4848
"subject_types_supported": ["public"],
4949
"id_token_signing_alg_values_supported": ["RS256", "HS256"],
5050
"token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"],
51+
"code_challenge_methods_supported": ["plain", "S256"],
5152
"claims_supported": ["sub"],
5253
}
5354
response = self.client.get("/o/.well-known/openid-configuration")
@@ -74,6 +75,7 @@ def test_get_connect_discovery_info_deprecated(self):
7475
"subject_types_supported": ["public"],
7576
"id_token_signing_alg_values_supported": ["RS256", "HS256"],
7677
"token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"],
78+
"code_challenge_methods_supported": ["plain", "S256"],
7779
"claims_supported": ["sub"],
7880
}
7981
response = self.client.get("/o/.well-known/openid-configuration/")
@@ -100,6 +102,7 @@ def expect_json_response_with_rp_logout(self, base):
100102
"subject_types_supported": ["public"],
101103
"id_token_signing_alg_values_supported": ["RS256", "HS256"],
102104
"token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"],
105+
"code_challenge_methods_supported": ["plain", "S256"],
103106
"claims_supported": ["sub"],
104107
"end_session_endpoint": f"{base}/logout/",
105108
}
@@ -133,6 +136,7 @@ def test_get_connect_discovery_info_without_issuer_url(self):
133136
"subject_types_supported": ["public"],
134137
"id_token_signing_alg_values_supported": ["RS256", "HS256"],
135138
"token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"],
139+
"code_challenge_methods_supported": ["plain", "S256"],
136140
"claims_supported": ["sub"],
137141
}
138142
response = self.client.get(reverse("oauth2_provider:oidc-connect-discovery-info"))

0 commit comments

Comments
 (0)