ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SessionHandler.php
Go to the documentation of this file.
1<?php
2
15namespace SimpleSAML;
16
17abstract class SessionHandler
18{
19
20
28 protected static $sessionHandler = null;
29
30
38 public static function getSessionHandler()
39 {
40 if (self::$sessionHandler === null) {
41 self::createSessionHandler();
42 }
43
44 return self::$sessionHandler;
45 }
46
47
53 protected function __construct()
54 {
55 }
56
57
63 abstract public function newSessionId();
64
65
71 abstract public function getCookieSessionId();
72
73
79 abstract public function getSessionCookieName();
80
81
87 abstract public function saveSession(\SimpleSAML_Session $session);
88
89
97 abstract public function loadSession($sessionId = null);
98
99
107 abstract public function hasSessionCookie();
108
109
119 abstract public function setCookie($sessionName, $sessionID, array $cookieParams = null);
120
121
130 private static function createSessionHandler()
131 {
133 if ($store === false) {
134 self::$sessionHandler = new SessionHandlerPHP();
135 } else {
137 self::$sessionHandler = new SessionHandlerStore($store);
138 }
139 }
140
141
148 public function getCookieParams()
149 {
151
152 return array(
153 'lifetime' => $config->getInteger('session.cookie.lifetime', 0),
154 'path' => $config->getString('session.cookie.path', '/'),
155 'domain' => $config->getString('session.cookie.domain', null),
156 'secure' => $config->getBoolean('session.cookie.secure', false),
157 'httponly' => true,
158 );
159 }
160}
An exception for terminatinating execution or to throw for unit testing.
getCookieSessionId()
Retrieve the session ID saved in the session cookie, if there's one.
static getSessionHandler()
This function retrieves the current instance of the session handler.
getSessionCookieName()
Retrieve the session cookie name.
getCookieParams()
Get the cookie parameters that should be used for session cookies.
__construct()
This constructor is included in case it is needed in the future.
loadSession($sessionId=null)
Load the session.
hasSessionCookie()
Check whether the session cookie is set.
setCookie($sessionName, $sessionID, array $cookieParams=null)
Set a session cookie.
saveSession(\SimpleSAML_Session $session)
Save the session.
newSessionId()
Create a new session id.
static getInstance()
Retrieve our singleton instance.
Definition: Store.php:31
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
if(! $oauthconfig->getBoolean('getUserInfo.enable', FALSE)) $store
Definition: getUserInfo.php:11
$config
Definition: bootstrap.php:15
Attribute-related utility methods.
$session
$sessionID