]> source.dussan.org Git - nextcloud-server.git/commitdiff
Also cache non-existing to reuse it 31217/head
authorJoas Schilling <coding@schilljs.com>
Wed, 16 Feb 2022 15:51:22 +0000 (16:51 +0100)
committerJoas Schilling <coding@schilljs.com>
Wed, 16 Feb 2022 15:51:22 +0000 (16:51 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Authentication/Token/PublicKeyTokenProvider.php

index 04781457a7a864115745df644951cb81c9d88ae6..d2ee47cf38051c3a0e5091b85c601dfd4ed7a517 100644 (file)
@@ -97,12 +97,17 @@ class PublicKeyTokenProvider implements IProvider {
                $tokenHash = $this->hashToken($tokenId);
 
                if (isset($this->cache[$tokenHash])) {
+                       if ($this->cache[$tokenHash] instanceof DoesNotExistException) {
+                               $ex = $this->cache[$tokenHash];
+                               throw new InvalidTokenException("Token does not exist: " . $ex->getMessage(), 0, $ex);
+                       }
                        $token = $this->cache[$tokenHash];
                } else {
                        try {
                                $token = $this->mapper->getToken($this->hashToken($tokenId));
                                $this->cache[$token->getToken()] = $token;
                        } catch (DoesNotExistException $ex) {
+                               $this->cache[$tokenHash] = $ex;
                                throw new InvalidTokenException("Token does not exist: " . $ex->getMessage(), 0, $ex);
                        }
                }