Search code examples
phpmysqlsimplesamlphp

SimpleSamlPHP SimpleSAML_Error_NoState: NOSTATE


I instal SimpleSAMLPHP on my computer in local so i build 2 virtual host :

<VirtualHost auth.saml.net>
    ServerAdmin [email protected]
    ServerName  auth.saml.net
    AddDefaultCharset UTF-8
    Alias /simplesaml c:/wamp/www/Idp/simplesamlphp/www/    
    <Directory c:/wamp/www/Idp/simplesamlphp/www/   >
        Order Deny,Allow   
        Allow from all 
    </Directory>
</VirtualHost>

<VirtualHost client.saml.net>
    ServerAdmin [email protected]
    ServerName  client.saml.net
    AddDefaultCharset UTF-8
    Alias /simplesaml c:/wamp/www/Sp/simplesamlphp/www/
    <Directory c:/wamp/www/Sp/simplesamlphp/www/    >
        Order Deny,Allow   
        Allow from all 
    </Directory>
</VirtualHost>

The first one is for my Identity Provider and the second for my Service Provider.

But when i try to connect to my Identity Provider by this way :

require_once('../../Sp/simplesamlphp/lib/_autoload.php');
$authService = new SimpleSAML_Auth_Simple("default-sp");
$authService->requireAuth();

I have this error :

SimpleSAML_Error_NoState: NOSTATE
Backtrace:
2 C:\wamp\www\Sp\simplesamlphp\lib\SimpleSAML\Auth\State.php:225 (SimpleSAML_Auth_State::loadState)
1 C:\wamp\www\Sp\simplesamlphp\modules\saml\www\sp\saml2-acs.php:63 (require)
0 C:\wamp\www\Sp\simplesamlphp\www\module.php:134 (N/A)

I see on some forum that in that case i have to replace in the file config/config.php :

'store.type'                    => 'phpsession',

by :

'store.type'                    => 'sql',

So i replace on in the files on the Service provider and Identity provider :

'store.type'                    => 'sql',

'store.sql.dsn'                 => 'mysql:host=localhost;dbname=test',

 'store.sql.username' => 'root',
 'store.sql.password' => '',

 'store.sql.prefix' => 'simpleSAMLphp',

I have some data who arrive in my database but i still have the same error.

What is weird is that when i try to connect me direct on the service provider platform to the Identity provider i don't have this error.


Solution

  • I find the solution it was a litle idiot.

    When i try to connect to the service provider by this way :

    require_once('../../Sp/simplesamlphp/lib/_autoload.php');
    $authService = new SimpleSAML_Auth_Simple("default-sp");
    $authService->requireAuth();
    

    I was on my localhost and not on my service provider (client.saml.net) so i just have to move my file in the path /Sp/simplesamlphp/www/ and change the first line and now it's work.