diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-02-22 11:48:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 11:48:55 +0100 |
commit | 26990666cb67356e9361b4a57a5da9ab8e846461 (patch) | |
tree | 6720557e3140183a28465a93ac2b92204c68054b | |
parent | 209c94d86587a287e5708a1903b83dd0a484398a (diff) | |
parent | ee0ed229e326eaf97828e1fc4d09c7b5bdf7a765 (diff) | |
download | nextcloud-server-26990666cb67356e9361b4a57a5da9ab8e846461.tar.gz nextcloud-server-26990666cb67356e9361b4a57a5da9ab8e846461.zip |
Merge pull request #31298 from nextcloud/backport/31217/stable22
[stable22] Also cache non-existing to reuse it
-rw-r--r-- | lib/private/Authentication/Token/PublicKeyTokenProvider.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php index c2af5de8a03..00139b14166 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php +++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php @@ -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); } } |