simplesamlphp / saml2

SimpleSAMLphp low-level SAML2 PHP library
https://www.simplesamlphp.org
GNU Lesser General Public License v2.1
284 stars 134 forks source link

Fatal error: Uncaught Error: Class 'SimpleSAML\Utils\Random' #251

Closed tim-breitenstein-it closed 4 years ago

tim-breitenstein-it commented 4 years ago

Follow the README Usage instruction and immediately get this error:

Fatal error: Uncaught Error: Class 'SimpleSAML\Utils\Random' not found in /var/www/dev/vendor/simplesamlphp/saml2/src/SAML2/Compat/Ssp/Container.php:49 Stack trace: 
#0 /var/www/dev/vendor/simplesamlphp/saml2/src/SAML2/Message.php(143): SAML2\Compat\Ssp\Container->generateId() 
#1 /var/www/dev/vendor/simplesamlphp/saml2/src/SAML2/AuthnRequest.php(144): SAML2\Message->__construct('AuthnRequest', NULL) 
#2 /var/www/dev/sso_saml_2.php(52): SAML2\AuthnRequest->__construct() 
#3 /var/www/dev/sso_saml_2.php(37): sso_saml_test->login() 
#4 /var/www/dev/sso_saml_2.php(105): sso_saml_test->__construct(Array) 
#5 {main} thrown in /var/www/dev/vendor/simplesamlphp/saml2/src/SAML2/Compat/Ssp/Container.php on line 49

My code:

// Implement the Container interface (out of scope for example)
//require 'container.php';
$container = ContainerSingleton::initSspContainer();
SAML2\Compat\ContainerSingleton::setContainer($container);

// Set up an AuthnRequest
$request = new SAML2\AuthnRequest();
$request->setId($container->generateId());
$request->setIssuer('https://sp.example.edu');
$request->setDestination('https://idp.example.edu');

// Send it off using the HTTP-Redirect binding
$binding = new SAML2\HTTPRedirect();
$binding->send($request);

Version:

jaimeperez commented 4 years ago

Hi @tim-breitenstein-it,

As the README says, you need to provide the external dependencies. That means you either install SimpleSAMLphp, or provide your own implementation of the container.