我正在使用SSOCircle通过Codeigniter来测试我的SAML实现。当前步骤是:
但是,在步骤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页面。不确定这是否有帮助
我刚刚检查了日志,并收到此警告
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
更新:后面的段落假定在修改代码以避免Cyclique重定向时,您必须确保:
Configure the authentication module:**
在Unix上,可以通过运行(从SimpleSAMLphp安装目录):
touch modules/exampleauth/enable
下一步是使用此模块创建身份验证源。身份验证源是具有特定身份的身份验证模块组态。每个身份验证源都有一个名称,用于请参阅IdP配置中的此特定配置。可以在以下位置找到认证源的配置config / authsources.php。
在此设置中,该文件应包含一个条目:
<?php $config = array( 'example-userpass' => array( 'exampleauth:UserPass', 'student:studentpass' => array( 'uid' => array('student'), 'eduPersonAffiliation' => array('member', 'student'), ), 'employee:employeepass' => array( 'uid' => array('employee'), 'eduPersonAffiliation' => array('member', 'employee'), ), ), );
此配置创建两个用户-学生和员工,密码studentpass和employeepass。用户名和密码是存储在数组索引中(学生用户的student:studentpass。每个用户的属性在引用的数组中配置索引。对于学生用户,这些是:
array( 'uid' => array('student'), 'eduPersonAffiliation' => array('member', 'student'), ),
属性将在用户登录时由IdP返回。
应用程序的PHP会话设置与SimpleSAMLphp之间的不匹配
如果两个应用程序都试图将SAML 2.0支持添加到和SimpleSAMLphp使用PHP会话进行会话存储,但是它们没有同意所有参数,您可能会遇到此错误。通过默认情况下,SimpleSAMLphp使用php.ini中的设置,但是这些可以在config / config.php中被覆盖。
如果这是导致错误的原因,则有两种选择:
然后,由于处理simpleSAMLphp和codeIgniter之间的会话发生冲突,因此发生No authentication source with id
错误。>>
解决方案是将simpleSAMLphp设置为使用除phpsession以外的其他东西,因为Memcached出现问题,最好的方法是将其设置为'sql'。您可以在simplesamlphp / config / config.php中进行此操作:
/* * Configure the datastore for simpleSAMLphp. * * - 'phpsession': Limited datastore, which uses the PHP session. * - 'memcache': Key-value datastore, based on memcache. * - 'sql': SQL datastore, using PDO. * * The default datastore is 'phpsession'. * * (This option replaces the old 'session.handler'-option.) */ 'store.type' => 'sql',
解决方案2:更改会话设置以匹配应用程序和SimpleSAMLphp:
如果决定使会话设置匹配,则应在php.ini中更改设置。这是为了确保设置适用于使用默认设置的所有内容。 php.ini中的以下选项必须与应用程序使用的设置匹配:
- session.save_handler:这是用于存储会话的方法。默认值为“文件”。
- session.save_path:这是保存会话文件的位置。默认值取决于您的PHP安装。
- session.name:这是会话cookie的名称。默认值为“ PHPSESSID”。
- session.cookie_path:会话cookie限于的路径。默认值为“ /”,这意味着所有用户都可以使用它。您网域上的页面。
- session.cookie_domain:这是会话cookie所限制的域。默认设置为unset,这使cookie可用仅限于当前域。
请查看the docs了解更多信息
如果仍然无法解决,作为最后的手段:try disabling varnish caching
来源:https://github.com/zl4bv/CakePHP-simpleSAMLphp-Plugin/issues/7https://www.drupal.org/project/simplesamlphp_auth