Reputation: 377
I am using SimpleSAMLphp (SSP) to handle authentication for my Yii website (via a remote IdP), and version 1.16.3 has been working fine. However, when I update my composer.json file and pull in version 1.17.2, the local PHP session on my website is no longer destroyed, leaving the user logged in. (The user is successfully logged out of the IdP, however.)
I did some Googling, and reviewed discussions that looked relevant:
I also reviewed some discussions in the SimplSAMLphp mailing list:
In addition, I tracked the logout process using SSP 1.16.3 and 1.17.2 recording each Cookie header in requests, Set-Cookie header in responses, and session files in existence at multiple steps along the way, which showed some distinct differences... but I don't know what to conclude from this information.
When I begin the logout process on my website (which is built using Yii 1.x)...
/auth/logout/
on my site, and the browser dutifully sends along my current PHP (PHPSESSID
) and SSP (SimpleSAML
) session cookies.
/simplesaml/module.php/saml/sp/saml2-logout.php/default-sp?SAMLRequest=…
(and along go current PHP and SSP session cookies).
/
(the root of my site), with my (unchanged) PHP session cookie and (most recent) SSP session cookie.
I can (sort of) alleviate the problem by telling Yii during the logout process to return an empty value for the PHP session cookie (PHPSESSID
) and set it to expire an hour ago, but since that leaves the session file itself still in place, that approach seems unsatisfactory.
Given that information, does anyone have any ideas or pointers on where I could look next to try to determine what might be causing this?
As things stand, I don't know if this is a result of me using Yii incorrectly, me using SSP incorrectly, or a bug in SSP 1.17.2.
I have not yet managed to distill this down to a minimal, reproducible example, and I apologize for that. The code is open source, though I doubt anyone wants to go digging through it:
Upvotes: 1
Views: 2233
Reputation: 377
It turns out that I simply needed to tell SimpleSAML's Session class to do some cleanup, after which the PHP function session_name()
resumed returning my application's session name ('PHPSESSID'
) rather than SimpleSAMLphp's session name ('SimpleSAML'
). That allowed my application's logout code to kill the correct session, fixing my ability to log the user out of my application.
Here was the code change that fixed it for me:
$sspSession = \SimpleSAML\Session::getSessionFromRequest();
$sspSession->cleanup();
Upvotes: 1