Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rotate token after fallback
Signed-off-by: Julius Härtl <jus@bitgrid.net>
(cherry picked from commit 553cb49)
  • Loading branch information
juliusknorr authored and PVince81 committed Dec 5, 2022
commit 3ebf7b818be06f61893b2443bb50f2c556525f2c
10 changes: 8 additions & 2 deletions lib/private/Authentication/Token/PublicKeyTokenProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,14 @@ public function getToken(string $tokenId): IToken {
$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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->cache[$tokenHash] = $ex2;
$this->cache[$tokenHash] = $ex;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-critical, ignoring for now for the approaching release

can be addressed afterwards

throw new InvalidTokenException("Token does not exist: " . $ex->getMessage(), 0, $ex);
}
}
}

Expand Down