diff options
author | Artur Neumann <artur@jankaritech.com> | 2022-11-21 17:28:21 +0545 |
---|---|---|
committer | Artur Neumann <artur@jankaritech.com> | 2023-05-19 12:02:05 +0545 |
commit | 19bb66a88965aeab3b2f048a20132e528e06baa2 (patch) | |
tree | 7cf66ed45527571a0aafb278139a174e532fe81b /lib/private/Authentication/Token | |
parent | 9f8f2d27b6861ecde0b479db2a9dd3ef0d395d67 (diff) | |
download | nextcloud-server-19bb66a88965aeab3b2f048a20132e528e06baa2.tar.gz nextcloud-server-19bb66a88965aeab3b2f048a20132e528e06baa2.zip |
public interface to invalidate tokens of user
Signed-off-by: Artur Neumann <artur@jankaritech.com>
Diffstat (limited to 'lib/private/Authentication/Token')
-rw-r--r-- | lib/private/Authentication/Token/Manager.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/Authentication/Token/Manager.php b/lib/private/Authentication/Token/Manager.php index 59c7ca714c6..761e799d298 100644 --- a/lib/private/Authentication/Token/Manager.php +++ b/lib/private/Authentication/Token/Manager.php @@ -32,8 +32,9 @@ use OC\Authentication\Exceptions\ExpiredTokenException; use OC\Authentication\Exceptions\InvalidTokenException; use OC\Authentication\Exceptions\PasswordlessTokenException; use OC\Authentication\Exceptions\WipeTokenException; +use OCP\Authentication\Token\IProvider as OCPIProvider; -class Manager implements IProvider { +class Manager implements IProvider, OCPIProvider { /** @var PublicKeyTokenProvider */ private $publicKeyTokenProvider; @@ -239,4 +240,13 @@ class Manager implements IProvider { public function updatePasswords(string $uid, string $password) { $this->publicKeyTokenProvider->updatePasswords($uid, $password); } + + public function invalidateTokensOfUser(string $uid, ?string $clientName) { + $tokens = $this->getTokenByUser($uid); + foreach ($tokens as $token) { + if ($clientName === null || ($token->getName() === $clientName)) { + $this->invalidateTokenById($uid, $token->getId()); + } + } + } } |