Problem/Motivation
In environments where multiple OpenID Connect clients (each with end session endpoints defined) are enabled with the "Logout from identity provider" setting, users may be redirected to the incorrect identity provider after logging out. This occurs because:
- Users can have multiple connected accounts in a multiclient setup.
- The system queries all connected accounts based on the username, which doesn't specify the active account used for login.
- The redirectLogout() function lacks information about which account was used for the login session.
If the last returned client name does not correspond to the account used for login, the user is redirected to the wrong identity provider, and the session is not properly terminated at the identity provider's end.
This issue is acknowledged in the redirectLogout() function with the following @todo note:
// @todo The fact that the user has a connected account doesn't necessarily
// mean that it was used for the login. This info should probably be kept
// in the session.
Steps to reproduce
- Configure more than one OpenID Connect client.
- Enable "Logout from identity provider" and "Automatically connect existing users" settings.
- Define an end session endpoint for each enabled client.
- Log in using the first client and then log out.
- Log in using the second client and then log out.
- Log in using the first client and then log out.
Users may be redirected to the incorrect identity provider, and the session may not be terminated at the identity provider's end.
Proposed resolution
- Store the client name in the session to track which client was used for login.
- Ensure logout operations are performed only for the connected account used for login.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3518675-10.patch | 31.25 KB | mitrpaka |
| #6 | 3518675-6.patch | 5.59 KB | mitrpaka |
| #5 | 3518675-5.patch | 5.38 KB | mitrpaka |
| #2 | 3518675-1.patch | 4.84 KB | mitrpaka |
Issue fork openid_connect-3518675
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mitrpaka commentedPatch attached that tries to implement the proposed solution by adding the client name to the session and ensuring logout operations are performed only for the connected account used for login.
Comment #3
mitrpaka commentedComment #5
mitrpaka commentedUpdated patch available - please test and share your feedback.
Comment #6
mitrpaka commentedUpdated patch against latest 3.x branch (and 3.0.0-alpha7 version)
Comment #8
pfrillingThanks for the patch @mitrpaka.
I thought it made the most sense to stop assuming an endpoint now that the client name is being stored. I think this should be a safe change for existing sites. Please test and confirm everything is working.
Comment #9
mitrpaka commented@pfrilling Thank you for the updated patch!
Tested this and I can confirm that everything is working.
Sorry for the delay in testing / confirmation.
Comment #10
mitrpaka commentedUpdated patch against 3.0.0-alpha8 version