Skip to content

Commit

Permalink
Add code_challenge_methods_supported property to OIDC auto discovery (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gutard authored Nov 16, 2023
1 parent 2d641f2 commit a4b26b1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Egor Poderiagin
Emanuele Palazzetti
Federico Dolce
Frederico Vieira
Gaël Utard
Hasan Ramezani
Hiroki Kiyohara
Hossein Shakiba
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* #1311 Add option to disable client_secret hashing to allow verifying JWTs' signatures.
* #1337 Gracefully handle expired or deleted refresh tokens, in `validate_user`.
* #1350 Support Python 3.12 and Django 5.0
* #1249 Add code_challenge_methods_supported property to auto discovery informations
per [RFC 8414 section 2](https://www.rfc-editor.org/rfc/rfc8414.html#page-7)

### Fixed
* #1322 Instructions in documentation on how to create a code challenge and code verifier
Expand Down
2 changes: 2 additions & 0 deletions oauth2_provider/views/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from ..forms import ConfirmLogoutForm
from ..http import OAuth2ResponseRedirect
from ..models import (
AbstractGrant,
get_access_token_model,
get_application_model,
get_id_token_model,
Expand Down Expand Up @@ -96,6 +97,7 @@ def get(self, request, *args, **kwargs):
"token_endpoint_auth_methods_supported": (
oauth2_settings.OIDC_TOKEN_ENDPOINT_AUTH_METHODS_SUPPORTED
),
"code_challenge_methods_supported": [key for key, _ in AbstractGrant.CODE_CHALLENGE_METHODS],
"claims_supported": oidc_claims,
}
if oauth2_settings.OIDC_RP_INITIATED_LOGOUT_ENABLED:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_oidc_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def test_get_connect_discovery_info(self):
"subject_types_supported": ["public"],
"id_token_signing_alg_values_supported": ["RS256", "HS256"],
"token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"],
"code_challenge_methods_supported": ["plain", "S256"],
"claims_supported": ["sub"],
}
response = self.client.get("/o/.well-known/openid-configuration")
Expand All @@ -74,6 +75,7 @@ def test_get_connect_discovery_info_deprecated(self):
"subject_types_supported": ["public"],
"id_token_signing_alg_values_supported": ["RS256", "HS256"],
"token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"],
"code_challenge_methods_supported": ["plain", "S256"],
"claims_supported": ["sub"],
}
response = self.client.get("/o/.well-known/openid-configuration/")
Expand All @@ -100,6 +102,7 @@ def expect_json_response_with_rp_logout(self, base):
"subject_types_supported": ["public"],
"id_token_signing_alg_values_supported": ["RS256", "HS256"],
"token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"],
"code_challenge_methods_supported": ["plain", "S256"],
"claims_supported": ["sub"],
"end_session_endpoint": f"{base}/logout/",
}
Expand Down Expand Up @@ -133,6 +136,7 @@ def test_get_connect_discovery_info_without_issuer_url(self):
"subject_types_supported": ["public"],
"id_token_signing_alg_values_supported": ["RS256", "HS256"],
"token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"],
"code_challenge_methods_supported": ["plain", "S256"],
"claims_supported": ["sub"],
}
response = self.client.get(reverse("oauth2_provider:oidc-connect-discovery-info"))
Expand Down

0 comments on commit a4b26b1

Please sign in to comment.