ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Session.php
Go to the documentation of this file.
1 <?php
20 {
21 
26  const DATA_TIMEOUT_SESSION_END = 'sessionEndTimeout';
27 
28 
36  private static $sessions = array();
37 
38 
44  private static $instance = null;
45 
46 
52  private $sessionId;
53 
54 
60  private $transient = false;
61 
62 
70  private $trackid = null;
71 
72 
73  private $rememberMeExpire = null;
74 
75 
82  private $dirty = false;
83 
84 
90  private $callback_registered = false;
91 
92 
103  private $dataStore = null;
104 
105 
114  private $associations = array();
115 
116 
124  private $authToken;
125 
126 
134  private $authData = array();
135 
136 
143  private function __construct($transient = false)
144  {
145  if (php_sapi_name() === 'cli' || defined('STDIN')) {
146  $this->trackid = 'CL'.bin2hex(openssl_random_pseudo_bytes(4));
147  SimpleSAML\Logger::setTrackId($this->trackid);
148  $this->transient = $transient;
149  return;
150  }
151 
152  if ($transient) { // transient session
154  $this->trackid = 'TR'.bin2hex(openssl_random_pseudo_bytes(4));
155  SimpleSAML\Logger::setTrackId($this->trackid);
156  $this->transient = true;
157 
158  /*
159  * Initialize the session ID. It might be that we have a session cookie but we couldn't load the session.
160  * If that's the case, use that ID. If not, create a new ID.
161  */
162  $this->sessionId = $sh->getCookieSessionId();
163  if ($this->sessionId === null) {
164  $this->sessionId = $sh->newSessionId();
165  }
166  } else { // regular session
168  $this->sessionId = $sh->newSessionId();
169  $sh->setCookie($sh->getSessionCookieName(), $this->sessionId, $sh->getCookieParams());
170 
171 
172  $this->trackid = bin2hex(openssl_random_pseudo_bytes(5));
173  SimpleSAML\Logger::setTrackId($this->trackid);
174 
175  $this->markDirty();
176 
177  // initialize data for session check function if defined
179  $checkFunction = $globalConfig->getArray('session.check_function', null);
180  if (isset($checkFunction)) {
181  assert(is_callable($checkFunction));
182  call_user_func($checkFunction, $this, true);
183  }
184  }
185  }
186 
187 
195  public function serialize()
196  {
197  $serialized = serialize(get_object_vars($this));
198  return $serialized;
199  }
200 
201 
210  public function unserialize($serialized)
211  {
212  $session = unserialize($serialized);
213  if (is_array($session)) {
214  foreach ($session as $k => $v) {
215  $this->$k = $v;
216  }
217  }
218 
219  // look for any raw attributes and load them in the 'Attributes' array
220  foreach ($this->authData as $authority => $parameters) {
221  if (!array_key_exists('RawAttributes', $parameters)) {
222  continue;
223  }
224 
225  foreach ($parameters['RawAttributes'] as $attribute => $values) {
226  foreach ($values as $idx => $value) { // this should be originally a DOMNodeList
227  /* @var \SAML2\XML\saml\AttributeValue $value */
228  $this->authData[$authority]['Attributes'][$attribute][$idx] = $value->element->childNodes;
229  }
230  }
231  }
232  }
233 
234 
241  public static function getSessionFromRequest()
242  {
243  // check if we already have initialized the session
244  if (isset(self::$instance)) {
245  return self::$instance;
246  }
247 
248  // check if we have stored a session stored with the session handler
249  $session = null;
250  try {
251  $session = self::getSession();
252  } catch (Exception $e) {
253  /*
254  * For some reason, we were unable to initialize this session. Note that this error might be temporary, and
255  * it's possible that we can recover from it in subsequent requests, so we should not try to create a new
256  * session here. Therefore, use just a transient session and throw the exception for someone else to handle
257  * it.
258  */
259  SimpleSAML\Logger::error('Error loading session: '.$e->getMessage());
260  self::useTransientSession();
261  if ($e instanceof SimpleSAML_Error_Exception) {
262  $cause = $e->getCause();
263  if ($cause instanceof Exception) {
264  throw $cause;
265  }
266  }
267  throw $e;
268  }
269 
270  // if getSession() found it, use it
271  if ($session instanceof SimpleSAML_Session) {
272  return self::load($session);
273  }
274 
275  /*
276  * We didn't have a session loaded when we started, but we have it now. At this point, getSession() failed but
277  * it must have triggered the creation of a session at some point during the process (e.g. while logging an
278  * error message). This means we don't need to create a new session again, we can use the one that's loaded now
279  * instead.
280  */
281  if (self::$instance !== null) {
282  return self::$instance;
283  }
284 
285  // try to create a new session
286  try {
287  self::load(new SimpleSAML_Session());
288  } catch (\SimpleSAML\Error\CannotSetCookie $e) {
289  // can't create a regular session because we can't set cookies. Use transient.
291  self::useTransientSession();
292 
293  if ($e->getCode() === \SimpleSAML\Error\CannotSetCookie::SECURE_COOKIE) {
294  throw new \SimpleSAML\Error\CriticalConfigurationError(
295  $e->getMessage(),
296  null,
297  $c->toArray()
298  );
299  }
300  SimpleSAML\Logger::error('Error creating session: '.$e->getMessage());
301  }
302 
303  // we must have a session now, either regular or transient
304  return self::$instance;
305  }
306 
315  public static function getSession($sessionId = null)
316  {
317  assert(is_string($sessionId) || $sessionId === null);
318 
320 
321  if ($sessionId === null) {
322  $checkToken = true;
323  $sessionId = $sh->getCookieSessionId();
324  if ($sessionId === null) {
325  return null;
326  }
327  } else {
328  $checkToken = false;
329  }
330 
331  if (array_key_exists($sessionId, self::$sessions)) {
332  return self::$sessions[$sessionId];
333  }
334 
335  $session = $sh->loadSession($sessionId);
336  if ($session === null) {
337  return null;
338  }
339 
340  assert($session instanceof self);
341 
342  if ($checkToken) {
344 
345  if ($session->authToken !== null) {
346  $authTokenCookieName = $globalConfig->getString(
347  'session.authtoken.cookiename',
348  'SimpleSAMLAuthToken'
349  );
350  if (!isset($_COOKIE[$authTokenCookieName])) {
351  SimpleSAML\Logger::warning('Missing AuthToken cookie.');
352  return null;
353  }
354  if (!SimpleSAML\Utils\Crypto::secureCompare($session->authToken, $_COOKIE[$authTokenCookieName])) {
355  SimpleSAML\Logger::warning('Invalid AuthToken cookie.');
356  return null;
357  }
358  }
359 
360  // run session check function if defined
361  $checkFunction = $globalConfig->getArray('session.check_function', null);
362  if (isset($checkFunction)) {
363  assert(is_callable($checkFunction));
364  $check = call_user_func($checkFunction, $session);
365  if ($check !== true) {
366  SimpleSAML\Logger::warning('Session did not pass check function.');
367  return null;
368  }
369  }
370  }
371 
372  self::$sessions[$sessionId] = $session;
373 
374  return $session;
375  }
376 
377 
388  private static function load(SimpleSAML_Session $session)
389  {
391  self::$instance = $session;
392  return self::$instance;
393  }
394 
401  public static function useTransientSession()
402  {
403  if (isset(self::$instance)) {
404  // we already have a session, don't bother with a transient session
405  return;
406  }
407 
408  self::load(new SimpleSAML_Session(true));
409  }
410 
416  public static function createSession($sessionId)
417  {
418  assert(is_string($sessionId));
419  self::$sessions[$sessionId] = null;
420  }
421 
430  public function save()
431  {
432  if (!$this->dirty) {
433  // session hasn't changed, don't bother saving it
434  return;
435  }
436 
437  $this->dirty = false;
438  $this->callback_registered = false;
439 
441 
442  try {
443  $sh->saveSession($this);
444  } catch (Exception $e) {
445  if (!($e instanceof SimpleSAML_Error_Exception)) {
447  }
448  SimpleSAML\Logger::error('Unable to save session.');
449  $e->logError();
450  }
451  }
452 
453 
460  public function cleanup()
461  {
462  $this->save();
464  if ($sh instanceof \SimpleSAML\SessionHandlerPHP) {
465  $sh->restorePrevious();
466  }
467  }
468 
469 
475  public function markDirty()
476  {
477  if ($this->isTransient()) {
478  return;
479  }
480 
481  $this->dirty = true;
482 
483  if ($this->callback_registered) {
484  // we already have a shutdown callback registered for this object, no need to add another one
485  return;
486  }
487  $this->callback_registered = header_register_callback(array($this, 'save'));
488  }
489 
490 
497  public function __destruct()
498  {
499  $this->save();
500  }
501 
507  public function getSessionId()
508  {
509  return $this->sessionId;
510  }
511 
517  public function isTransient()
518  {
519  return $this->transient;
520  }
521 
528  public function getTrackID()
529  {
530  return $this->trackid;
531  }
532 
538  public function getRememberMeExpire()
539  {
541  }
542 
548  public function setRememberMeExpire($expire = null)
549  {
550  assert(is_int($expire) || $expire === null);
551 
552  if ($expire === null) {
554  $expire = time() + $globalConfig->getInteger('session.rememberme.lifetime', 14 * 86400);
555  }
556  $this->rememberMeExpire = $expire;
557 
558  $cookieParams = array('expire' => $this->rememberMeExpire);
559  $this->updateSessionCookies($cookieParams);
560  }
561 
572  public function doLogin($authority, array $data = null)
573  {
574  assert(is_string($authority));
575  assert(is_array($data) || $data === null);
576 
577  SimpleSAML\Logger::debug('Session: doLogin("'.$authority.'")');
578 
579  $this->markDirty();
580 
581  if (isset($this->authData[$authority])) {
582  // we are already logged in, log the user out first
583  $this->doLogout($authority);
584  }
585 
586  if ($data === null) {
587  $data = array();
588  }
589 
590  $data['Authority'] = $authority;
591 
593  if (!isset($data['AuthnInstant'])) {
594  $data['AuthnInstant'] = time();
595  }
596 
597  $maxSessionExpire = time() + $globalConfig->getInteger('session.duration', 8 * 60 * 60);
598  if (!isset($data['Expire']) || $data['Expire'] > $maxSessionExpire) {
599  // unset, or beyond our session lifetime. Clamp it to our maximum session lifetime
600  $data['Expire'] = $maxSessionExpire;
601  }
602 
603  // check if we have non-serializable attribute values
604  foreach ($data['Attributes'] as $attribute => $values) {
605  foreach ($values as $idx => $value) {
606  if (is_string($value) || is_int($value)) {
607  continue;
608  }
609 
610  // at this point, this should be a DOMNodeList object...
611  if (!is_a($value, 'DOMNodeList')) {
612  continue;
613  }
614 
615  /* @var \DOMNodeList $value */
616  if ($value->length === 0) {
617  continue;
618  }
619 
620  // create an AttributeValue object and save it to 'RawAttributes', using same attribute name and index
621  $attrval = new \SAML2\XML\saml\AttributeValue($value->item(0)->parentNode);
622  $data['RawAttributes'][$attribute][$idx] = $attrval;
623  }
624  }
625 
626  $this->authData[$authority] = $data;
627 
628  $this->authToken = SimpleSAML\Utils\Random::generateID();
630 
631  if (!$this->transient && (!empty($data['RememberMe']) || $this->rememberMeExpire) &&
632  $globalConfig->getBoolean('session.rememberme.enable', false)
633  ) {
634  $this->setRememberMeExpire();
635  } else {
636  try {
638  $globalConfig->getString('session.authtoken.cookiename', 'SimpleSAMLAuthToken'),
640  $sessionHandler->getCookieParams()
641  );
642  } catch (SimpleSAML\Error\CannotSetCookie $e) {
643  /*
644  * Something went wrong when setting the auth token. We cannot recover from this, so we better log a
645  * message and throw an exception. The user is not properly logged in anyway, so clear all login
646  * information from the session.
647  */
648  unset($this->authToken);
649  unset($this->authData[$authority]);
650  \SimpleSAML\Logger::error('Cannot set authentication token cookie: '.$e->getMessage());
651  throw $e;
652  }
653  }
654  }
655 
663  public function doLogout($authority)
664  {
665  SimpleSAML\Logger::debug('Session: doLogout('.var_export($authority, true).')');
666 
667  if (!isset($this->authData[$authority])) {
668  SimpleSAML\Logger::debug('Session: Already logged out of '.$authority.'.');
669  return;
670  }
671 
672  $this->markDirty();
673 
674  $this->callLogoutHandlers($authority);
675  unset($this->authData[$authority]);
676 
677  if (!$this->isValid($authority) && $this->rememberMeExpire) {
678  $this->rememberMeExpire = null;
679  $this->updateSessionCookies();
680  }
681  }
682 
690  private function callLogoutHandlers($authority)
691  {
692  assert(is_string($authority));
693  assert(isset($this->authData[$authority]));
694 
695  if (empty($this->authData[$authority]['LogoutHandlers'])) {
696  return;
697  }
698  foreach ($this->authData[$authority]['LogoutHandlers'] as $handler) {
699  // verify that the logout handler is a valid function
700  if (!is_callable($handler)) {
701  $classname = $handler[0];
702  $functionname = $handler[1];
703 
704  throw new Exception(
705  'Logout handler is not a valid function: '.$classname.'::'.
706  $functionname
707  );
708  }
709 
710  // call the logout handler
711  call_user_func($handler);
712  }
713 
714  // we require the logout handlers to register themselves again if they want to be called later
715  unset($this->authData[$authority]['LogoutHandlers']);
716  }
717 
726  public function isValid($authority)
727  {
728  assert(is_string($authority));
729 
730  if (!isset($this->authData[$authority])) {
732  'Session: '.var_export($authority, true).
733  ' not valid because we are not authenticated.'
734  );
735  return false;
736  }
737 
738  if ($this->authData[$authority]['Expire'] <= time()) {
739  SimpleSAML\Logger::debug('Session: '.var_export($authority, true).' not valid because it is expired.');
740  return false;
741  }
742 
743  SimpleSAML\Logger::debug('Session: Valid session found with '.var_export($authority, true).'.');
744 
745  return true;
746  }
747 
753  public function updateSessionCookies($params = null)
754  {
755  assert(is_null($params) || is_array($params));
756 
758 
759  if ($this->sessionId !== null) {
760  $sessionHandler->setCookie($sessionHandler->getSessionCookieName(), $this->sessionId, $params);
761  }
762 
763  $params = array_merge($sessionHandler->getCookieParams(), is_array($params) ? $params : array());
764 
765  if ($this->authToken !== null) {
768  $globalConfig->getString('session.authtoken.cookiename', 'SimpleSAMLAuthToken'),
770  $params
771  );
772  }
773  }
774 
781  public function setAuthorityExpire($authority, $expire = null)
782  {
783  assert(isset($this->authData[$authority]));
784  assert(is_int($expire) || $expire === null);
785 
786  $this->markDirty();
787 
788  if ($expire === null) {
790  $expire = time() + $globalConfig->getInteger('session.duration', 8 * 60 * 60);
791  }
792 
793  $this->authData[$authority]['Expire'] = $expire;
794  }
795 
805  public function registerLogoutHandler($authority, $classname, $functionname)
806  {
807  assert(isset($this->authData[$authority]));
808 
809  $logout_handler = array($classname, $functionname);
810 
811  if (!is_callable($logout_handler)) {
812  throw new Exception(
813  'Logout handler is not a vaild function: '.$classname.'::'.
814  $functionname
815  );
816  }
817 
818  $this->authData[$authority]['LogoutHandlers'][] = $logout_handler;
819  $this->markDirty();
820  }
821 
830  public function deleteData($type, $id)
831  {
832  assert(is_string($type));
833  assert(is_string($id));
834 
835  if (!is_array($this->dataStore)) {
836  return;
837  }
838 
839  if (!array_key_exists($type, $this->dataStore)) {
840  return;
841  }
842 
843  unset($this->dataStore[$type][$id]);
844  $this->markDirty();
845  }
846 
863  public function setData($type, $id, $data, $timeout = null)
864  {
865  assert(is_string($type));
866  assert(is_string($id));
867  assert(is_int($timeout) || $timeout === null || $timeout === self::DATA_TIMEOUT_SESSION_END);
868 
869  // clean out old data
870  $this->expireData();
871 
872  if ($timeout === null) {
873  // use the default timeout
874  $configuration = SimpleSAML_Configuration::getInstance();
875 
876  $timeout = $configuration->getInteger('session.datastore.timeout', null);
877  if ($timeout !== null) {
878  if ($timeout <= 0) {
879  throw new Exception(
880  'The value of the session.datastore.timeout'.
881  ' configuration option should be a positive integer.'
882  );
883  }
884  }
885  }
886 
887  if ($timeout === self::DATA_TIMEOUT_SESSION_END) {
888  $expires = self::DATA_TIMEOUT_SESSION_END;
889  } else {
890  $expires = time() + $timeout;
891  }
892 
893  $dataInfo = array(
894  'expires' => $expires,
895  'timeout' => $timeout,
896  'data' => $data
897  );
898 
899  if (!is_array($this->dataStore)) {
900  $this->dataStore = array();
901  }
902 
903  if (!array_key_exists($type, $this->dataStore)) {
904  $this->dataStore[$type] = array();
905  }
906 
907  $this->dataStore[$type][$id] = $dataInfo;
908 
909  $this->markDirty();
910  }
911 
919  private function expireData()
920  {
921  if (!is_array($this->dataStore)) {
922  return;
923  }
924 
925  $ct = time();
926 
927  foreach ($this->dataStore as &$typedData) {
928  foreach ($typedData as $id => $info) {
929  if ($info['expires'] === self::DATA_TIMEOUT_SESSION_END) {
930  // this data never expires
931  continue;
932  }
933 
934  if ($ct > $info['expires']) {
935  unset($typedData[$id]);
936  }
937  }
938  }
939  }
940 
952  public function getData($type, $id)
953  {
954  assert(is_string($type));
955  assert($id === null || is_string($id));
956 
957  if ($id === null) {
958  return null;
959  }
960 
961  $this->expireData();
962 
963  if (!is_array($this->dataStore)) {
964  return null;
965  }
966 
967  if (!array_key_exists($type, $this->dataStore)) {
968  return null;
969  }
970 
971  if (!array_key_exists($id, $this->dataStore[$type])) {
972  return null;
973  }
974 
975  return $this->dataStore[$type][$id]['data'];
976  }
977 
991  public function getDataOfType($type)
992  {
993  assert(is_string($type));
994 
995  if (!is_array($this->dataStore)) {
996  return array();
997  }
998 
999  if (!array_key_exists($type, $this->dataStore)) {
1000  return array();
1001  }
1002 
1003  $ret = array();
1004  foreach ($this->dataStore[$type] as $id => $info) {
1005  $ret[$id] = $info['data'];
1006  }
1007 
1008  return $ret;
1009  }
1010 
1018  public function getAuthState($authority)
1019  {
1020  assert(is_string($authority));
1021 
1022  if (!isset($this->authData[$authority])) {
1023  return null;
1024  }
1025 
1026  return $this->authData[$authority];
1027  }
1028 
1029 
1037  public function hasSessionCookie()
1038  {
1040  return $sh->hasSessionCookie();
1041  }
1042 
1043 
1052  public function addAssociation($idp, array $association)
1053  {
1054  assert(is_string($idp));
1055  assert(isset($association['id']));
1056  assert(isset($association['Handler']));
1057 
1058  if (!isset($this->associations)) {
1059  $this->associations = array();
1060  }
1061 
1062  if (!isset($this->associations[$idp])) {
1063  $this->associations[$idp] = array();
1064  }
1065 
1066  $this->associations[$idp][$association['id']] = $association;
1067 
1068  $this->markDirty();
1069  }
1070 
1071 
1081  public function getAssociations($idp)
1082  {
1083  assert(is_string($idp));
1084 
1085  if (!isset($this->associations)) {
1086  $this->associations = array();
1087  }
1088 
1089  if (!isset($this->associations[$idp])) {
1090  return array();
1091  }
1092 
1093  foreach ($this->associations[$idp] as $id => $assoc) {
1094  if (!isset($assoc['Expires'])) {
1095  continue;
1096  }
1097  if ($assoc['Expires'] >= time()) {
1098  continue;
1099  }
1100 
1101  unset($this->associations[$idp][$id]);
1102  }
1103 
1104  return $this->associations[$idp];
1105  }
1106 
1107 
1116  public function terminateAssociation($idp, $associationId)
1117  {
1118  assert(is_string($idp));
1119  assert(is_string($associationId));
1120 
1121  if (!isset($this->associations)) {
1122  return;
1123  }
1124 
1125  if (!isset($this->associations[$idp])) {
1126  return;
1127  }
1128 
1129  unset($this->associations[$idp][$associationId]);
1130 
1131  $this->markDirty();
1132  }
1133 
1134 
1143  public function getAuthData($authority, $name)
1144  {
1145  assert(is_string($authority));
1146  assert(is_string($name));
1147 
1148  if (!isset($this->authData[$authority][$name])) {
1149  return null;
1150  }
1151  return $this->authData[$authority][$name];
1152  }
1153 
1154 
1161  public function getAuthorities()
1162  {
1163  $authorities = array();
1164  foreach (array_keys($this->authData) as $authority) {
1165  if ($this->isValid($authority)) {
1166  $authorities[] = $authority;
1167  }
1168  }
1169  return $authorities;
1170  }
1171 }
$expire
Definition: saml2-acs.php:140
static generateID()
Generate a random identifier, ID_LENGTH bytes long.
Definition: Random.php:26
$_COOKIE['client_id']
Definition: server.php:9
getSessionId()
Retrieve the session ID of this session.
Definition: Session.php:507
$type
doLogin($authority, array $data=null)
Marks the user as logged in with the specified authority.
Definition: Session.php:572
setAuthorityExpire($authority, $expire=null)
Set the lifetime for authentication source.
Definition: Session.php:781
updateSessionCookies($params=null)
Update session cookies.
Definition: Session.php:753
getData($type, $id)
This function retrieves data from the data store.
Definition: Session.php:952
static createSession($sessionId)
Create a new session and cache it.
Definition: Session.php:416
deleteData($type, $id)
Delete data from the data store.
Definition: Session.php:830
static debug($string)
Definition: Logger.php:211
$session
if(!array_key_exists('StateId', $_REQUEST)) $id
isValid($authority)
Is the session representing an authenticated user, and is the session still alive.
Definition: Session.php:726
expireData()
This function removes expired data from the data store.
Definition: Session.php:919
static getSession($sessionId=null)
Get a session from the session handler.
Definition: Session.php:315
serialize()
Serialize this session object.
Definition: Session.php:195
__destruct()
Destroy the session.
Definition: Session.php:497
cleanup()
Save the current session and clean any left overs that could interfere with the normal application be...
Definition: Session.php:460
getDataOfType($type)
This function retrieves all data of the specified type from the data store.
Definition: Session.php:991
static setTrackId($trackId)
Set the track identifier to use in all logs.
Definition: Logger.php:253
setRememberMeExpire($expire=null)
Set remember me expire time.
Definition: Session.php:548
Attribute-related utility methods.
hasSessionCookie()
Check whether the session cookie is set.
Definition: Session.php:1037
static setCookie($name, $value, $params=null, $throw=true)
Set a cookie.
Definition: HTTP.php:1104
getRememberMeExpire()
Get remember me expire time.
Definition: Session.php:538
markDirty()
Mark this session as dirty.
Definition: Session.php:475
const DATA_TIMEOUT_SESSION_END
This is a timeout value for setData, which indicates that the data should never be deleted...
Definition: Session.php:26
static warning($string)
Definition: Logger.php:177
$values
getTrackID()
Get a unique ID that will be permanent for this session.
Definition: Session.php:528
static error($string)
Definition: Logger.php:166
static $instance
This variable holds the instance of the session - Singleton approach.
Definition: Session.php:44
static load(SimpleSAML_Session $session)
Load a given session as the current one.
Definition: Session.php:388
static getSessionHandler()
This function retrieves the current instance of the session handler.
$globalConfig
save()
Save the session to the store.
Definition: Session.php:430
registerLogoutHandler($authority, $classname, $functionname)
This function registers a logout handler.
Definition: Session.php:805
unserialize($serialized)
Unserialize a session object and load it.
Definition: Session.php:210
isTransient()
Retrieve if session is transient.
Definition: Session.php:517
if(!isset($associations[$assocId])) $association
$idp
Definition: prp.php:13
$ret
Definition: parser.php:6
getAuthorities()
Retrieve a list of authorities (authentication sources) that are currently valid within this session...
Definition: Session.php:1161
getAuthData($authority, $name)
Retrieve authentication data.
Definition: Session.php:1143
__construct($transient=false)
Private constructor that restricts instantiation to either getSessionFromRequest() for the current se...
Definition: Session.php:143
static useTransientSession()
Use a transient session.
Definition: Session.php:401
getAssociations($idp)
Retrieve the associations for an IdP.
Definition: Session.php:1081
$info
Definition: index.php:5
$authority
$handler
static getSessionFromRequest()
Retrieves the current session.
Definition: Session.php:241
addAssociation($idp, array $association)
Add an SP association for an IdP.
Definition: Session.php:1052
static $sessions
Definition: Session.php:36
setData($type, $id, $data, $timeout=null)
This function stores data in the data store.
Definition: Session.php:863
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
callLogoutHandlers($authority)
This function calls all registered logout handlers.
Definition: Session.php:690
getAuthState($authority)
Get the current persistent authentication state.
Definition: Session.php:1018
doLogout($authority)
Marks the user as logged out.
Definition: Session.php:663
$data
Definition: bench.php:6
terminateAssociation($idp, $associationId)
Remove an SP association for an IdP.
Definition: Session.php:1116