diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-03-10 11:37:59 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2022-03-10 14:01:21 +0100 |
commit | 553cb499b2abf51b1edd9b2deb309cec6cff35b6 (patch) | |
tree | 0947d4470d5d80488536c7b9a9aa39da9124c80e /lib/private/Authentication | |
parent | 81f8719cc0fdc2fc25a00ac1412ffc63cd62eabf (diff) | |
download | nextcloud-server-553cb499b2abf51b1edd9b2deb309cec6cff35b6.tar.gz nextcloud-server-553cb499b2abf51b1edd9b2deb309cec6cff35b6.zip |
Rotate token after fallback
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/Authentication')
-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 7f360b90b23..3a6558df0d6 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php +++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php @@ -107,8 +107,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); + } } } |