get() abstract public method

Retrieve a value from the data store.
abstract public get ( string $type, string $key ) : mixed | null
$type string The data type.
$key string The key.
return mixed | null The value.
 /**
  * Load a session from the data store.
  *
  * @param string|null $sessionId The ID of the session we should load, or null to use the default.
  *
  * @return SimpleSAML_Session|null The session object, or null if it doesn't exist.
  */
 public function loadSession($sessionId = null)
 {
     assert('is_string($sessionId) || is_null($sessionId)');
     if ($sessionId === null) {
         $sessionId = $this->getCookieSessionId();
     }
     $session = $this->store->get('session', $sessionId);
     if ($session !== null) {
         assert('$session instanceof SimpleSAML_Session');
         return $session;
     }
     return null;
 }
Exemplo n.º 2
0
 /**
  * Retrieve all session IDs from a key-value store.
  *
  * @param SimpleSAML_Store_SQL $store  The datastore.
  * @param string $authId  The authsource ID.
  * @param string $nameId  The hash of the users NameID.
  * @param array $sessionIndexes  The session indexes.
  * @return array  Associative array of SessionIndex =>  SessionId.
  */
 private static function getSessionsStore(SimpleSAML_Store $store, $authId, $nameId, array $sessionIndexes)
 {
     assert('is_string($authId)');
     assert('is_string($nameId)');
     $res = array();
     foreach ($sessionIndexes as $sessionIndex) {
         $sessionId = $store->get('saml.LogoutStore', $nameId . ':' . $sessionIndex);
         if ($sessionId === NULL) {
             continue;
         }
         assert('is_string($sessionId)');
         $res[$sessionIndex] = $sessionId;
     }
     return $res;
 }