Closed (fixed)
Project:
SAML Authentication
Version:
8.x-3.0-alpha2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 May 2020 at 20:50 UTC
Updated:
19 May 2020 at 23:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
adamfranco commentedHere is a patch that logs out the Drupal session when
/saml/logoutis accessed.Comment #3
adamfranco commentedRe-roll with trailing white-space eliminated.
I also noticed that the routing.yml changes from samlauth-logout-3043704-3.patch actually aren't included in the 8.x-3.x -- that was an artifact of my partially-applied patching. ;-) That said, the logging out of the drupal session is a slightly different issue from expired sessions hitting
saml/logoutso I'll leave those changes to a separate issue.Comment #4
roderikOops. Thanks for the notification. I didn't spot/remember that #3043704: Make user logout more robust is now actually an issue for the D8 version of the module.
I'll roll the two slightly different / related issues back into one extended patch, because the current patches have unintended consequences for the $this->tempStoreFactory->get() calls that come right after.
(Which are not 'get' calls to a temp store factory - but to a temp store - as per #3112135: Drupal 9 Deprecated Code Report)
(I'm in the process of writing up all details in case I need to look them over later... because I clearly didn't 'get' Single Logout last time I changed it.)
Comment #5
roderikI changed my mind, and am going to do things in two steps as you hinted at, because there are indeed different things going on. Also, people have different reasons for 'fixing logout':
Upon re-reading your issue report, I'm confused:
I'm clearly not getting something - but I'd like to get it, because it can influence other (session related) work that needs to be done.
On top of that, there are issues with the patch:
I've already made a new patch that fixes these issues, and made the code more generic, so I can concentrate on the part that is not included here, separately. (Which is opening up /saml/logout to not-logged-in users, as originally requested for D7, and which I'll do in #3043704: Make user logout more robust.) The 'actual' code change, besides the access for /saml/sls, is the addition of the $this->drupalLogoutHelper() call in logout().
I've included code comments that justify this 'actual code change' to the point that I currently understand it. But I'm not totally sure I'll commit this yet. *This undoes the changes made in #2863975: Fix SLS, which... I don't have a definite opinion about, but the user_logout() call was deliberately moved to the end of the Single Logout process, which AFAICT does better adhere to the officially documented SAML logout procedure, and (for now) has a better guarantee that the NameID/session index are included in the logout request.
Comment #6
azinck commentedIt's been a year since I've looked at this, so I can't recall all the factors at play here, to be honest. One thing does jump out at me, though:
We've got a situation where we have some users log into a site directly (no SAML involved) and some users log in via SAML. And we want them to be able to share the same logout link (/saml/logout) so we need to be sure that /saml/logout does actually log people out, even if they're not SAML-based users.
I hope I'm not spreading confusion here. As I said, I'm pretty foggy about this now looking back on it, so if anything I'm saying doesn't make sense please just chalk it up to that :).
Comment #7
roderik@azinck thanks for responding and wading through my wordiness :) I plan to transfer my confusion into code comments so that I don't undo things later.
I interpreted "Single-Log-Out isn't configured" as: the SLO URL is not configured, so people cannot be redirected to the IdP. In which case an exception is thrown. (So I... have questions about that.)
I'll assume for now that you do have the SLO URL configured. But here's what I'm unsure about: In your case, if users who have logged in locally, use /saml/logout to log out, then... they are redirected to the IdP, right? Is that fine with you? (It may be that it's just an unnecessary but short roundtrip, before they are redirected back to the site they've logged out from.)
Comment #8
azinck commentedI can confirm that I do have the SLO URL configured. I do not recall what was happening in terms of redirection for my non-SAML users prior to my creating the patch in #3043704: Make user logout more robust but I have to assume it wasn't working well or else I wouldn't have done it. I don't have an easy test-bed for this right this second or else I'd give it a go. Will try to get info for you before long.
Comment #9
adamfranco commented@roderik, thanks for the detailed follow-up. I have a combination of issues around SLO that are prompting this:
/saml/logoutand it would be nice if that worked for directly-authenticated users too, even if they get unnecessarily redirected to the IdP's logout URL./saml/logoutDrupal redirects the user to the IdP's logout URL and the login session at the IdP is terminated, but Drupal never gets a message back from the IdP to finalize the logout. If they navigate back to Drupal, they are still logged in their even though they are logged out of the IdP. I'm sure this is due to my inability to correctly configure AzureAD or possibly an artifact of some Drupal sites being only accessible from behind a VPN, but logging out the Drupal session before redirecting to the IdP is a helpful work-around to ensure that clicking "logout" in Drupal actually logs the user out of Drupal in all cases.[edited to fix grammatical typos]
Comment #10
roderik@adamfranco thanks.
Even if it would be "due to inability to correctly configure AzureAD", it's still a valid use case. But I'm hesitant to force this use case on everyone: I expect some people (who want the logout process to behave 'technically correcctly') to protest.
That would mean this needs to be Yet One More Configuration Option. Now that I've closed off #3043704: Make user logout more robust / thinking about 'the session stuff', and the /saml/logout route is already meant to (also) redirect logged-out Drupal users to the IdP... I'll think about what I think this option / these options should say.
Comment #11
roderikOh how I love going around in circles in my own head.
There's not going to be a configuration option because
So the attached patch is what I'll commit. Featuring
Comment #13
adamfranco commentedThanks @roderik!