summaryrefslogtreecommitdiffstats
path: root/lib/private/Authentication/Token/DefaultTokenProvider.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@owncloud.com>2016-06-21 10:23:50 +0200
committerChristoph Wurst <christoph@owncloud.com>2016-06-21 10:24:25 +0200
commitb805908dca5cd4daf9f56bc140bbed48e067d573 (patch)
tree9c9bee8639d269b80985621c873163b5803a6a8b /lib/private/Authentication/Token/DefaultTokenProvider.php
parent0e575c7eeadc6c8eb11b0be2ed1d39cdcf6cfcb8 (diff)
downloadnextcloud-server-b805908dca5cd4daf9f56bc140bbed48e067d573.tar.gz
nextcloud-server-b805908dca5cd4daf9f56bc140bbed48e067d573.zip
update session token password on user password change
Diffstat (limited to 'lib/private/Authentication/Token/DefaultTokenProvider.php')
-rw-r--r--lib/private/Authentication/Token/DefaultTokenProvider.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php
index 84effc5f875..75f0fb10ba6 100644
--- a/lib/private/Authentication/Token/DefaultTokenProvider.php
+++ b/lib/private/Authentication/Token/DefaultTokenProvider.php
@@ -151,6 +151,23 @@ class DefaultTokenProvider implements IProvider {
}
/**
+ * Encrypt and set the password of the given token
+ *
+ * @param IToken $token
+ * @param string $tokenId
+ * @param string $password
+ * @throws InvalidTokenException
+ */
+ public function setPassword(IToken $token, $tokenId, $password) {
+ if (!($token instanceof DefaultToken)) {
+ throw new InvalidTokenException();
+ }
+ /** @var DefaultToken $token */
+ $token->setPassword($this->encryptPassword($password, $tokenId));
+ $this->mapper->update($token);
+ }
+
+ /**
* Invalidate (delete) the given session token
*
* @param string $token