Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-09-29 20:03:07 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2018-10-01 16:35:24 +0300
commita95154642dd6535ebddebef4e6562e777f2094a4 (patch)
tree7c530641b279eef97c6a28538867a5b8cf5379d9 /lib/public/Authentication
parent66970f4c179c480b2f473dd0f17df1b51f4147a2 (diff)
Emit event on enablign or disabling of 2FA provider
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/public/Authentication')
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IRegistry.php4
-rw-r--r--lib/public/Authentication/TwoFactorAuth/RegistryEvent.php62
2 files changed, 66 insertions, 0 deletions
diff --git a/lib/public/Authentication/TwoFactorAuth/IRegistry.php b/lib/public/Authentication/TwoFactorAuth/IRegistry.php
index 5d97c57bcf2..c033ad91245 100644
--- a/lib/public/Authentication/TwoFactorAuth/IRegistry.php
+++ b/lib/public/Authentication/TwoFactorAuth/IRegistry.php
@@ -39,6 +39,10 @@ use OCP\IUser;
*/
interface IRegistry {
+
+ const EVENT_PROVIDER_ENABLED = self::class . '::enable';
+ const EVENT_PROVIDER_DISABLED = self::class . '::disable';
+
/**
* Get a key-value map of providers and their enabled/disabled state for
* the given user.
diff --git a/lib/public/Authentication/TwoFactorAuth/RegistryEvent.php b/lib/public/Authentication/TwoFactorAuth/RegistryEvent.php
new file mode 100644
index 00000000000..9a005c9cd5d
--- /dev/null
+++ b/lib/public/Authentication/TwoFactorAuth/RegistryEvent.php
@@ -0,0 +1,62 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2018, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Authentication\TwoFactorAuth;
+
+use OCP\IUser;
+use Symfony\Component\EventDispatcher\Event;
+
+/**
+ * @since 15.0.0
+ */
+class RegistryEvent extends Event {
+
+ /** @var IProvider */
+ private $provider;
+
+ /** @IUser */
+ private $user;
+
+ /**
+ * @since 15.0.0
+ */
+ public function __construct(IProvider $provider, IUser $user) {
+ $this->provider = $provider;
+ $this->user = $user;
+ }
+
+ /**
+ * @since 15.0.0
+ */
+ public function getProvider(): IProvider {
+ return $this->provider;
+ }
+
+ /**
+ * @since 15.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+}