diff options
author | Artur Neumann <artur@jankaritech.com> | 2022-11-21 17:28:21 +0545 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-03-14 17:13:29 +0100 |
commit | f634badf1218baff90acde501859081e3765d79f (patch) | |
tree | b38c95825cc82e6497da36e742952fecc8452ae0 /lib/private/Authentication | |
parent | 21be557e2afe9e3a1e024d9618a377816d73d63a (diff) | |
download | nextcloud-server-f634badf1218baff90acde501859081e3765d79f.tar.gz nextcloud-server-f634badf1218baff90acde501859081e3765d79f.zip |
public interface to invalidate tokens of user
Signed-off-by: Artur Neumann <artur@jankaritech.com>
Diffstat (limited to 'lib/private/Authentication')
-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()); + } + } + } } |