Beispiel #1
0
 public function deleteStateForContext($clientConfigId, Context $context)
 {
     $stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE client_config_id = :client_config_id AND user_id = :user_id', $this->prefix . 'states'));
     $stmt->bindValue(':client_config_id', $clientConfigId, PDO::PARAM_STR);
     $stmt->bindValue(':user_id', $context->getUserId(), PDO::PARAM_STR);
     $stmt->execute();
     return 1 === $stmt->rowCount();
 }
 public function deleteStateForContext($clientConfigId, Context $context)
 {
     try {
         $state_cache = \Cache::get('php-oauth-client.state.' . $this->cacheId);
     } catch (\CacheNotFoundException $e) {
         return false;
     }
     foreach ($state_cache as $k => $s) {
         $sessionState = unserialize($s);
         if ($clientConfigId !== $sessionState->getClientConfigId()) {
             continue;
         }
         if ($context->getUserId() !== $sessionState->getUserId()) {
             continue;
         }
         unset($state_cache[$k]);
         \Cache::set('php-oauth-client.state.' . $this->cacheId, $state_cache, null);
         return true;
     }
     return false;
 }