【发布时间】:2018-08-18 17:02:03
【问题描述】:
我正在使用 SSOCircle 通过 Codeigniter 测试我的 SAML 实现。目前的步骤是:
- 访问 website.com
- 重定向到 SSOCircle 同意页面
- 验证身份
- 将用户数据传回 website.com
但是,在第 3 步之后,它会转到第 4 步,然后立即返回第 3 步。
这是我的代码:
public function index()
{
$data['languages']= get_all_languages();
$sp_auth = 'default-sp';
try {
$auth = new SimpleSAML_Auth_Simple($sp_auth);
$auth->requireAuth(array(
'ReturnTo' => $this->data['controller'],
'KeepPost' => FALSE,
));
$attributes = $auth->getAttributes();
var_dump($attributes);
} catch (Error $e) {
print_r($e);
}
}
我认为我的重定向可能是它不断调用同意页面的原因。但是,当添加另一个 url 以使用此功能访问时
public function auth(){
$attributes = $auth->getAttributes();
var_dump($attributes);
}
我得到这个错误:
SimpleSAML_Error_Error: UNHANDLEDEXCEPTION
Backtrace:
1 www/_include.php:45 (SimpleSAML_exception_handler)
0 [builtin] (N/A)
Caused by: SimpleSAML_Error_Exception: No authentication source with id 'Login/Auth' found.
Backtrace:
2 lib/SimpleSAML/Auth/Source.php:335 (SimpleSAML_Auth_Source::getById)
1 modules/saml/www/sp/saml2-acs.php:12 (require)
0 www/module.php:135 (N/A)
更新
我最近注意到 SSOCircle 实际上返回到我的登录页面。但是,它会立即将其重定向回 SSOCircle 页面。不确定这是否有帮助
更新 2
我刚刚检查了日志并收到了此警告
Mar 12 23:26:26 simplesamlphp WARNING [da20d4a7a3] Could not load state specified by InResponseTo: NOSTATE Processing response as unsolicited.
有人告诉我这是因为丢失了状态信息。但是我检查了我的 cookie 名称并且它们匹配。我还错过了什么?
https://github.com/simplesamlphp/simplesamlphp/wiki/State-Information-Lost
【问题讨论】:
标签: php codeigniter saml saml-2.0 simplesamlphp