Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simplesamlphp - stuck in the simplesamlphp page when integrating with my application

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:

  1. I open my application

  2. My Application calls requireAuth, which redirects me to the simplesamlphp page, where I can choose which IdP I am going to use

  3. I choose one IdP. I get redirected to the IdP page. I successfully log in.

  4. 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 );
like image 279
priki Avatar asked Oct 31 '22 18:10

priki


1 Answers

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.

like image 149
user1984276 Avatar answered Nov 15 '22 05:11

user1984276