diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-03-10 11:37:59 +0100 |
---|---|---|
committer | Vincent Petry (Rebase PR Action) <PVince81@users.noreply.github.com> | 2022-12-05 16:10:55 +0000 |
commit | 3ebf7b818be06f61893b2443bb50f2c556525f2c (patch) | |
tree | 2940e8d52771a36fbb5ef0c009ef071c99ecae2a | |
parent | e4735ea5801d26f38422724086809856525c07c3 (diff) | |
download | nextcloud-server-3ebf7b818be06f61893b2443bb50f2c556525f2c.tar.gz nextcloud-server-3ebf7b818be06f61893b2443bb50f2c556525f2c.zip |
Rotate token after fallback
Signed-off-by: Julius Härtl <jus@bitgrid.net>
(cherry picked from commit 553cb499b2abf51b1edd9b2deb309cec6cff35b6)
-rw-r--r-- | lib/private/Authentication/Token/PublicKeyTokenProvider.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php index 5ccfe3f107f..ecc3fe23596 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php +++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php @@ -119,8 +119,14 @@ class PublicKeyTokenProvider implements IProvider { $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); + try { + $token = $this->mapper->getToken($this->hashTokenWithEmptySecret($tokenId)); + $this->cache[$token->getToken()] = $token; + $this->rotate($token, $tokenId, $tokenId); + } catch (DoesNotExistException $ex2) { + $this->cache[$tokenHash] = $ex2; + throw new InvalidTokenException("Token does not exist: " . $ex->getMessage(), 0, $ex); + } } } |