-
Jaime Pérez Crespo authored
Use it when constant-time comparisons are needed to avoid side-channel attacks.
b72c79e3
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
<?php
/**
* The Session class holds information about a user session, and everything attached to it.
*
* The session will have a duration and validity, and also cache information about the different
* federation protocols, as Shibboleth and SAML 2.0. On the IdP side the Session class holds
* information about all the currently logged in SPs. This is used when the user initiates a
* Single-Log-Out.
*
* Bear in mind that the session object implements the Serializable interface, and as such,
* all its contents MUST be serializable. If you need to store something in the session object
* that is not serializable, make sure to convert it first to a representation that can be
* serialized.
*
* @author Andreas Åkre Solberg, UNINETT AS. <andreas.solberg@uninett.no>
* @author Jaime Pérez Crespo, UNINETT AS <jaime.perez@uninett.no>
* @package SimpleSAMLphp
*/
class SimpleSAML_Session implements Serializable
{
/**
* This is a timeout value for setData, which indicates that the data
* should never be deleted, i.e. lasts the whole session lifetime.
*/
const DATA_TIMEOUT_SESSION_END = 'sessionEndTimeout';
/**
* The list of loaded session objects.
*
* This is an associative array indexed with the session id.
*
* @var array
*/
private static $sessions = array();
/**
* This variable holds the instance of the session - Singleton approach.
*
* Warning: do not set the instance manually, call SimpleSAML_Session::load() instead.
*/
private static $instance = null;
/**
* The session ID of this session.
*
* @var string|null
*/
private $sessionId;
/**
* Transient session flag.
*
* @var boolean|false
*/
private $transient = false;
/**
* The track id is a new random unique identifier that is generated for each session.
* This is used in the debug logs and error messages to easily track more information
* about what went wrong.
*
* @var string|null
*/
private $trackid = null;