Skip to content
Merged
Changes from all commits
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
Log if cookie login failed with token mismatch or session unavailability
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst authored and backportbot-nextcloud[bot] committed Sep 1, 2022
commit c39135a294cd41e5cb3750e012815492abc91cf1
8 changes: 8 additions & 0 deletions lib/private/User/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,10 @@ public function loginWithCookie($uid, $currentToken, $oldSessionId) {
$tokens = $this->config->getUserKeys($uid, 'login_token');
// test cookies token against stored tokens
if (!in_array($currentToken, $tokens, true)) {
$this->logger->error('Tried to log in {uid} but could not verify token', [
'app' => 'core',
'uid' => $uid,
]);
return false;
}
// replace successfully used token with a new one
Expand All @@ -876,6 +880,10 @@ public function loginWithCookie($uid, $currentToken, $oldSessionId) {
$sessionId = $this->session->getId();
$token = $this->tokenProvider->renewSessionToken($oldSessionId, $sessionId);
} catch (SessionNotAvailableException $ex) {
$this->logger->warning('Could not renew session token for {uid} because the session is unavailable', [
'app' => 'core',
'uid' => $uid,
]);
return false;
} catch (InvalidTokenException $ex) {
$this->logger->warning('Renewing session token failed', ['app' => 'core']);
Expand Down