diff --git a/lib/private/Authentication/Token/Manager.php b/lib/private/Authentication/Token/Manager.php index 254a1598943d2..5fbf78eefd298 100644 --- a/lib/private/Authentication/Token/Manager.php +++ b/lib/private/Authentication/Token/Manager.php @@ -112,7 +112,9 @@ public function getTokenByUser(string $uid): array { public function getToken(string $tokenId): IToken { try { return $this->publicKeyTokenProvider->getToken($tokenId); - } catch (InvalidTokenException $e) { + } catch (ExpiredTokenException $e) { + throw $e; + } catch(InvalidTokenException $e) { // No worries we try to convert it to a PublicKey Token } @@ -138,6 +140,8 @@ public function getToken(string $tokenId): IToken { public function getTokenById(int $tokenId): IToken { try { return $this->publicKeyTokenProvider->getTokenById($tokenId); + } catch (ExpiredTokenException $e) { + throw $e; } catch (InvalidTokenException $e) { return $this->defaultTokenProvider->getTokenById($tokenId); } @@ -151,6 +155,8 @@ public function getTokenById(int $tokenId): IToken { public function renewSessionToken(string $oldSessionId, string $sessionId) { try { $this->publicKeyTokenProvider->renewSessionToken($oldSessionId, $sessionId); + } catch (ExpiredTokenException $e) { + throw $e; } catch (InvalidTokenException $e) { $this->defaultTokenProvider->renewSessionToken($oldSessionId, $sessionId); }