From 7a1a5f7e8f15c70c9eebed4029b979b1ad0f2add Mon Sep 17 00:00:00 2001 From: kevinmrpvision Date: Fri, 1 Dec 2017 18:52:29 +0530 Subject: [PATCH] Delete SessionTokenStorage.php --- tests/SessionTokenStorage.php | 74 ----------------------------------- 1 file changed, 74 deletions(-) delete mode 100644 tests/SessionTokenStorage.php diff --git a/tests/SessionTokenStorage.php b/tests/SessionTokenStorage.php deleted file mode 100644 index f35a4a0..0000000 --- a/tests/SessionTokenStorage.php +++ /dev/null @@ -1,74 +0,0 @@ -. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -namespace Mrpvision\Gluu\Tests; - -use Mrpvision\Gluu\AccessToken; - -class SessionTokenStorage -{ - /** @var array */ - private $data; - - public function __construct() - { - $this->data = []; - } - - /** - * @param string $userId - * - * @return array - */ - public function getAccessTokenList($userId) - { - if (!array_key_exists(sprintf('_gluu_token_%s', $userId), $this->data)) { - return []; - } - - return $this->data[sprintf('_gluu_token_%s', $userId)]; - } - - /** - * @param string $userId - * @param AccessToken $accessToken - */ - public function storeAccessToken($userId, AccessToken $accessToken) - { - $this->data[sprintf('_gluu_token_%s', $userId)][] = $accessToken; - } - - /** - * @param string $userId - * @param AccessToken $accessToken - */ - public function deleteAccessToken($userId, AccessToken $accessToken) - { - foreach ($this->getAccessTokenList($userId) as $k => $v) { - if ($accessToken->getToken() === $v->getToken()) { - unset($_SESSION[sprintf('_gluu_token_%s', $userId)][$k]); - } - } - } -}