Merge pull request #11964 from nextcloud/bug/11919/do_not_always_fallback

Forwarded ExpiredTokenException
This commit is contained in:
Roeland Jago Douma 2018-10-23 15:07:19 +02:00 committed by GitHub
commit a11bef25a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -112,7 +112,9 @@ class Manager implements IProvider {
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 @@ class Manager implements IProvider {
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 @@ class Manager implements IProvider {
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);
}