diff options
author | Christoph Wurst <christoph@owncloud.com> | 2016-06-17 13:59:15 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@owncloud.com> | 2016-06-17 15:42:28 +0200 |
commit | 0c0a216f42bb004380efca1fd665711f938579d9 (patch) | |
tree | 341a9fbf2d7cc9b155bf99498150400073574093 /lib/private/Authentication/Token/DefaultTokenProvider.php | |
parent | c4149c59c2cfe83b5e4cd2b20b8ad4caf2341ca9 (diff) | |
download | nextcloud-server-0c0a216f42bb004380efca1fd665711f938579d9.tar.gz nextcloud-server-0c0a216f42bb004380efca1fd665711f938579d9.zip |
store last check timestamp in token instead of session
Diffstat (limited to 'lib/private/Authentication/Token/DefaultTokenProvider.php')
-rw-r--r-- | lib/private/Authentication/Token/DefaultTokenProvider.php | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php index 03b8bb5da28..2467b8d836f 100644 --- a/lib/private/Authentication/Token/DefaultTokenProvider.php +++ b/lib/private/Authentication/Token/DefaultTokenProvider.php @@ -92,6 +92,18 @@ class DefaultTokenProvider implements IProvider { } /** + * Save the updated token + * + * @param IToken $token + */ + public function updateToken(IToken $token) { + if (!($token instanceof DefaultToken)) { + throw new InvalidTokenException(); + } + $this->mapper->update($token); + } + + /** * Update token activity timestamp * * @throws InvalidTokenException @@ -183,21 +195,6 @@ class DefaultTokenProvider implements IProvider { /** * @param string $token - * @throws InvalidTokenException - * @return DefaultToken user UID - */ - public function validateToken($token) { - try { - $dbToken = $this->mapper->getToken($this->hashToken($token)); - $this->logger->debug('valid default token for ' . $dbToken->getUID()); - return $dbToken; - } catch (DoesNotExistException $ex) { - throw new InvalidTokenException(); - } - } - - /** - * @param string $token * @return string */ private function hashToken($token) { |