Skip to content

Do not end session when switching languages during forced re-authentication OIDC request (LG-10936)#9157

Merged
mitchellhenke merged 2 commits intomainfrom
mitchellhenke/fix-bug-oidc-login-prompt-language-switch
Sep 6, 2023
Merged

Do not end session when switching languages during forced re-authentication OIDC request (LG-10936)#9157
mitchellhenke merged 2 commits intomainfrom
mitchellhenke/fix-bug-oidc-login-prompt-language-switch

Conversation

@mitchellhenke
Copy link
Contributor

@mitchellhenke mitchellhenke commented Sep 6, 2023

🎫 Ticket

LG-10936

🛠 Summary of changes

This was a bug introduced from the changes in #8684. If an OIDC authorization request is received that uses prompt=login, and the user switches languages, they will be logged out and have to authenticate again, which is not intended. The core of the issue is due to the OIDC state session check not being set each time. This was working most of the time because the comparison of the URL here only triggers a log out when the URL has changed from the original request. Because the locale is part of the URL, it falls through that check and logs the user out again.

To address this, this PR ensures the oidc_state_for_login_prompt value is set regardless. The intention behind this is that the state will only be nil once on the initial request. Any OIDC request following that will not log the user out because the state will match.

…cation OIDC request

changelog: Bug Fixes, OpenID Connect, Do not end session when switching languages during forced re-authentication request
@mitchellhenke mitchellhenke changed the title Do not end session when switching languages during forced re-authentication OIDC request Do not end session when switching languages during forced re-authentication OIDC request (LG-10936) Sep 6, 2023
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
@mitchellhenke mitchellhenke merged commit 6b221d2 into main Sep 6, 2023
@mitchellhenke mitchellhenke deleted the mitchellhenke/fix-bug-oidc-login-prompt-language-switch branch September 6, 2023 20:37
zachmargolis added a commit that referenced this pull request Sep 7, 2023
…cation OIDC request (LG-10936) (#9157)

* Do not end session when switching languages during forced re-authentication OIDC request

changelog: Bug Fixes, OpenID Connect, Do not end session when switching languages during forced re-authentication request

* Update spec/controllers/openid_connect/authorization_controller_spec.rb

Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>

---------

Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
(cherry picked from commit 6b221d2)
@aduth aduth mentioned this pull request Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants