On 03 Apr 2018, at 12:16, mat...@cloudnowtech.com wrote:
Hi,
I am using simplesamlphp as idp in a custom web application. When users hit my application it takes to idp authentication and after successful login, it returns to my application.
Custom Application: Index.php
require_once('/var/www/html/simplesamlphp/lib/_autoload.php');
$as = new SimpleSAML_Auth_Simple('authtfaga');
$as->requireAuth();
$attributes = $as->getAttributes();
I am able to get my user attributes successfully. After I am creating a new session in my application.
$_SESSION["appusermail"] =$attributes['uid'][0];
if(!empty($_SESSION["usermail"]))
{
header("Location: home.php");
}
.
After it redirects to home.php, but in home.php I am not able to get my sessions. It throws no session here.
Home.php:
session_start();
echo '<pre>' . print_r($_SESSION, TRUE) . '</pre>';
-- getting an empty array.
But at the same time in index.php all session exists.
Can anyone help me out, how to solve this problem or did missing something in configuration? I am totally new to simplesamlphp.
Thanks,
Mathi
--
This is a mailing list for users of SimpleSAMLphp, not a support service. If you are willing to buy commercial support, please take a look here:
https://simplesamlphp.org/support
Before sending your question, make sure it is related to SimpleSAMLphp, and not your web server's configuration or any other third-party software. This mailing list cannot help with software that uses SimpleSAMLphp, only regarding SimpleSAMLphp itself.
Make sure to read the documentation:
https://simplesamlphp.org/docs/stable/
If you have an issue with SimpleSAMLphp that you cannot resolve and reading the documentation doesn't help, you are more than welcome to ask here for help. Subscribe to the list and send an email with your question. However, you will be expected to comply with some minimum, common sense standards in your questions. Please read this carefully:
http://catb.org/~esr/faqs/smart-questions.html
---
You received this message because you are subscribed to the Google Groups "SimpleSAMLphp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simplesamlph...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Mathi,
Try this:
Index.php:
require_once('/var/www/html/simplesamlphp/lib/_autoload.php');
session_name("myapplicationcookie"); /* important: name and start your application session first. */
session_start();
$_SESSION[appusermail] = ‘unknown’;
$as = new SimpleSAML_Auth_Simple('authtfaga');
$as->requireAuth();
$attributes = $as->getAttributes();
$session->cleanup(); /* close SSP session and resume your initial application session */
$_SESSION["appusermail"] =$attributes['uid'][0];
if(!empty($_SESSION["appusermail"]))
{
header("Location: home.php");
}
home.php:
session_name("myapplicationcookie");
session_start();
echo '<pre>' . print_r($_SESSION, TRUE) . '</pre>';
Regards,
Harmen
--
Hi Mathi,
I assume you found that in my example I forgot to add this line after SSP is loaded:
$session = SimpleSAML_Session::getSessionFromRequest();
Otherwise it fails.
Anyway, glad it worked out for you.
Regards,
Harmen