Skip to content

Commit fca38e1

Browse files
authored
Merge pull request #45411 from nextcloud/fix/auth/selective-token-activity-update
fix(auth): Update authtoken activity selectively
2 parents b7b2966 + bcc02a3 commit fca38e1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/private/Authentication/Token/PublicKeyTokenProvider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@ public function updateToken(OCPIToken $token) {
286286
if (!($token instanceof PublicKeyToken)) {
287287
throw new InvalidTokenException("Invalid token type");
288288
}
289-
$now = $this->time->getTime();
290-
$token->setLastActivity($now);
291289
$this->mapper->update($token);
292290
$this->cacheToken($token);
293291
}

lib/private/User/Session.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
1212
use OC\Authentication\Token\IProvider;
1313
use OC\Authentication\Token\IToken;
14+
use OC\Authentication\Token\PublicKeyToken;
1415
use OC\Authentication\TwoFactorAuth\Manager as TwoFactorAuthManager;
1516
use OC\Hooks\Emitter;
1617
use OC\Hooks\PublicEmitter;
@@ -752,6 +753,9 @@ private function checkTokenCredentials(IToken $dbToken, $token) {
752753
}
753754

754755
$dbToken->setLastCheck($now);
756+
if ($dbToken instanceof PublicKeyToken) {
757+
$dbToken->setLastActivity($now);
758+
}
755759
$this->tokenProvider->updateToken($dbToken);
756760
return true;
757761
}

0 commit comments

Comments
 (0)