17 $tableVer =
$store->getTableVersion(
'saml_LogoutStore');
18 if ($tableVer === 2) {
20 } elseif ($tableVer === 1) {
25 $query =
'ALTER TABLE ' .
$store->prefix .
'_saml_LogoutStore ALTER COLUMN _authSource TYPE VARCHAR(255)';
28 $query =
'ALTER TABLE ' .
$store->prefix .
'_saml_LogoutStore MODIFY _authSource VARCHAR(255) NOT NULL';
34 }
catch (Exception $e) {
38 $store->setTableVersion(
'saml_LogoutStore', 2);
42 $query =
'CREATE TABLE ' .
$store->prefix .
'_saml_LogoutStore (
43 _authSource VARCHAR(255) NOT NULL,
44 _nameId VARCHAR(40) NOT NULL,
45 _sessionIndex VARCHAR(50) NOT NULL,
46 _expire TIMESTAMP NOT NULL,
47 _sessionId VARCHAR(50) NOT NULL,
48 UNIQUE (_authSource, _nameID, _sessionIndex)
52 $query =
'CREATE INDEX ' .
$store->prefix .
'_saml_LogoutStore_expire ON ' .
$store->prefix .
'_saml_LogoutStore (_expire)';
55 $query =
'CREATE INDEX ' .
$store->prefix .
'_saml_LogoutStore_nameId ON ' .
$store->prefix .
'_saml_LogoutStore (_authSource, _nameId)';
58 $store->setTableVersion(
'saml_LogoutStore', 2);
71 $query =
'DELETE FROM ' .
$store->prefix .
'_saml_LogoutStore WHERE _expire < :now';
72 $params = array(
'now' => gmdate(
'Y-m-d H:i:s'));
89 assert(is_string($authId));
92 assert(is_string($sessionId));
97 if (rand(0, 1000) < 10) {
102 '_authSource' => $authId,
105 '_expire' => gmdate(
'Y-m-d H:i:s',
$expire),
106 '_sessionId' => $sessionId,
108 $store->insertOrUpdate(
$store->prefix .
'_saml_LogoutStore', array(
'_authSource',
'_nameId',
'_sessionIndex'),
$data);
122 assert(is_string($authId));
128 '_authSource' => $authId,
130 'now' => gmdate(
'Y-m-d H:i:s'),
134 $query =
'SELECT _sessionIndex AS _sessionindex, _sessionId AS _sessionid FROM ' .
$store->prefix .
'_saml_LogoutStore' .
135 ' WHERE _authSource = :_authSource AND _nameId = :_nameId AND _expire >= :now';
140 while ( (
$row =
$query->fetch(PDO::FETCH_ASSOC)) !==
false) {
159 assert(is_string($authId));
165 if ($sessionId ===
null) {
168 assert(is_string($sessionId));
191 assert(is_string($authId));
215 $strNameId = serialize(
$nameId);
216 $strNameId = sha1($strNameId);
224 $sessionId =
$session->getSessionId();
242 public static function logoutSessions($authId,
$nameId, array $sessionIndexes)
244 assert(is_string($authId));
257 $strNameId = serialize(
$nameId);
258 $strNameId = sha1($strNameId);
271 } elseif (empty($sessionIndexes)) {
280 if (empty($sessionIndexes)) {
281 $sessionIndexes = array_keys($sessions);
309 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 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