我有一个服务提供商设置在https://biz.dev.originsystems.co.za。我有一个IdP设置在http://stage.originsystems.co.za。SimpleSAMLphp状态信息迷失
当使用工具https://biz.dev.originsystems.co.za/simplesaml/module.php/core/authenticate.php测试身份验证时,一切正常。它带着所需的属性回到开发站点,所有的都是开心和快乐的。
但是,当我尝试实际打到https://biz.dev.originsystems.co.za上代码中的IdP时,我被重定向到页面中的舞台日志,但登录后我收到“状态信息丢失”错误。我得到以下调试信息:
SimpleSAML_Error_NoState: NOSTATE
Backtrace:
2 /webdevroot/Updraft/web/external/System/SSO/simplesaml/lib/SimpleSAML/Auth/State.php:225 (SimpleSAML_Auth_State::loadState)
1 /webdevroot/Updraft/web/external/System/SSO/simplesaml/modules/saml/www/sp/saml2-acs.php:63 (require)
0 /webdevroot/Updraft/web/external/System/SSO/simplesaml/www/module.php:134 (N/A)
我已经完成了所有页面要求我做的故障排除,但情况仍然存在。
我已经打开浏览器上的开发工具,并观看cookie信息。 biz.dev.originsystems.co.za的cookies包含一个SimpleAMLAuthToken,所以我认为cookies正在工作。我用打的IdP的代码是:
$as = new SimpleSAML_Auth_Simple("stage-sso-sp");
$as->requireAuth();
$attributes = $as->getAttributes();
print_r($attributes);
UPDATE:
这里的一些详细信息...
我想,以确定问题是与我如何设置IdP,所以我开始使用SSO Circle作为IdP。在SSO Circle上进行身份验证后,国家信息也会丢失。我认为这意味着这个问题与SimpleSAML的服务提供商设置有关。这里是发生了什么......
当我去SimpleSAML测试认证源页面在https://biz.stage.originsystems.co.za/simplesaml我有以下的cookie值......除了SimpleSAMLAuthToken
Name Value
SimpleSAMLAuthToken _a53569c0701dd02832532df14cf10cd0b2d9fcd6b6
biz.stage.originsystems.co.za 10fc356e0bfbf707af5fa5854c378755
ccof RGN002
xbrF 84aadc624fc51c0c9340d45645c08643
一切都是从我们的应用程序,不应该影响SimpleSAML。一旦我重定向到SSO Circle并进行身份验证,我将返回到我的SimpleSAML页面,并且身份验证令牌现在的值为_39679e07cb1911e08b2bff3580a9929faddd07e9b6
,并且所有相关信息都会正确返回。日志文件显示以下活动。
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] Received SAML2 Response from 'http://idp.ssocircle.com'.
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] No certificate in message when validating against fingerprint.
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] Found 1 certificates in SAML2_Assertion
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] Has 1 candidate keys for validation.
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] Validation with key #0 succeeded.
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] Filter config for http://idp.ssocircle.com->https://biz.stage.originsystems.co.za/simplesaml/module.php/saml/sp/metadata.php/default-sp: array ( 0 => sspmod_core_Auth_Process_LanguageAdaptor::__set_state(array( 'langattr' => 'preferredLanguage', 'priority' => 90, )),)
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] Deleting state: '_742b094314383407864f56bccc6afd7de3dcb3211e'
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] Session: doLogin("default-sp")
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] Session: Valid session found with 'default-sp'.
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] Session: Valid session found with 'default-sp'.
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] Template: Reading [/OriginSystems/application/Updraft/web/external/System/SSO/simplesaml/dictionaries/status]
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] Template: Reading [/OriginSystems/application/Updraft/web/external/System/SSO/simplesaml/dictionaries/attributes]
Feb 02 12:58:22 simplesamlphp DEBUG [7c4534ae0a] Template: Reading [/OriginSystems/application/Updraft/web/external/System/SSO/simplesaml/modules/core/dictionaries/frontpage]
如果我去https://biz.stage.originsystems.co.za?ccof=RGN002,因为我希望是SSO圈,我再验证我重定向。此时我的Autth令牌的值为_39679e07cb1911e08b2bff3580a9929faddd07e9b6
。一旦我通过身份验证,我就被导向到一个SimpleSAML错误页面“State Information Lost”,并且Auth Token仍然是_39679e07cb1911e08b2bff3580a9929faddd07e9b6
。
日志读取...
Feb 02 13:08:31 simplesamlphp DEBUG [8abc64dd04] Loading state: '_498e7d4d75bb7716e5e8cf905e0da5ef1c40cf1b3f'
Feb 02 13:08:31 simplesamlphp ERROR [8abc64dd04] SimpleSAML_Error_NoState: NOSTATE
Feb 02 13:08:31 simplesamlphp ERROR [8abc64dd04] Backtrace:
Feb 02 13:08:31 simplesamlphp ERROR [8abc64dd04] 2 /OriginSystems/application/Updraft/web/external/System/SSO/simplesaml/lib/SimpleSAML/Auth/State.php:225 (SimpleSAML_Auth_State::loadState)
Feb 02 13:08:31 simplesamlphp ERROR [8abc64dd04] 1 /OriginSystems/application/Updraft/web/external/System/SSO/simplesaml/modules/saml/www/sp/saml2-acs.php:63 (require)
Feb 02 13:08:31 simplesamlphp ERROR [8abc64dd04] 0 /OriginSystems/application/Updraft/web/external/System/SSO/simplesaml/www/module.php:134 (N/A)
Feb 02 13:08:31 simplesamlphp ERROR [8abc64dd04] Error report with id dfbb52b0 generated.
Feb 02 13:08:31 simplesamlphp DEBUG [8abc64dd04] Template: Reading [/OriginSystems/application/Updraft/web/external/System/SSO/simplesaml/dictionaries/errors]
Feb 02 13:08:31 simplesamlphp DEBUG [8abc64dd04] Template: Reading [/OriginSystems/application/Updraft/web/external/System/SSO/simplesaml/modules/core/dictionaries/no_state]
在我看来好像身份验证令牌应该是_498e7d4d75bb7716e5e8cf905e0da5ef1c40cf1b3f
,但不是出于某种原因。由于SimpleSAML无法找到该令牌,因此它永远不会删除旧令牌并创建一个新令牌。也许我错了。我非常乐意被纠正。我的问题是,我不知道是什么造成这种情况。我已经将配置文件中的cookie.name设置为“biz.stage.originsystems.co.za”,并且对于SimpleSAML控制面板似乎工作正常,但在从实际应用程序使用SP时不起作用。有人可以在这里指出我正确的方向吗?我迷路了。
生成的ID /令牌你正在以某种方式产生的问题,可以生成此错误的前三位原因是,1.更改域名,例如,你是在example.com www.example.com上跳跃导致的会话为无状态错误,2.从HTTP跳转到HTTPS或HTTPS到HTTP,3.会话没有正确保存,更多请参考[here](https://simplesamlphp.org/docs/development/simplesamlphp-nostate#section_3) –
多思考者:这是一个很好的回应。你应该把它作为答案发布,这样你就可以获得赏金。如果它不适合你,Andrew,你介意发布你的SP和IDP配置的元数据吗? –
不看的元数据,很难给出一个明确的答案,但我想指出的是,Firefox有一个附加的称为SAML示踪剂(https://addons.mozilla.org/en-US/firefox/addon/ saml-tracer /),我在调试SSO问题时一直使用它。可以帮助您追踪哪些值在不依赖调试语句的情况下来回发送。 – mounty