ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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;
135 
136 
143  private function __construct($transient = false)
144  {
145  $this->authData = array();
146 
147  if (php_sapi_name() === 'cli' || defined('STDIN')) {
148  $this->trackid = 'CL'.bin2hex(openssl_random_pseudo_bytes(4));
149  SimpleSAML\Logger::setTrackId($this->trackid);
150  $this->transient = $transient;
151  return;
152  }
153 
154  if ($transient) { // transient session
156  $this->trackid = 'TR'.bin2hex(openssl_random_pseudo_bytes(4));
157  SimpleSAML\Logger::setTrackId($this->trackid);
158  $this->transient = true;
159 
160  /*
161  * Initialize the session ID. It might be that we have a session cookie but we couldn't load the session.
162  * If that's the case, use that ID. If not, create a new ID.
163  */
164  $this->sessionId = $sh->getCookieSessionId();
165  if ($this->sessionId === null) {
166  $this->sessionId = $sh->newSessionId();
167  }
168  } else { // regular session
170  $this->sessionId = $sh->newSessionId();
171  $sh->setCookie($sh->getSessionCookieName(), $this->sessionId, $sh->getCookieParams());
172 
173 
174  $this->trackid = bin2hex(openssl_random_pseudo_bytes(5));
175  SimpleSAML\Logger::setTrackId($this->trackid);
176 
177  $this->markDirty();
178 
179  // initialize data for session check function if defined
181  $checkFunction = $globalConfig->getArray('session.check_function', null);
182  if (isset($checkFunction)) {
183  assert('is_callable($checkFunction)');
184  call_user_func($checkFunction, $this, true);
185  }
186  }
187  }
188 
189 
197  public function serialize()
198  {
199  $serialized = serialize(get_object_vars($this));
200  return $serialized;
201  }
202 
203 
212  public function unserialize($serialized)
213  {
214  $session = unserialize($serialized);
215  if (is_array($session)) {
216  foreach ($session as $k => $v) {
217  $this->$k = $v;
218  }
219  }
220 
221  // look for any raw attributes and load them in the 'Attributes' array
222  foreach ($this->authData as $authority => $parameters) {
223  if (!array_key_exists('RawAttributes', $parameters)) {
224  continue;
225  }
226 
227  foreach ($parameters['RawAttributes'] as $attribute => $values) {
228  foreach ($values as $idx => $value) { // this should be originally a DOMNodeList
229  /* @var \SAML2\XML\saml\AttributeValue $value */
230  $this->authData[$authority]['Attributes'][$attribute][$idx] = $value->element->childNodes;
231  }
232  }
233  }
234  }
235 
236 
243  public static function getSessionFromRequest()
244  {
245  // check if we already have initialized the session
246  if (isset(self::$instance)) {
247  return self::$instance;
248  }
249 
250  // check if we have stored a session stored with the session handler
251  $session = null;
252  try {
253  $session = self::getSession();
254  } catch (Exception $e) {
255  /*
256  * For some reason, we were unable to initialize this session. Note that this error might be temporary, and
257  * it's possible that we can recover from it in subsequent requests, so we should not try to create a new
258  * session here. Therefore, use just a transient session and throw the exception for someone else to handle
259  * it.
260  */
261  SimpleSAML\Logger::error('Error loading session: '.$e->getMessage());
262  self::useTransientSession();
263  if ($e instanceof SimpleSAML_Error_Exception) {
264  $cause = $e->getCause();
265  if ($cause instanceof Exception) {
266  throw $cause;
267  }
268  }
269  throw $e;
270  }
271 
272  // if getSession() found it, use it
273  if ($session instanceof SimpleSAML_Session) {
274  return self::load($session);
275  }
276 
277  /*
278  * We didn't have a session loaded when we started, but we have it now. At this point, getSession() failed but
279  * it must have triggered the creation of a session at some point during the process (e.g. while logging an
280  * error message). This means we don't need to create a new session again, we can use the one that's loaded now
281  * instead.
282  */
283  if (self::$instance !== null) {
284  return self::$instance;
285  }
286 
287  // try to create a new session
288  try {
289  self::load(new SimpleSAML_Session());
290  } catch (\SimpleSAML\Error\CannotSetCookie $e) {
291  // can't create a regular session because we can't set cookies. Use transient.
293  self::useTransientSession();
294 
295  if ($e->getCode() === \SimpleSAML\Error\CannotSetCookie::SECURE_COOKIE) {
296  throw new \SimpleSAML\Error\CriticalConfigurationError(
297  $e->getMessage(),
298  null,
299  $c->toArray()
300  );
301  }
302  SimpleSAML\Logger::error('Error creating session: '.$e->getMessage());
303  }
304 
305  // we must have a session now, either regular or transient
306  return self::$instance;
307  }
308 
317  public static function getSession($sessionId = null)
318  {
319  assert('is_string($sessionId) || is_null($sessionId)');
320 
322 
323  if ($sessionId === null) {
324  $checkToken = true;
325  $sessionId = $sh->getCookieSessionId();
326  if ($sessionId === null) {
327  return null;
328  }
329  } else {
330  $checkToken = false;
331  }
332 
333  if (array_key_exists($sessionId, self::$sessions)) {
334  return self::$sessions[$sessionId];
335  }
336 
337  $session = $sh->loadSession($sessionId);
338  if ($session === null) {
339  return null;
340  }
341 
342  assert('$session instanceof self');
343 
344  if ($checkToken) {
346 
347  if ($session->authToken !== null) {
348  $authTokenCookieName = $globalConfig->getString(
349  'session.authtoken.cookiename',
350  'SimpleSAMLAuthToken'
351  );
352  if (!isset($_COOKIE[$authTokenCookieName])) {
353  SimpleSAML\Logger::warning('Missing AuthToken cookie.');
354  return null;
355  }
356  if (!SimpleSAML\Utils\Crypto::secureCompare($session->authToken, $_COOKIE[$authTokenCookieName])) {
357  SimpleSAML\Logger::warning('Invalid AuthToken cookie.');
358  return null;
359  }
360  }
361 
362  // run session check function if defined
363  $checkFunction = $globalConfig->getArray('session.check_function', null);
364  if (isset($checkFunction)) {
365  assert('is_callable($checkFunction)');
366  $check = call_user_func($checkFunction, $session);
367  if ($check !== true) {
368  SimpleSAML\Logger::warning('Session did not pass check function.');
369  return null;
370  }
371  }
372  }
373 
374  self::$sessions[$sessionId] = $session;
375 
376  return $session;
377  }
378 
379 
390  private static function load(SimpleSAML_Session $session)
391  {
393  self::$instance = $session;
394  return self::$instance;
395  }
396 
403  public static function useTransientSession()
404  {
405  if (isset(self::$instance)) {
406  // we already have a session, don't bother with a transient session
407  return;
408  }
409 
410  self::load(new SimpleSAML_Session(true));
411  }
412 
418  public static function createSession($sessionId)
419  {
420  assert('is_string($sessionId)');
421  self::$sessions[$sessionId] = null;
422  }
423 
432  public function save()
433  {
434  if (!$this->dirty) {
435  // session hasn't changed, don't bother saving it
436  return;
437  }
438 
439  $this->dirty = false;
440  $this->callback_registered = false;
441 
443 
444  try {
445  $sh->saveSession($this);
446  } catch (Exception $e) {
447  if (!($e instanceof SimpleSAML_Error_Exception)) {
449  }
450  SimpleSAML\Logger::error('Unable to save session.');
451  $e->logError();
452  }
453  }
454 
455 
462  public function cleanup()
463  {
464  $this->save();
466  if ($sh instanceof \SimpleSAML\SessionHandlerPHP) {
467  $sh->restorePrevious();
468  }
469  }
470 
471 
477  public function markDirty()
478  {
479  if ($this->isTransient()) {
480  return;
481  }
482 
483  $this->dirty = true;
484 
485  if (!function_exists('header_register_callback')) {
486  // PHP version < 5.4, can't register the callback
487  return;
488  }
489 
490  if ($this->callback_registered) {
491  // we already have a shutdown callback registered for this object, no need to add another one
492  return;
493  }
494  $this->callback_registered = header_register_callback(array($this, 'save'));
495  }
496 
497 
504  public function __destruct()
505  {
506  $this->save();
507  }
508 
514  public function getSessionId()
515  {
516  return $this->sessionId;
517  }
518 
524  public function isTransient()
525  {
526  return $this->transient;
527  }
528 
535  public function getTrackID()
536  {
537  return $this->trackid;
538  }
539 
545  public function getRememberMeExpire()
546  {
548  }
549 
555  public function setRememberMeExpire($expire = null)
556  {
557  assert('is_int($expire) || is_null($expire)');
558 
559  if ($expire === null) {
561  $expire = time() + $globalConfig->getInteger('session.rememberme.lifetime', 14 * 86400);
562  }
563  $this->rememberMeExpire = $expire;
564 
565  $cookieParams = array('expire' => $this->rememberMeExpire);
566  $this->updateSessionCookies($cookieParams);
567  }
568 
579  public function doLogin($authority, array $data = null)
580  {
581  assert('is_string($authority)');
582  assert('is_array($data) || is_null($data)');
583 
584  SimpleSAML\Logger::debug('Session: doLogin("'.$authority.'")');
585 
586  $this->markDirty();
587 
588  if (isset($this->authData[$authority])) {
589  // we are already logged in, log the user out first
590  $this->doLogout($authority);
591  }
592 
593  if ($data === null) {
594  $data = array();
595  }
596 
597  $data['Authority'] = $authority;
598 
600  if (!isset($data['AuthnInstant'])) {
601  $data['AuthnInstant'] = time();
602  }
603 
604  $maxSessionExpire = time() + $globalConfig->getInteger('session.duration', 8 * 60 * 60);
605  if (!isset($data['Expire']) || $data['Expire'] > $maxSessionExpire) {
606  // unset, or beyond our session lifetime. Clamp it to our maximum session lifetime
607  $data['Expire'] = $maxSessionExpire;
608  }
609 
610  // check if we have non-serializable attribute values
611  foreach ($data['Attributes'] as $attribute => $values) {
612  foreach ($values as $idx => $value) {
613  if (is_string($value) || is_int($value)) {
614  continue;
615  }
616 
617  // at this point, this should be a DOMNodeList object...
618  if (!is_a($value, 'DOMNodeList')) {
619  continue;
620  }
621 
622  /* @var \DOMNodeList $value */
623  if ($value->length === 0) {
624  continue;
625  }
626 
627  // create an AttributeValue object and save it to 'RawAttributes', using same attribute name and index
628  $attrval = new \SAML2\XML\saml\AttributeValue($value->item(0)->parentNode);
629  $data['RawAttributes'][$attribute][$idx] = $attrval;
630  }
631  }
632 
633  $this->authData[$authority] = $data;
634 
635  $this->authToken = SimpleSAML\Utils\Random::generateID();
637 
638  if (!$this->transient && (!empty($data['RememberMe']) || $this->rememberMeExpire) &&
639  $globalConfig->getBoolean('session.rememberme.enable', false)
640  ) {
641 
642  $this->setRememberMeExpire();
643  } else {
644  try {
646  $globalConfig->getString('session.authtoken.cookiename', 'SimpleSAMLAuthToken'),
648  $sessionHandler->getCookieParams()
649  );
650  } catch (SimpleSAML\Error\CannotSetCookie $e) {
651  /*
652  * Something went wrong when setting the auth token. We cannot recover from this, so we better log a
653  * message and throw an exception. The user is not properly logged in anyway, so clear all login
654  * information from the session.
655  */
656  unset($this->authToken);
657  unset($this->authData[$authority]);
658  \SimpleSAML\Logger::error('Cannot set authentication token cookie: '.$e->getMessage());
659  throw $e;
660  }
661  }
662  }
663 
671  public function doLogout($authority)
672  {
673  SimpleSAML\Logger::debug('Session: doLogout('.var_export($authority, true).')');
674 
675  if (!isset($this->authData[$authority])) {
676  SimpleSAML\Logger::debug('Session: Already logged out of '.$authority.'.');
677  return;
678  }
679 
680  $this->markDirty();
681 
682  $this->callLogoutHandlers($authority);
683  unset($this->authData[$authority]);
684 
685  if (!$this->isValid($authority) && $this->rememberMeExpire) {
686  $this->rememberMeExpire = null;
687  $this->updateSessionCookies();
688  }
689  }
690 
698  private function callLogoutHandlers($authority)
699  {
700  assert('is_string($authority)');
701  assert('isset($this->authData[$authority])');
702 
703  if (empty($this->authData[$authority]['LogoutHandlers'])) {
704  return;
705  }
706  foreach ($this->authData[$authority]['LogoutHandlers'] as $handler) {
707  // verify that the logout handler is a valid function
708  if (!is_callable($handler)) {
709  $classname = $handler[0];
710  $functionname = $handler[1];
711 
712  throw new Exception(
713  'Logout handler is not a valid function: '.$classname.'::'.
714  $functionname
715  );
716  }
717 
718  // call the logout handler
719  call_user_func($handler);
720  }
721 
722  // we require the logout handlers to register themselves again if they want to be called later
723  unset($this->authData[$authority]['LogoutHandlers']);
724  }
725 
734  public function isValid($authority)
735  {
736  assert('is_string($authority)');
737 
738  if (!isset($this->authData[$authority])) {
740  'Session: '.var_export($authority, true).
741  ' not valid because we are not authenticated.'
742  );
743  return false;
744  }
745 
746  if ($this->authData[$authority]['Expire'] <= time()) {
747  SimpleSAML\Logger::debug('Session: '.var_export($authority, true).' not valid because it is expired.');
748  return false;
749  }
750 
751  SimpleSAML\Logger::debug('Session: Valid session found with '.var_export($authority, true).'.');
752 
753  return true;
754  }
755 
761  public function updateSessionCookies($params = null)
762  {
764 
765  if ($this->sessionId !== null) {
766  $sessionHandler->setCookie($sessionHandler->getSessionCookieName(), $this->sessionId, $params);
767  }
768 
769  if ($this->authToken !== null) {
772  $globalConfig->getString('session.authtoken.cookiename', 'SimpleSAMLAuthToken'),
774  $params
775  );
776  }
777  }
778 
785  public function setAuthorityExpire($authority, $expire = null)
786  {
787  assert('isset($this->authData[$authority])');
788  assert('is_int($expire) || is_null($expire)');
789 
790  $this->markDirty();
791 
792  if ($expire === null) {
794  $expire = time() + $globalConfig->getInteger('session.duration', 8 * 60 * 60);
795  }
796 
797  $this->authData[$authority]['Expire'] = $expire;
798  }
799 
809  public function registerLogoutHandler($authority, $classname, $functionname)
810  {
811  assert('isset($this->authData[$authority])');
812 
813  $logout_handler = array($classname, $functionname);
814 
815  if (!is_callable($logout_handler)) {
816  throw new Exception(
817  'Logout handler is not a vaild function: '.$classname.'::'.
818  $functionname
819  );
820  }
821 
822  $this->authData[$authority]['LogoutHandlers'][] = $logout_handler;
823  $this->markDirty();
824  }
825 
834  public function deleteData($type, $id)
835  {
836  assert('is_string($type)');
837  assert('is_string($id)');
838 
839  if (!is_array($this->dataStore)) {
840  return;
841  }
842 
843  if (!array_key_exists($type, $this->dataStore)) {
844  return;
845  }
846 
847  unset($this->dataStore[$type][$id]);
848  $this->markDirty();
849  }
850 
867  public function setData($type, $id, $data, $timeout = null)
868  {
869  assert('is_string($type)');
870  assert('is_string($id)');
871  assert('is_int($timeout) || is_null($timeout) || $timeout === self::DATA_TIMEOUT_SESSION_END');
872 
873  // clean out old data
874  $this->expireData();
875 
876  if ($timeout === null) {
877  // use the default timeout
878  $configuration = SimpleSAML_Configuration::getInstance();
879 
880  $timeout = $configuration->getInteger('session.datastore.timeout', null);
881  if ($timeout !== null) {
882  if ($timeout <= 0) {
883  throw new Exception(
884  'The value of the session.datastore.timeout'.
885  ' configuration option should be a positive integer.'
886  );
887  }
888  }
889  }
890 
891  if ($timeout === self::DATA_TIMEOUT_SESSION_END) {
892  $expires = self::DATA_TIMEOUT_SESSION_END;
893  } else {
894  $expires = time() + $timeout;
895  }
896 
897  $dataInfo = array(
898  'expires' => $expires,
899  'timeout' => $timeout,
900  'data' => $data
901  );
902 
903  if (!is_array($this->dataStore)) {
904  $this->dataStore = array();
905  }
906 
907  if (!array_key_exists($type, $this->dataStore)) {
908  $this->dataStore[$type] = array();
909  }
910 
911  $this->dataStore[$type][$id] = $dataInfo;
912 
913  $this->markDirty();
914  }
915 
923  private function expireData()
924  {
925  if (!is_array($this->dataStore)) {
926  return;
927  }
928 
929  $ct = time();
930 
931  foreach ($this->dataStore as &$typedData) {
932  foreach ($typedData as $id => $info) {
933  if ($info['expires'] === self::DATA_TIMEOUT_SESSION_END) {
934  // this data never expires
935  continue;
936  }
937 
938  if ($ct > $info['expires']) {
939  unset($typedData[$id]);
940  }
941  }
942  }
943  }
944 
956  public function getData($type, $id)
957  {
958  assert('is_string($type)');
959  assert('$id === null || is_string($id)');
960 
961  if ($id === null) {
962  return null;
963  }
964 
965  $this->expireData();
966 
967  if (!is_array($this->dataStore)) {
968  return null;
969  }
970 
971  if (!array_key_exists($type, $this->dataStore)) {
972  return null;
973  }
974 
975  if (!array_key_exists($id, $this->dataStore[$type])) {
976  return null;
977  }
978 
979  return $this->dataStore[$type][$id]['data'];
980  }
981 
995  public function getDataOfType($type)
996  {
997  assert('is_string($type)');
998 
999  if (!is_array($this->dataStore)) {
1000  return array();
1001  }
1002 
1003  if (!array_key_exists($type, $this->dataStore)) {
1004  return array();
1005  }
1006 
1007  $ret = array();
1008  foreach ($this->dataStore[$type] as $id => $info) {
1009  $ret[$id] = $info['data'];
1010  }
1011 
1012  return $ret;
1013  }
1014 
1022  public function getAuthState($authority)
1023  {
1024  assert('is_string($authority)');
1025 
1026  if (!isset($this->authData[$authority])) {
1027  return null;
1028  }
1029 
1030  return $this->authData[$authority];
1031  }
1032 
1033 
1041  public function hasSessionCookie()
1042  {
1044  return $sh->hasSessionCookie();
1045  }
1046 
1047 
1057  {
1058  assert('is_string($idp)');
1059  assert('isset($association["id"])');
1060  assert('isset($association["Handler"])');
1061 
1062  if (!isset($this->associations)) {
1063  $this->associations = array();
1064  }
1065 
1066  if (!isset($this->associations[$idp])) {
1067  $this->associations[$idp] = array();
1068  }
1069 
1070  $this->associations[$idp][$association['id']] = $association;
1071 
1072  $this->markDirty();
1073  }
1074 
1075 
1085  public function getAssociations($idp)
1086  {
1087  assert('is_string($idp)');
1088 
1089  if (!isset($this->associations)) {
1090  $this->associations = array();
1091  }
1092 
1093  if (!isset($this->associations[$idp])) {
1094  return array();
1095  }
1096 
1097  foreach ($this->associations[$idp] as $id => $assoc) {
1098  if (!isset($assoc['Expires'])) {
1099  continue;
1100  }
1101  if ($assoc['Expires'] >= time()) {
1102  continue;
1103  }
1104 
1105  unset($this->associations[$idp][$id]);
1106  }
1107 
1108  return $this->associations[$idp];
1109  }
1110 
1111 
1120  public function terminateAssociation($idp, $associationId)
1121  {
1122  assert('is_string($idp)');
1123  assert('is_string($associationId)');
1124 
1125  if (!isset($this->associations)) {
1126  return;
1127  }
1128 
1129  if (!isset($this->associations[$idp])) {
1130  return;
1131  }
1132 
1133  unset($this->associations[$idp][$associationId]);
1134 
1135  $this->markDirty();
1136  }
1137 
1138 
1147  public function getAuthData($authority, $name)
1148  {
1149  assert('is_string($authority)');
1150  assert('is_string($name)');
1151 
1152  if (!isset($this->authData[$authority][$name])) {
1153  return null;
1154  }
1155  return $this->authData[$authority][$name];
1156  }
1157 
1158 
1165  public function getAuthorities()
1166  {
1167  $authorities = array();
1168  foreach (array_keys($this->authData) as $authority) {
1169  if ($this->isValid($authority)) {
1170  $authorities[] = $authority;
1171  }
1172  }
1173  return $authorities;
1174  }
1175 }
$params
Definition: disable.php:11
$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:514
$type
doLogin($authority, array $data=null)
Marks the user as logged in with the specified authority.
Definition: Session.php:579
setAuthorityExpire($authority, $expire=null)
Set the lifetime for authentication source.
Definition: Session.php:785
updateSessionCookies($params=null)
Update session cookies.
Definition: Session.php:761
getData($type, $id)
This function retrieves data from the data store.
Definition: Session.php:956
static createSession($sessionId)
Create a new session and cache it.
Definition: Session.php:418
deleteData($type, $id)
Delete data from the data store.
Definition: Session.php:834
static debug($string)
Definition: Logger.php:213
$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:734
expireData()
This function removes expired data from the data store.
Definition: Session.php:923
static getSession($sessionId=null)
Get a session from the session handler.
Definition: Session.php:317
serialize()
Serialize this session object.
Definition: Session.php:197
__destruct()
Destroy the session.
Definition: Session.php:504
cleanup()
Save the current session and clean any left overs that could interfere with the normal application be...
Definition: Session.php:462
getDataOfType($type)
This function retrieves all data of the specified type from the data store.
Definition: Session.php:995
static setTrackId($trackId)
Set the track identifier to use in all logs.
Definition: Logger.php:255
setRememberMeExpire($expire=null)
Set remember me expire time.
Definition: Session.php:555
Attribute-related utility methods.
if($format !==null) $name
Definition: metadata.php:146
hasSessionCookie()
Check whether the session cookie is set.
Definition: Session.php:1041
static setCookie($name, $value, $params=null, $throw=true)
Set a cookie.
Definition: HTTP.php:1107
getRememberMeExpire()
Get remember me expire time.
Definition: Session.php:545
markDirty()
Mark this session as dirty.
Definition: Session.php:477
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:179
getTrackID()
Get a unique ID that will be permanent for this session.
Definition: Session.php:535
static error($string)
Definition: Logger.php:168
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:390
Create styles array
The data for the language used.
static getSessionHandler()
This function retrieves the current instance of the session handler.
$globalConfig
save()
Save the session to the store.
Definition: Session.php:432
registerLogoutHandler($authority, $classname, $functionname)
This function registers a logout handler.
Definition: Session.php:809
unserialize($serialized)
Unserialize a session object and load it.
Definition: Session.php:212
isTransient()
Retrieve if session is transient.
Definition: Session.php:524
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:1165
getAuthData($authority, $name)
Retrieve authentication data.
Definition: Session.php:1147
__construct($transient=false)
Private constructor that restricts instantiation to either getSessionFromRequest() for the current se...
Definition: Session.php:143
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static useTransientSession()
Use a transient session.
Definition: Session.php:403
getAssociations($idp)
Retrieve the associations for an IdP.
Definition: Session.php:1085
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
$info
Definition: index.php:5
$authority
$handler
static getSessionFromRequest()
Retrieves the current session.
Definition: Session.php:243
addAssociation($idp, array $association)
Add an SP association for an IdP.
Definition: Session.php:1056
static $sessions
Definition: Session.php:36
setData($type, $id, $data, $timeout=null)
This function stores data in the data store.
Definition: Session.php:867
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
callLogoutHandlers($authority)
This function calls all registered logout handlers.
Definition: Session.php:698
getAuthState($authority)
Get the current persistent authentication state.
Definition: Session.php:1022
doLogout($authority)
Marks the user as logged out.
Definition: Session.php:671
terminateAssociation($idp, $associationId)
Remove an SP association for an IdP.
Definition: Session.php:1120