我在https://biz.dev.originsystems.co.za设置了服务提供商。我在http://stage.originsystems.co.za设置了一个IdP。

使用https://biz.dev.originsystems.co.za/simplesaml/module.php/core/authenticate.php中的工具测试身份验证时,一切正常。它返回到具有必需属性的开发站点,并且一切都很开心和愉快。

但是,当我尝试在https://biz.dev.originsystems.co.za上的代码中实际击中IdP时,我被重定向到Stage登录页面,但是登录后出现“状态信息丢失”错误。我得到以下调试信息:

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的cookie包含一个SimpleAMLAuthToken,因此我认为这些cookie可以正常工作。我用来打IdP的代码是:
$as = new SimpleSAML_Auth_Simple("stage-sso-sp");
$as->requireAuth();
$attributes = $as->getAttributes();
print_r($attributes);

更新:

这是更多信息...

我想确定问题是否出在我如何设置IdP上,所以我开始将SSO Circle用于IdP。在SSO Circle上进行身份验证后,状态信息也会丢失。我认为这意味着问题出在我的SimpleSAML服务提供商设置上。这是正在发生的事情...

当我转到https://biz.stage.originsystems.co.za/simplesaml的SimpleSAML测试身份验证源页面时,我具有以下cookie值...
Name                                       Value
SimpleSAMLAuthToken                        _a53569c0701dd02832532df14cf10cd0b2d9fcd6b6
biz.stage.originsystems.co.za              10fc356e0bfbf707af5fa5854c378755
ccof                                       RGN002
xbrF                                       84aadc624fc51c0c9340d45645c08643

除了SimpleSAMLAuthToken之外的所有内容都来自我们的应用程序,不应影响SimpleSAML。重定向到SSO Circle并通过身份验证后,我将返回到SimpleSAML页面,并且Auth Token现在具有_39679e07cb1911e08b2bff3580a9929faddd07e9b6值,并且所有相关信息均已正确返回。日志文件显示以下 Activity 。
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 Circle。目前,我的Autth token 的值为_39679e07cb1911e08b2bff3580a9929faddd07e9b6。通过身份验证后,我将被定向到SimpleSAML错误页面“状态信息丢失”,并且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]

在我看来,身份验证 token 应该是_498e7d4d75bb7716e5e8cf905e0da5ef1c40cf1b3f,但出于某种原因而不是。由于SimpleSAML找不到该 token ,因此它永远不会删除旧 token 并创建新 token 。也许我错了。我非常愿意得到纠正。我的问题是我不知道是什么原因造成的。我已将配置文件中的cookie.name设置为“biz.stage.originsystems.co.za”,这对于SimpleSAML控制面板来说似乎工作正常,但在实际应用中使用SP时,此方法不起作用。有人可以在这里指出正确的方向吗?我迷路了。

最佳答案

您必须定义两个完全独立的环境,以便按照描述的方式将这两个环境(具有两个完全不同的身份提供者)混合使用(这显然是行不通的,除非将它们都添加到了环境中) SSO配置-可能不是期望的结果);简单检查服务器的主机名并相应地定义变量-这可以“即时”执行,也可以通过两个不同的配置文件来完成(在部署结束时推送配置文件实际上是很普遍的)。对我来说,这听起来更像是部署问题(缺少实时站点的正确配置文件),而不是SSO问题。

10-08 17:29