Skip to content
Snippets Groups Projects
Commit c2fec5e1 authored by Jeroen Versteeg's avatar Jeroen Versteeg Committed by Jaime Pérez Crespo
Browse files

Update simplesamlphp-sp.md (#1210)

This includes instructions on how to use SimpleSAMLphp with the PHP session backend while you are using it too in your application, also with a custom session handler.
parent 3f3831b6
No related branches found
No related tags found
No related merge requests found
...@@ -197,6 +197,26 @@ your own session after calling SimpleSAMLphp, you can do so by cleaning up the s ...@@ -197,6 +197,26 @@ your own session after calling SimpleSAMLphp, you can do so by cleaning up the s
If you don't cleanup SimpleSAMLphp's session and try to use $_SESSION afterwards, you won't be using your own session If you don't cleanup SimpleSAMLphp's session and try to use $_SESSION afterwards, you won't be using your own session
and all your data is likely to get lost or inaccessible. and all your data is likely to get lost or inaccessible.
Note that if your application uses a [custom session handler](https://www.php.net/manual/en/function.session-set-save-handler.php), SimpleSAMLphp will use it as well. This can lead to problems because SimpleSAMLphp's stand-alone web UI uses the default PHP session handlers. Therefore, you may need to unset the custom handler before making any calls to SimpleSAMLphp:
// use custom save handler
session_set_save_handler($handler);
session_start();
// close session and restore default handler
session_write_close();
session_set_save_handler(new SessionHandler(), true);
// use SimpleSAML\Session
$session = \SimpleSAML\Session::getSessionFromRequest();
$session->cleanup();
session_write_close();
// back to custom save handler
session_set_save_handler($handler);
session_start();
Support Support
------- -------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment