Skip to content

Commit

Permalink
fix(auth): Update authtoken activity selectively
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst authored and kesselb committed Jun 3, 2024
1 parent 2a6116e commit 0cc6928
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/private/Authentication/Token/PublicKeyTokenProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@ public function updateToken(IToken $token) {
if (!($token instanceof PublicKeyToken)) {
throw new InvalidTokenException("Invalid token type");
}
$now = $this->time->getTime();
$token->setLastActivity($now);
$this->mapper->update($token);
$this->cacheToken($token);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/private/User/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
use OC\Authentication\Token\PublicKeyToken;
use OC\Hooks\Emitter;
use OC\Hooks\PublicEmitter;
use OC_User;
Expand Down Expand Up @@ -772,6 +773,9 @@ private function checkTokenCredentials(IToken $dbToken, $token) {
}

$dbToken->setLastCheck($now);
if ($dbToken instanceof PublicKeyToken) {
$dbToken->setLastActivity($now);
}
$this->tokenProvider->updateToken($dbToken);
return true;
}
Expand Down

0 comments on commit 0cc6928

Please sign in to comment.