diff options
author | Christoph Wurst <christoph@owncloud.com> | 2016-05-08 19:31:42 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-05-11 13:36:46 +0200 |
commit | 69dafd727dc848e3be541ae15bd88d01037cfab0 (patch) | |
tree | 31b717a904e28969091b881316b267babd27c0c8 /lib/private/Authentication/Token/DefaultTokenProvider.php | |
parent | af707fba41634b70115d47de86efe2ce2bf3d3b6 (diff) | |
download | nextcloud-server-69dafd727dc848e3be541ae15bd88d01037cfab0.tar.gz nextcloud-server-69dafd727dc848e3be541ae15bd88d01037cfab0.zip |
delete the token in case an exception is thrown when decrypting the password
Diffstat (limited to 'lib/private/Authentication/Token/DefaultTokenProvider.php')
-rw-r--r-- | lib/private/Authentication/Token/DefaultTokenProvider.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php index 53ecb562a8d..a6641277cf9 100644 --- a/lib/private/Authentication/Token/DefaultTokenProvider.php +++ b/lib/private/Authentication/Token/DefaultTokenProvider.php @@ -22,6 +22,7 @@ namespace OC\Authentication\Token; +use Exception; use OC\Authentication\Exceptions\InvalidTokenException; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Utility\ITimeFactory; @@ -192,7 +193,13 @@ class DefaultTokenProvider implements IProvider { */ private function decryptPassword($password, $token) { $secret = $this->config->getSystemValue('secret'); - return $this->crypto->decrypt($password, $token . $secret); + try { + return $this->crypto->decrypt($password, $token . $secret); + } catch (Exception $ex) { + // Delete the invalid token + $this->invalidateToken($token); + throw new InvalidTokenException(); + } } } |