我正在尝试通过simplesamlphp为我的网站实现saml。我使用SSOCircle作为IDP,当我使用simplesaml管理页面进行测试时,我能够正确检索用户数据。
但是,当我尝试将其集成到我的登录页面时,当我尝试验证我的用户时,他们会在同意页面上无限循环。我已经尝试检查我的元数据,但如果我的管理页面可以正确验证它,我不确定为什么api方法失败。
这是我的代码
public function index()
{
$sp_auth = 'default-sp';
$as = new SimpleSAML_Auth_Simple($sp_auth);
$as->requireAuth(array("ReturnTo"=>BASE_URL,"KeepPost"=>false));
$attributes = $as->getAttributes();
print_r($attributes);
// $data['languages']= get_all_languages();
// $this->load->view('layout/users/login/header',$data);
// $this->load->view('layout/users/login/errors');
// $this->load->view('login',$data);
// $this->load->view('layout/users/login/footer');
}
$ as-> requireAuth应该将用户重定向到SSOCircle登录页面,然后重定向回mywebsite。但此刻我似乎无法回归。
BASE_URL变量是我的网站登录网址,即www.site.com/app
更新:我刚检查了日志,我收到了这个警告
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