Skip to content

Commit 30cd41d

Browse files
committed
Allow http scheme in post logout redirect URIs
1 parent 6865301 commit 30cd41d

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

docs/settings.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,12 @@ Default: ``True``
328328
Whether to always prompt the :term:`Resource Owner` (End User) to confirm a logout requested by a
329329
:term:`Client` (Relying Party). If it is disabled the :term:`Resource Owner` (End User) will only be prompted if required by the standard.
330330

331+
OIDC_RP_INITIATED_LOGOUT_STRICT_REDIRECT_URIS
332+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333+
Default: ``False``
334+
335+
Enable to only allow the `http` scheme in post logout redirect URIs when a :term:`Client` is `confidential`.
336+
331337
OIDC_RP_INITIATED_LOGOUT_ACCEPT_EXPIRED_TOKENS
332338
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333339
Default: ``True``

oauth2_provider/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
],
9191
"OIDC_RP_INITIATED_LOGOUT_ENABLED": False,
9292
"OIDC_RP_INITIATED_LOGOUT_ALWAYS_PROMPT": True,
93+
"OIDC_RP_INITIATED_LOGOUT_STRICT_REDIRECT_URIS": False,
9394
"OIDC_RP_INITIATED_LOGOUT_ACCEPT_EXPIRED_TOKENS": True,
9495
"OIDC_RP_INITIATED_LOGOUT_DELETE_TOKENS": True,
9596
# Special settings that will be evaluated at runtime

oauth2_provider/views/oidc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,9 @@ def validate_logout_request(request, id_token_hint, client_id, post_logout_redir
259259
scheme = urlparse(post_logout_redirect_uri)[0]
260260
if not scheme:
261261
raise InvalidOIDCRedirectURIError("A Scheme is required for the redirect URI.")
262-
if scheme == "http" and application.client_type != "confidential":
262+
if oauth2_settings.OIDC_RP_INITIATED_LOGOUT_STRICT_REDIRECT_URIS and (
263+
scheme == "http" and application.client_type != "confidential"
264+
):
263265
raise InvalidOIDCRedirectURIError("http is only allowed with confidential clients.")
264266
if scheme not in application.get_allowed_schemes():
265267
raise InvalidOIDCRedirectURIError(f'Redirect to scheme "{scheme}" is not permitted.')

0 commit comments

Comments
 (0)