aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Authentication
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-09-18 12:34:43 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2020-10-04 09:31:41 +0200
commit76a7600e2e8ee239c2f7dd19e8b3d1e86f7c5362 (patch)
treef7220f0796998a1f7b19cb0e5192b0f28dd5fc35 /lib/private/Authentication
parenteba83d22bbcf45caf400704b8794acce180c5ba9 (diff)
downloadnextcloud-server-76a7600e2e8ee239c2f7dd19e8b3d1e86f7c5362.tar.gz
nextcloud-server-76a7600e2e8ee239c2f7dd19e8b3d1e86f7c5362.zip
Allow configuring the activity update interval of token
On some systems with a lot of users this creates a lot of extra DB writes. Being able to increase this interval helps there. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Authentication')
-rw-r--r--lib/private/Authentication/Token/PublicKeyTokenProvider.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
index cd2fca5dec8..a6498ca9923 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
@@ -215,9 +215,13 @@ class PublicKeyTokenProvider implements IProvider {
if (!($token instanceof PublicKeyToken)) {
throw new InvalidTokenException("Invalid token type");
}
+
+ $activityInterval = $this->config->getSystemValueInt('token_auth_activity_update', 60);
+ $activityInterval = min(max($activityInterval, 0), 300);
+
/** @var DefaultToken $token */
$now = $this->time->getTime();
- if ($token->getLastActivity() < ($now - 60)) {
+ if ($token->getLastActivity() < ($now - $activityInterval)) {
// Update token only once per minute
$token->setLastActivity($now);
$this->mapper->update($token);