任何人都可以帮助解决此问题: 我有simplesamlphp instaled并使用我的IdP和SP成功测试。 当我按照文档集成APP(步骤6)https://simplesamlphp.org/docs/1.5/simplesamlphp-sp时,我开始收到错误,我会发布以下信息。 这是我的autoload.php:
require __DIR__.'/../vendor/autoload.php';
require_once('/var/simplesamlphp/lib/_autoload.php');
$ as = new SimpleSAML_Auth_Simple('default-sp');
if ($as->isAuthenticated ()) {
//die ( 'ok' );
} else {
$param = array (
'ReturnTo' => 'http://10.128.240.181/'
);
$as->requireAuth ( $param );
}
$attributes = $as->getAttributes();
print_r($attributes);
$session = SimpleSAML_Session::getSessionFromRequest();
$session->cleanup();
错误输出:
Feb 07 16:52:32 simplesamlphp WARNING [CL0a04f709] The class or interface 'SimpleSAML_Auth_Simple' is now using namespaces, please use 'SimpleSAML\Auth\Simple'.
PHP Notice: Undefined index: REQUEST_URI in /var/simplesamlphp/lib/SimpleSAML/Utils/HTTP.php on line 810
PHP Stack trace:
PHP 1. {main}() /var/www/Cachet/bootstrap/autoload.php:0
PHP 2. SimpleSAML\Auth\Simple->requireAuth() /var/www/Cachet/bootstrap/autoload.php:58
PHP 3. SimpleSAML\Auth\Simple->login() /var/simplesamlphp/lib/SimpleSAML/Auth/Simple.php:103
PHP 4. sspmod_saml_Auth_Source_SP->initLogin() /var/simplesamlphp/lib/SimpleSAML/Auth/Simple.php:161
PHP 5. sspmod_saml_Auth_Source_SP->authenticate() /var/simplesamlphp/lib/SimpleSAML/Auth/Source.php:193
PHP 6. sspmod_saml_Auth_Source_SP->startSSO() /var/simplesamlphp/modules/saml/lib/Auth/Source/SP.php:431
PHP 7. sspmod_saml_Auth_Source_SP->startSSO2() /var/simplesamlphp/modules/saml/lib/Auth/Source/SP.php:336
PHP 8. sspmod_saml_Auth_Source_SP->sendSAML2AuthnRequest() /var/simplesamlphp/modules/saml/lib/Auth/Source/SP.php:298
PHP 9. SAML2\HTTPRedirect->send() /var/simplesamlphp/modules/saml/lib/Auth/Source/SP.php:314
PHP 10. SAML2\Compat\Ssp\Container->redirect() /var/simplesamlphp/vendor/simplesamlphp/saml2/src/SAML2/HTTPRedirect.php:83
PHP 11. SimpleSAML_Utilities::redirectTrustedURL() /var/simplesamlphp/vendor/simplesamlphp/saml2/src/SAML2/Compat/Ssp/Container.php:52
PHP 12. SimpleSAML\Utils\HTTP::redirectTrustedURL() /var/simplesamlphp/lib/SimpleSAML/Utilities.php:276
PHP 13. SimpleSAML\Utils\HTTP::normalizeURL() /var/simplesamlphp/lib/SimpleSAML/Utils/HTTP.php:968
PHP 14. SimpleSAML\Utils\HTTP::getSelfURL() /var/simplesamlphp/lib/SimpleSAML/Utils/HTTP.php:889
****PHP Fatal error: Uncaught SimpleSAML_Error_UnserializableException: Unable to parse base url: http://localhost in /var/simplesamlphp/lib/SimpleSAML/Auth/Source.php:197****
Stack trace:
#0 /var/simplesamlphp/lib/SimpleSAML/Auth/Simple.php(161): SimpleSAML_Auth_Source->initLogin('http://10.128.2...', NULL, Array)
#1 /var/simplesamlphp/lib/SimpleSAML/Auth/Simple.php(103): SimpleSAML\Auth\Simple->login(Array)
#2 /var/www/Cachet/bootstrap/autoload.php(58): SimpleSAML\Auth\Simple->requireAuth(Array)
#3 {main}
thrown in /var/simplesamlphp/lib/SimpleSAML/Auth/Source.php on line 197
任何人都知道导致此错误的原因是什么?我是php和SAML的新手,
答案 0 :(得分:1)
我认为有两个问题。第一个是:
Feb 07 16:52:32 simplesamlphp警告[CL0a04f709]类或接口'SimpleSAML_Auth_Simple'现在使用名称空间,请使用'SimpleSAML \ Auth \ Simple'。
您似乎正在关注旧文档并使用最新版本的SimpleSAMLphp。您必须使用$as = new \SimpleSAML\Auth\Simple('default-sp');
代替$as = new SimpleSAML_Auth_Simple ( 'default-sp' );
如果您使用的是最新稳定版的SimpleSAMLphp,请关注https://simplesamlphp.org/docs/stable/simplesamlphp-sp
第二个问题是
**** PHP致命错误:未捕获SimpleSAML_Error_UnserializableException:无法在/var/simplesamlphp/lib/SimpleSAML/Auth/Source.php:197 ****
中解析基本网址:http://localhost
这与配置(这是一个疯狂的猜测)更相关。您能在Web服务器(IIS / Apache / nginx)上提供更多信息吗?我认为IIS有一些已知的问题:https://github.com/simplesamlphp/simplesamlphp/issues/540