summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2022-02-22 11:49:16 +0100
committerGitHub <noreply@github.com>2022-02-22 11:49:16 +0100
commit69e73cbdab6ba1c3ad8aab61e801c54accd0cfb9 (patch)
tree3a8576438b5ec706050f442a9ee7a95f825d7524 /lib/private
parent8415ccaf07dd9198fa85ca2daeb34c4e7106c6e7 (diff)
parent3df6208537fefd63ff81fd29ca756bd5378c7f8a (diff)
downloadnextcloud-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.php5
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);
}
}