From 19bb66a88965aeab3b2f048a20132e528e06baa2 Mon Sep 17 00:00:00 2001 From: Artur Neumann Date: Mon, 21 Nov 2022 17:28:21 +0545 Subject: public interface to invalidate tokens of user Signed-off-by: Artur Neumann --- apps/oauth2/lib/Controller/SettingsController.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'apps') diff --git a/apps/oauth2/lib/Controller/SettingsController.php b/apps/oauth2/lib/Controller/SettingsController.php index 872288064dd..c24308140ec 100644 --- a/apps/oauth2/lib/Controller/SettingsController.php +++ b/apps/oauth2/lib/Controller/SettingsController.php @@ -30,7 +30,7 @@ declare(strict_types=1); */ namespace OCA\OAuth2\Controller; -use OC\Authentication\Token\IProvider as IAuthTokenProvider; +use OCP\Authentication\Token\IProvider as IAuthTokenProvider; use OCA\OAuth2\Db\AccessTokenMapper; use OCA\OAuth2\Db\Client; use OCA\OAuth2\Db\ClientMapper; @@ -106,14 +106,7 @@ class SettingsController extends Controller { $client = $this->clientMapper->getByUid($id); $this->userManager->callForAllUsers(function (IUser $user) use ($client) { - $tokens = $this->tokenProvider->getTokenByUser($user->getUID()); - foreach ($tokens as $token) { - if ($token->getName() === $client->getName()) { - $this->tokenProvider->invalidateTokenById( - $user->getUID(), $token->getId() - ); - } - } + $this->tokenProvider->invalidateTokensOfUser($user->getUID(), $client->getName()); }); $this->accessTokenMapper->deleteByClientId($id); -- cgit v1.2.3