Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-10-04 11:37:41 +0300
committerGitHub <noreply@github.com>2020-10-04 11:37:41 +0300
commit1896f374651aef4d3580eaedbb96c6c672d58a6b (patch)
tree2d43b246b4c6dccbadaeda60914d997d76f31f75 /lib
parentf4707d178e4d0a85ca63b2e13bf8f897de9a941e (diff)
parent76a7600e2e8ee239c2f7dd19e8b3d1e86f7c5362 (diff)
Merge pull request #22937 from nextcloud/enh/allow_configuring_token_auth_activity_interval
Allow configuring the activity update interval of token
Diffstat (limited to 'lib')
-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);