0

Anyone can help with this issue: I have simplesamlphp instaled and tested successfully with my IdP and SP. when I integrated the APP following the doc (step 6) https://simplesamlphp.org/docs/1.5/simplesamlphp-sp I started getting errors I will post bellow. Here is my 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();

Error output:

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

Anyone has an idea what could be the cause of this error ? I am a newbie in php and SAML,

mohbar
  • 57
  • 4
  • 10

1 Answers1

1

I think there are two issues. The first one is:

Feb 07 16:52:32 simplesamlphp WARNING [CL0a04f709] The class or interface 'SimpleSAML_Auth_Simple' is now using namespaces, please use 'SimpleSAML\Auth\Simple'.

It seems you are following an old documentation and using a recent version of SimpleSAMLphp. You will have to use $as = new \SimpleSAML\Auth\Simple('default-sp'); instead of $as = new SimpleSAML_Auth_Simple ( 'default-sp' );

If you are using the latest stable version of SimpleSAMLphp, please follow https://simplesamlphp.org/docs/stable/simplesamlphp-sp

The second issue is

****PHP Fatal error: Uncaught SimpleSAML_Error_UnserializableException: Unable to parse base url: http://localhost in /var/simplesamlphp/lib/SimpleSAML/Auth/Source.php:197****

This is more related to the configuration (This is a wild guess). Can you provide more info on your web server (IIS/Apache/nginx)? I think IIS has some known issues: https://github.com/simplesamlphp/simplesamlphp/issues/540

libregeek
  • 1,264
  • 11
  • 23