I’m encountering an issue with SimpleSAMLphp you may be able to help me resolve.
Previously, I had simply let `session.cookie.domain’ be the default value of null. Now that we’re hoping to expand the scope of the SSO service, I was
expecting that it would be necessary to set this value to a level higher, e.g. instead of it defaulting to
www.example.com, I would set it to .
example.com, and so the same auth token would be valid for
foo.example.com as well.
On both the SP and IdP (both using SimpleSAMLphp), the following values are consistent in their respective config.php files:
'session.cookie.secure' => true,
'session.phpsession.cookiename' => null,
'session.authtoken.cookiename' => 'FooAuthToken',
From a state where there are no cookies, I can login well enough. I have a button that performs the SLO as well, and I can see that that the logout response is successful:
<samlp:LogoutResponse
Feb 22 17:42:39 simplesamlphp DEBUG [1cd636f74a] <samlp:Status>
Feb 22 17:42:39 simplesamlphp DEBUG [1cd636f74a] <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
Feb 22 17:42:39 simplesamlphp DEBUG [1cd636f74a] </samlp:Status>
Feb 22 17:42:39 simplesamlphp DEBUG [1cd636f74a] </samlp:LogoutResponse>
If I click the Login button again, I get back to
auth.example.com with a login form. Successfully fill out the form, and I get the dreaded NoState error. If I click "Back" on the browser button, I'm back on the page that I was trying to login to, but now _I'm actually logged in_.
I can see in the DEBUG logs of the SP that 1) it's a NoState error, and then 2) that it still has a valid saml response! I can keep refreshing the page with the NoState error over and over, and it will claim there's no state. Click back; voila. Logged in. If I just type the root URL, I won't be logged in, but I'll get the login button. If I click the login button again, it will login me in "automatically" and drop me back at the same page as if I was logged in the whole time.
Feb 22 17:42:47 simplesamlphp DEBUG [c01f1c196e] Loading state: '_3698154e4a67ac7b7b4337e14b9ef9b0674294a7e6'
Feb 22 17:42:47 simplesamlphp ERROR [c01f1c196e] SimpleSAML_Error_NoState: NOSTATE
Feb 22 17:42:47 simplesamlphp ERROR [c01f1c196e] Backtrace:
Feb 22 17:42:47 simplesamlphp ERROR [c01f1c196e] 2 /var/www/html/sso-sp/lib/SimpleSAML/Auth/State.php:263 (SimpleSAML_Auth_State::loadState)
Feb 22 17:42:47 simplesamlphp ERROR [c01f1c196e] 1 /var/www/html/sso-sp/modules/saml/www/sp/saml2-acs.php:78 (require)
Feb 22 17:42:47 simplesamlphp ERROR [c01f1c196e] 0 /var/www/html/sso-sp/www/module.php:137 (N/A)
Feb 22 17:42:47 simplesamlphp ERROR [c01f1c196e] Error report with id fb421943 generated.
Feb 22 17:42:47 simplesamlphp DEBUG [c01f1c196e] Template: Reading [/var/www/html/sso-sp/dictionaries/errors]
Feb 22 17:42:47 simplesamlphp DEBUG [c01f1c196e] Template: Reading [/var/www/html/sso-sp/modules/core/dictionaries/no_state]
Feb 22 17:42:47 simplesamlphp DEBUG [c01f1c196e] Received message:
Feb 22 17:42:47 simplesamlphp DEBUG [c01f1c196e] <samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="_7085ff93653fff2576f069987ef0e493b9d78ad2f2" Version="2.0" IssueInstant="2017-02-23T01:42:46Z" Destination="https://www.example.com/sso-sp/module.php/saml/sp/saml2-acs.php/my-db-service" InResponseTo="_3698154e4a67ac7b7b4337e14b9ef9b0674294a7e6"> ...
^^^ NoState, but seems to have a valid SAML assertion response saved.
**None of this happens if I leave session.cookie.domain => null**, but then of course I can't use the same auth token for multiple SPs.
I received a response which did little to explain what was wrong with this configuration:
"In any case, the whole idea about SSO is, precisely, to allow cross-domain authentication, so you not only don't need to make the cookie available in both the SP and the IdP, but doing so is exactly the source of your trouble, because now the IdP and the SP try to use the same session and they can't."
I don't know either a) which cookie he's referring to or b) how I seem to have gone out of my way to make it "available" in both the SP and IdP. In the case of the auth token cookie, these seem to definitely need to have the same name; so...
Can someone realign my expectations of reality?