aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2022-02-21 11:50:40 +0100
committerGitHub <noreply@github.com>2022-02-21 11:50:40 +0100
commit87115d8b1ca79880430d37b45167f260547daa41 (patch)
tree5ec9d53f148a628719f08257fafe7efea4f20d72
parentd721339262d4f58d3828fd6b2a3faa147c82779a (diff)
parent397b9098e8be4d49473a07263a1bbd0a8836300f (diff)
downloadnextcloud-server-87115d8b1ca79880430d37b45167f260547daa41.tar.gz
nextcloud-server-87115d8b1ca79880430d37b45167f260547daa41.zip
Merge pull request #31217 from nextcloud/bugfix/noid/also-cache-non-existing-entry
Also cache non-existing to reuse it
-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 04781457a7a..d2ee47cf380 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);
}
}