我有两个simplesamlphp服务器设置,他们都在同一台物理服务器,但由虚拟主机分开。他们目前在这些领域。SimpleSAMLPHP没有状态错误
id.saml.domain.com
< - 身份提供商
sp.saml.domain.com
< - 服务提供商
我也有一个第三个网站,网应用程序,我确实要对在实现单点登录。我们称之为
test.domain.com/webapplication
我有服务提供商和身份提供者互相交谈使用例如-auth的。我可以去服务提供商,点击'测试认证来源',发送到身份服务器,然后获得登录提示,输入示例凭据,单击提交,然后发送回服务提供商。
在这一点上,一切看起来不错。
我的问题是,当我尝试在网站中实现服务提供者。
我已经制定了以下登录代码来调用服务提供商的代码
$lib = "/ltsites/saml/service/lib";
$sp = "default-sp"; // Name of SP defined in config/authsources.php
try {
// Autoload simplesamlphp classes.
if(!file_exists("{$lib}/_autoload.php")) {
throw(new Exception("simpleSAMLphp lib loader file does not exist: ".
"{$lib}/_autoload.php"));
}
include_once("{$lib}/_autoload.php");
$as = new SimpleSAML_Auth_Simple($sp);
// Take the user to IdP and authenticate.
$as->requireAuth();
$valid_saml_session = $as->isAuthenticated();
} catch (Exception $e) {
// SimpleSAMLphp is not configured correctly.
throw(new Exception("SSO authentication failed: ". $e->getMessage()));
return;
}
if (!$valid_saml_session) {
// Not valid session. Redirect a user to Identity Provider
try {
$as = new SimpleSAML_Auth_Simple($sp);
$as->requireAuth();
} catch (Exception $e) {
// SimpleSAMLphp is not configured correctly.
throw(new Exception("SSO authentication failed: ". $e->getMessage()));
return;
}
}
// At this point, the user is authenticated by the Identity Provider, and has access
// to the attributes received with SAML assertion.
$attributes = $as->getAttributes();
它正向我一路身份服务器并请求凭据。但在返回到服务提供商我的错误
State information lost
SimpleSAML_Error_NoState: NOSTATE
,我发现这个wiki页面https://code.google.com/p/simplesamlphp/wiki/LostState,但没有我读它(如改变config\config.php
的'session.cookie.domain'
,刚刚发送的网页进入无限刷新循环后做)工作
没有人有任何想法吗?我是否设置错误?我在想也许Web应用程序本身必须是服务提供商?即test.domain.com/webapplication/simplesaml/
,这样两个人在同一个域上?