summaryrefslogtreecommitdiffstats
path: root/lib/private/Authentication/Token/DefaultTokenProvider.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@owncloud.com>2016-06-17 12:08:48 +0200
committerChristoph Wurst <christoph@owncloud.com>2016-06-17 15:42:28 +0200
commitc4149c59c2cfe83b5e4cd2b20b8ad4caf2341ca9 (patch)
tree961a9ad987518d31fce34c93b65d2d2bf1991433 /lib/private/Authentication/Token/DefaultTokenProvider.php
parent491e2654ebed82044f84d3adcc5f845dc471ae06 (diff)
downloadnextcloud-server-c4149c59c2cfe83b5e4cd2b20b8ad4caf2341ca9.tar.gz
nextcloud-server-c4149c59c2cfe83b5e4cd2b20b8ad4caf2341ca9.zip
use token last_activity instead of session value
Diffstat (limited to 'lib/private/Authentication/Token/DefaultTokenProvider.php')
-rw-r--r--lib/private/Authentication/Token/DefaultTokenProvider.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php
index 84effc5f875..03b8bb5da28 100644
--- a/lib/private/Authentication/Token/DefaultTokenProvider.php
+++ b/lib/private/Authentication/Token/DefaultTokenProvider.php
@@ -97,14 +97,17 @@ class DefaultTokenProvider implements IProvider {
* @throws InvalidTokenException
* @param IToken $token
*/
- public function updateToken(IToken $token) {
+ public function updateTokenActivity(IToken $token) {
if (!($token instanceof DefaultToken)) {
throw new InvalidTokenException();
}
/** @var DefaultToken $token */
- $token->setLastActivity($this->time->getTime());
-
- $this->mapper->update($token);
+ $now = $this->time->getTime();
+ if ($token->getLastActivity() < ($now - 60)) {
+ // Update token only once per minute
+ $token->setLastActivity($now);
+ $this->mapper->update($token);
+ }
}
/**