aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Authentication
diff options
context:
space:
mode:
authorArtur Neumann <artur@jankaritech.com>2022-11-21 17:28:21 +0545
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-03-14 17:13:29 +0100
commitf634badf1218baff90acde501859081e3765d79f (patch)
treeb38c95825cc82e6497da36e742952fecc8452ae0 /lib/private/Authentication
parent21be557e2afe9e3a1e024d9618a377816d73d63a (diff)
downloadnextcloud-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.php12
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());
+ }
+ }
+ }
}