From f2b6ecb373dcb8984b78b244f7796edbf673f2d4 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Tue, 30 Apr 2019 09:51:21 +1200 Subject: [PATCH] Remove breakage on user-agent changing --- src/Authentication/JWTAuthenticator.php | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/Authentication/JWTAuthenticator.php b/src/Authentication/JWTAuthenticator.php index fc23f3e..4d3b31b 100644 --- a/src/Authentication/JWTAuthenticator.php +++ b/src/Authentication/JWTAuthenticator.php @@ -283,7 +283,8 @@ public function validateToken(string $token, HTTPrequest $request): array } // Find local record for this token - $record = $this->findTokenRecord($parsedToken, $request); + /** @var JWTRecord $record */ + $record = JWTRecord::get()->byID($parsedToken->getClaim('rid')); if (!$record) { return [null, TokenStatusEnum::STATUS_INVALID]; } @@ -336,23 +337,6 @@ protected function parseToken(string $token): ?Token return $verified ? $parsedToken : null; } - /** - * Given a parsed Token, find the matching JWTRecord dataobject - * - * @param Token $parsedToken - * @param HTTPRequest $request - * @return JWTRecord|null - */ - protected function findTokenRecord(Token $parsedToken, HTTPrequest $request): ?JWTRecord - { - $userAgent = $request->getHeader('User-Agent'); - /** @var JWTRecord $record */ - $record = JWTRecord::get() - ->filter(['UserAgent' => $userAgent]) - ->byID($parsedToken->getClaim('rid')); - return $record; - } - /** * Determine if the given token is current, given the context of the current request *