diff options
Diffstat (limited to 'lib/private/Authentication/Token/DefaultTokenProvider.php')
-rw-r--r-- | lib/private/Authentication/Token/DefaultTokenProvider.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php index 6c69d852d7b..dd6e264ed3d 100644 --- a/lib/private/Authentication/Token/DefaultTokenProvider.php +++ b/lib/private/Authentication/Token/DefaultTokenProvider.php @@ -1,5 +1,4 @@ <?php - /** * @author Christoph Wurst <christoph@owncloud.com> * @@ -68,14 +67,16 @@ class DefaultTokenProvider implements IProvider { * * @param string $token * @param string $uid + * @param string $loginName * @param string $password * @param string $name * @param int $type token type - * @return DefaultToken + * @return IToken */ - public function generateToken($token, $uid, $password, $name, $type = IToken::TEMPORARY_TOKEN) { + public function generateToken($token, $uid, $loginName, $password, $name, $type = IToken::TEMPORARY_TOKEN) { $dbToken = new DefaultToken(); $dbToken->setUid($uid); + $dbToken->setLoginName($loginName); $dbToken->setPassword($this->encryptPassword($password, $token)); $dbToken->setName($name); $dbToken->setToken($this->hashToken($token)); @@ -134,6 +135,7 @@ class DefaultTokenProvider implements IProvider { /** * @param IToken $savedToken * @param string $tokenId session token + * @throws InvalidTokenException * @return string */ public function getPassword(IToken $savedToken, $tokenId) { @@ -150,6 +152,16 @@ class DefaultTokenProvider implements IProvider { } /** + * Invalidate (delete) the given token + * + * @param IUser $user + * @param int $id + */ + public function invalidateTokenById(IUser $user, $id) { + $this->mapper->deleteById($user, $id); + } + + /** * Invalidate (delete) old session tokens */ public function invalidateOldTokens() { @@ -203,6 +215,7 @@ class DefaultTokenProvider implements IProvider { * * @param string $password * @param string $token + * @throws InvalidTokenException * @return string the decrypted key */ private function decryptPassword($password, $token) { |