asasmoyo / yii-simplesamlphp

8 stars 5 forks source link

No_State error #1

Closed kpugazh closed 9 years ago

kpugazh commented 9 years ago

I am getting No_State found error in Yii. But calling IDP just as simple php file in samllogin.php $url = SimpleSAML_Module::getModuleURL('core/authenticate.php', array('as' => $as)); $params = array( 'ErrorURL' => $url, 'ReturnTo' => $url, ); $as->login();

it works fine and redirects to the same page. I have gone through all google links also

Can you please let me know why this is happening

My domain name is

and since the SAML is responding to www.example.org/testSAML/samllogin.php (simple php)

This is not CORS problem

Thanks in Advance

asasmoyo commented 9 years ago

well, i think the problem is in your php session. how do you configure your session in your yii app and simplesamlphp? i usually use phpsession for my yii app and database for my simplesamlphp instance, and it is working just fine

kpugazh commented 9 years ago

I have not configures session in config/main.php so it takes the default php session. What should be done in order to make this work. Since this app is cloud based there is not DB involved in Yii

asasmoyo commented 9 years ago

Try to configure simplesamlphp to use database for storing session. Just create a database and configure the config/config.php in your simplesamlphp to use your database. Let me know if you still experience this problem after you change your simplesamlphp's session storage

kpugazh commented 9 years ago

Hi

I did configured the SAML to store session in DB with teh following configuration in config/config.php

'store.type' => 'sql', 'store.sql.dsn' => 'mysql:host=localhost;dbname=samldb', 'store.sql.username' => 'root', 'store.sql.password' => 'dbpassword', 'store.sql.prefix' => 'simpleSAMLphp',

Yet I am getting the same error. I did not create any table in this db since the link https://simplesamlphp.org/docs/1.10/simplesamlphp-maintenance#section_2

says "The required tables are created automatically." but I see not tables are created

asasmoyo commented 9 years ago

Well, your configuration should just work. You don't need to create the tables, just create the database, setup the connection and simplesamlphp will setup the tables for you. Do you read simplesamlphp's log file? Try to set the log level of simplesamlphp to debug and see what's wrong with your configuration. Where do you host your simplesamlphp app instance? Is it on your pc / laptop or on your server? And your IdP, do you setup your simplesamlphp idp or use third party provider?

kpugazh commented 9 years ago

Where do you host your simplesamlphp app instance?

do you setup your simplesamlphp idp or use third party provider?

in the log file I get only Aug 11 08:38:43 simplesamlphp ERROR [043ffe0bd4] /simplesamlphp/module.php/saml/sp/saml2-acs.php/default-sp - UserError: ErrCode:UNHANDLEDEXCEPTION: State+information+lost%2C+and+no+way+to+restart+the+request. Aug 11 08:38:43 simplesamlphp ERROR [043ffe0bd4] Exception: Exception Aug 11 08:38:43 simplesamlphp ERROR [043ffe0bd4] Backtrace: Aug 11 08:38:43 simplesamlphp ERROR [043ffe0bd4] 0: /var/www/html/samlapp/simplesamlphp/lib/SimpleSAML/Auth/State.php:158 (SimpleSAML_Auth_State::loadState) Aug 11 08:38:43 simplesamlphp ERROR [043ffe0bd4] 1: /var/www/html/samlapp/simplesamlphp/modules/saml/www/sp/saml2-acs.php:24 (require) Aug 11 08:38:43 simplesamlphp ERROR [043ffe0bd4] 2: /var/www/html/samlapp/simplesamlphp/www/module.php:135 (N/A) Aug 11 08:38:43 simplesamlphp ERROR [043ffe0bd4] Aug 11 08:38:43 simplesamlphp ERROR [043ffe0bd4] Error report with id 3d053515 generated.

kpugazh commented 9 years ago

Still there is no table created in the samldb. Is there is configuration missing. I am using simplesamlphp-1.6.3.tar.gz. I also dont get the sanity check, as it says config-sanitycheck.php file not found

asasmoyo commented 9 years ago

Are you sure your SP can connect to your mysql database? In my experience using simplesamlphp state information lost means that there is problem when the simplesamlphp retieve informations from the session storage. When hosting yii and simplesamlphp on the same server with default session storage their session somehow conflict with each other, so we need to separate their session storage. My current approach is using other session storage like database or memcached to store the session. If this still can't fix your problem then maybe there is problem somewhere in your configuration. Well, you should look for problems in your log files, in the simplesamlphp, your web server and your php then fix them. Have you try the newer version of simplesamlphp? The newest (i don't remember which version) simplesamlphp has ben integrated with composer, so you can check if there is problem with your php.

kpugazh commented 9 years ago

The db issue- table creation got solved after installing stable version 1.13.2 from simplesamlphp.org.

Also the session issue got solved. Now that Yii uses PHPSESSION while simplesamlphp session is stored in dB.

Thank you Asasmoyo.

mnkq commented 8 years ago

hi kpugazh, can you describe, how you solve the problem?

asasmoyo commented 8 years ago

@mnkq do you experience the same issue like @kpugazh had before?

kpugazh commented 8 years ago

PDO driver was not installed by default. Installing it solved the issue On 25 Sep 2015 08:27, "mnkq" notifications@github.com wrote:

hi kpugazh, can you describe, how you solve the problem?

— Reply to this email directly or view it on GitHub https://github.com/asasmoyo/yii-simplesamlphp/issues/1#issuecomment-143109149 .

mnkq commented 8 years ago

where i must install PDO Driver ? IDP or SP?

mnkq commented 8 years ago

to @asasmoyo : yes, but if through this i dont have the answer, i will make a new issue with detail of my problem..

asasmoyo commented 8 years ago

@mnkq you have to install appropriate extension for your database if you use a database for you auth source or session storage. can you describe your problem? it is hard to help you if i don't have clear understanding of your problem.