diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-10-04 11:37:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-04 11:37:41 +0300 |
commit | 1896f374651aef4d3580eaedbb96c6c672d58a6b (patch) | |
tree | 2d43b246b4c6dccbadaeda60914d997d76f31f75 /lib | |
parent | f4707d178e4d0a85ca63b2e13bf8f897de9a941e (diff) | |
parent | 76a7600e2e8ee239c2f7dd19e8b3d1e86f7c5362 (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.php | 6 |
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); |