diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-02-22 11:49:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 11:49:16 +0100 |
commit | 69e73cbdab6ba1c3ad8aab61e801c54accd0cfb9 (patch) | |
tree | 3a8576438b5ec706050f442a9ee7a95f825d7524 /lib/private | |
parent | 8415ccaf07dd9198fa85ca2daeb34c4e7106c6e7 (diff) | |
parent | 3df6208537fefd63ff81fd29ca756bd5378c7f8a (diff) | |
download | nextcloud-server-69e73cbdab6ba1c3ad8aab61e801c54accd0cfb9.tar.gz nextcloud-server-69e73cbdab6ba1c3ad8aab61e801c54accd0cfb9.zip |
Merge pull request #31297 from nextcloud/backport/31217/stable23
[stable23] Also cache non-existing to reuse it
Diffstat (limited to 'lib/private')
-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 b9cfce6c869..b7c8a8e9c24 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); } } |