Reputation: 719
So, I am trying to integrate my application with SimpleSAMLphp.
I have to IdP configured and they're both working fine (I can test it on the simplesamlphp admin page, via "Test configured authentication sources")
But when I try to integrate with my application, after loggin in with an IdP, I get stuck in the simplesamlphp page
Like this:
I open my application
My Application calls requireAuth, which redirects me to the simplesamlphp page, where I can choose which IdP I am going to use
I choose one IdP. I get redirected to the IdP page. I successfully log in.
The IdP redirects me back to the simplesamlphp IdP selection screen. I get stuck in here because when I open My Application, it redirects me to this same page.
Does someone knows what am I doing wrong? I think it is a configuration problem, but I have no idea which one could be. Also, isAuthenticated function ALWAYS returns false.
Here is my application code
<?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://teste.localhost'
);
$as->requireAuth ( $param );
}
$attributes = $as->getAttributes ();
print_r ( $attributes );
Upvotes: 5
Views: 2790
Reputation: 21
You should check the 'session.phpsession.savepath' option in the config/config.php file from SimpleSAMLphp. If this does not correspond with the session save path of your application, the session ID will change when the IdP redirects back to you and SimpleSAMLphp will not recognize the login and will try to authenticate you again. Another quick and dirty fix is to set session.auto_start to 1 in php.ini, but I would advise against it.
Upvotes: 2