17 $tableVer =
$store->getTableVersion(
'saml_LogoutStore');
18 if ($tableVer === 2) {
20 } elseif ($tableVer === 1) {
22 $query =
'ALTER TABLE ' .
$store->prefix .
'_saml_LogoutStore MODIFY _authSource VARCHAR(255) NOT NULL';
25 }
catch (Exception $e) {
29 $store->setTableVersion(
'saml_LogoutStore', 2);
33 $query =
'CREATE TABLE ' .
$store->prefix .
'_saml_LogoutStore (
34 _authSource VARCHAR(255) NOT NULL,
35 _nameId VARCHAR(40) NOT NULL,
36 _sessionIndex VARCHAR(50) NOT NULL,
37 _expire TIMESTAMP NOT NULL,
38 _sessionId VARCHAR(50) NOT NULL,
39 UNIQUE (_authSource, _nameID, _sessionIndex)
43 $query =
'CREATE INDEX ' .
$store->prefix .
'_saml_LogoutStore_expire ON ' .
$store->prefix .
'_saml_LogoutStore (_expire)';
46 $query =
'CREATE INDEX ' .
$store->prefix .
'_saml_LogoutStore_nameId ON ' .
$store->prefix .
'_saml_LogoutStore (_authSource, _nameId)';
49 $store->setTableVersion(
'saml_LogoutStore', 2);
62 $query =
'DELETE FROM ' .
$store->prefix .
'_saml_LogoutStore WHERE _expire < :now';
63 $params = array(
'now' => gmdate(
'Y-m-d H:i:s'));
79 assert(
'is_string($authId)');
80 assert(
'is_string($nameId)');
81 assert(
'is_string($sessionIndex)');
82 assert(
'is_string($sessionId)');
83 assert(
'is_int($expire)');
87 if (rand(0, 1000) < 10) {
92 '_authSource' => $authId,
95 '_expire' => gmdate(
'Y-m-d H:i:s',
$expire),
96 '_sessionId' => $sessionId,
98 $store->insertOrUpdate(
$store->prefix .
'_saml_LogoutStore', array(
'_authSource',
'_nameId',
'_sessionIndex'),
$data);
111 assert(
'is_string($authId)');
112 assert(
'is_string($nameId)');
117 '_authSource' => $authId,
119 'now' => gmdate(
'Y-m-d H:i:s'),
123 $query =
'SELECT _sessionIndex AS _sessionindex, _sessionId AS _sessionid FROM ' .
$store->prefix .
'_saml_LogoutStore' .
124 ' WHERE _authSource = :_authSource AND _nameId = :_nameId AND _expire >= :now';
129 while ( (
$row =
$query->fetch(PDO::FETCH_ASSOC)) !== FALSE) {
147 assert(
'is_string($authId)');
148 assert(
'is_string($nameId)');
153 if ($sessionId === NULL) {
156 assert(
'is_string($sessionId)');
178 assert(
'is_string($authId)');
179 assert(
'is_string($sessionIndex) || is_null($sessionIndex)');
180 assert(
'is_int($expire)');
202 $strNameId = serialize(
$nameId);
203 $strNameId = sha1($strNameId);
211 $sessionId =
$session->getSessionId();
229 public static function logoutSessions($authId,
$nameId, array $sessionIndexes) {
230 assert(
'is_string($authId)');
243 $strNameId = serialize(
$nameId);
244 $strNameId = sha1($strNameId);
248 assert(
'is_string($sessionIndex)');
257 } elseif (empty($sessionIndexes)) {
266 if (empty($sessionIndexes)) {
267 $sessionIndexes = array_keys($sessions);
297 return $numLoggedOut;
An exception for terminatinating execution or to throw for unit testing.
static fromArray(array $nameId)
Create a \SAML2\XML\saml\NameID object from an array with its contents.
static getSessionHandler()
This function retrieves the current instance of the session handler.
static getInstance()
Retrieve our singleton instance.
static generateID()
Generate a random identifier, ID_LENGTH bytes long.
static getSession($sessionId=null)
Get a session from the session handler.
static getSessionFromRequest()
Retrieves the current session.
static addSession($authId, $nameId, $sessionIndex, $expire)
Register a new session in the datastore.
static cleanLogoutStore(\SimpleSAML\Store\SQL $store)
Clean the logout table of expired entries.
static addSessionSQL(\SimpleSAML\Store\SQL $store, $authId, $nameId, $sessionIndex, $expire, $sessionId)
Register a session in the SQL datastore.
static getSessionsSQL(\SimpleSAML\Store\SQL $store, $authId, $nameId)
Retrieve sessions from the SQL datastore.
static getSessionsStore(\SimpleSAML\Store $store, $authId, $nameId, array $sessionIndexes)
Retrieve all session IDs from a key-value store.
static createLogoutTable(\SimpleSAML\Store\SQL $store)
Create logout table in SQL, if it is missing.
if(! $oauthconfig->getBoolean('getUserInfo.enable', FALSE)) $store
Attribute-related utility methods.
foreach($_POST as $key=> $value) $res