Closed (fixed)
Project:
SAML Authentication
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Mar 2019 at 09:35 UTC
Updated:
29 Aug 2022 at 21:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
klausiPatch.
Comment #3
azinck commentedTaking a stab at doing something similar for the 8.x-2.x branch.
Comment #4
smfsh commentedThis looks good to me and the use case makes sense. Let's ship it.
Azinck, I'll leave this up for Roderik to take a peek on the D8 version. I know he's got a ton of stuff going in there with the 3.0 release. I can't readily speak for whether this might be redundant or not.
Comment #6
roderikSorry, I hadn't spotted / dit not remember that this issue is now actually for D8.
Because I overlooked this, a partial copy of azinck's patch has now appeared in #3132942: Log out Drupal session directly, don't wait for SLO. But I see we're trying to do two different but related things. Quoting myself from the other issue:
This last point of calling user_logout() at the beginning of the process is now moved off to #3132942-5: Log out Drupal session directly, don't wait for SLO. I'm not sure yet if I'll commit that, because 1) I'm confused about the reasons given, and 2) it undoes changes specifically made in #2863975: Fix SLS to move user_logout() to the end of the process. See my comment there.
That means I can use this issue to concentrate on the original issue: making /saml/logout available to users who are already logged out of Drupal, so they can log out of whatever session exists on the IdP side. I see the point, but there's an issue in the D8 version: the SAML session data is not available to logged-out users because we store it in a 'D8 tempStore' rather than in $_SESSION.
I'll do some tests around that.
Comment #8
roderikCouple of things:
1) I said something wrong, yesterday: the user_logout() call immediately at the start of the SAML logout process, was also added by klausi in the D7 patch.
Still, I've separated that out to #3132942: Log out Drupal session directly, don't wait for SLO so I can wrap my head around things better.
2) I believe the $_SESSION stuff that klausi added to the D7 patch (which the D8 version effectively already has), has one drawback: remembering the SAML session data only works if you're still logged into Drupal before visiting /saml/logout. That makes the other change that was enabled (namely: for anonymous visitors to log out of their IdP session by visiting /saml/logout) potentially less effective.
However
Sooo... I'm committing this.
The code added is almost useless in practice (except maybe an argument change to the processSLO() call), but maybe I'll be able to use it later. The actual change is just the lifted access restrictions in the routing.yml.
(The uploaded patch file contains the two commits in one, for overview.)
Comment #9
roderikJust because I already largely typed up the following before sending the patch... I'll still dump it here in case I ever want a quick overview again of how SAML logout works.
We have handling of
Worth noting: the SAML Toolkit itself is session-less. It does not do anything re. storing session data and leaves that to the app/Drupal; the session_destroy() and unset($_SESSION) calls at the end just seem to be there "just in case the app forgot" / as a form of convenience.
Comment #11
roderik@klausi - FWIW and in case you read this through a latest-updated-issues list:
I'm just reviewing some more details of the D7 version now.
This (from the patch in #2) was committed to the D7 version in 2019 but its equivalent is not present in any D8+ version. So if you expect issues with that, we should discuss.
I won't touch it because it was committed and I don't see an actual problem with ignoring a
$_POST['SAMLResponse'](which really doesn't contain much useful) but I'm hesitant about just lifting it into the D8 version:A.
This smells like the IdP has been wrongly configured to have the single-logout URL be /saml/logout insted of /saml/sls.
I am not against making /saml/logout redirect to /saml/sls (and /saml/login to /saml/acs?) per se, if $_GET / $_POST are populated... but 1) this hasn't come up before; 2) I'm wondering if we should log a warning in that case. (The reason that the 'process-start endpoints' are different from the 'server-reply endpoints', I believe, is that the latter will not get into an eternal redirect if $_POST is somehow filtered out or the IdP gets wonky for some reason.)
B.
If we wanted this in the general D8+ version, I'd rather try to do this instead (after testing if there are issues - apparently the values are not fully equal):
Two small differences in practice: if the SAMLResponse is invalid / does not indicate success,