SimpleSAMLphp 状态信息丢失

问题描述 投票:0回答:2

我在 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 时,我被重定向到阶段登录页面,但登录后收到“状态信息丢失”消息“ 错误。我得到以下调试信息:

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 的方式上,因此我开始对 IdP 使用 SSO Circle。在 SSO Circle 上进行身份验证后,状态信息也会丢失。我认为这意味着问题出在我的 SimpleSAML 服务提供商设置上。这就是发生的事情...

当我访问 SimpleSAML 测试身份验证源页面时 https://biz.stage.originsystems.co.za/simplesaml 我有以下 cookie 值...

Name                                       Value
SimpleSAMLAuthToken                        _a53569c0701dd02832532df14cf10cd0b2d9fcd6b6
biz.stage.originsystems.co.za              10fc356e0bfbf707af5fa5854c378755
ccof                                       RGN002
xbrF                                       84aadc624fc51c0c9340d45645c08643

除 SimpleSAMLAuthToken 之外的所有内容均来自我们的应用程序,不应影响 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 Circle,然后我将在其中进行身份验证。此时我的 Auth Token 的值为

_39679e07cb1911e08b2bff3580a9929faddd07e9b6
。一旦我通过身份验证,我就会被定向到 SimpleSAML 错误页面“状态信息丢失”,并且身份验证令牌仍然是
_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 时则不起作用。有人能在这里指出正确的方向吗?我迷路了。

php saml simplesamlphp
2个回答
0
投票

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


0
投票

是,为 Dev 和 Stage 配置单独的身份提供商。身份验证后,他们通过重定向将授权发送到指定的 url。登录成功后。

© www.soinside.com 2019 - 2024. All rights reserved.