aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Authentication/Token/IWipeableToken.php7
-rw-r--r--lib/private/Authentication/Token/RemoteWipe.php14
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/private/Authentication/Token/IWipeableToken.php b/lib/private/Authentication/Token/IWipeableToken.php
index 8d4d3a60781..f0777bf4a24 100644
--- a/lib/private/Authentication/Token/IWipeableToken.php
+++ b/lib/private/Authentication/Token/IWipeableToken.php
@@ -24,6 +24,11 @@ declare(strict_types=1);
namespace OC\Authentication\Token;
-interface IWipeableToken {
+interface IWipeableToken extends IToken {
+
+ /**
+ * Mark the token for remote wipe
+ */
public function wipe(): void;
+
}
diff --git a/lib/private/Authentication/Token/RemoteWipe.php b/lib/private/Authentication/Token/RemoteWipe.php
index 5534ff1cba1..38f1f439e8e 100644
--- a/lib/private/Authentication/Token/RemoteWipe.php
+++ b/lib/private/Authentication/Token/RemoteWipe.php
@@ -35,6 +35,7 @@ use OCP\Activity\IManager as IActivityManager;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ILogger;
+use OCP\IUser;
use OCP\Notification\IManager as INotificationManager;
use Symfony\Component\EventDispatcher\EventDispatcher;
@@ -57,6 +58,19 @@ class RemoteWipe {
$this->logger = $logger;
}
+ public function markTokenForWipe(int $id): bool {
+ $token = $this->tokenProvider->getTokenById($id);
+
+ if (!($token instanceof IWipeableToken)) {
+ return false;
+ }
+
+ $token->wipe();
+ $this->tokenProvider->updateToken($token);
+
+ return true;
+ }
+
/**
* @param string $token
*