aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Authentication/TwoFactorAuth
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Authentication/TwoFactorAuth')
-rw-r--r--lib/public/Authentication/TwoFactorAuth/ALoginSetupController.php22
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IActivatableAtLogin.php23
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IActivatableByAdmin.php23
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IDeactivatableByAdmin.php23
-rw-r--r--lib/public/Authentication/TwoFactorAuth/ILoginSetupProvider.php30
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IPersonalProviderSettings.php29
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IProvider.php44
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php24
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IProvidesIcons.php23
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IProvidesPersonalSettings.php23
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IRegistry.php29
-rw-r--r--lib/public/Authentication/TwoFactorAuth/RegistryEvent.php33
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorException.php22
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengeFailed.php41
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengePassed.php41
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorProviderDisabled.php25
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserDisabled.php49
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserEnabled.php49
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserRegistered.php41
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserUnregistered.php41
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorProviderUserDeleted.php41
21 files changed, 352 insertions, 324 deletions
diff --git a/lib/public/Authentication/TwoFactorAuth/ALoginSetupController.php b/lib/public/Authentication/TwoFactorAuth/ALoginSetupController.php
index d71150b3451..f298ccbc64b 100644
--- a/lib/public/Authentication/TwoFactorAuth/ALoginSetupController.php
+++ b/lib/public/Authentication/TwoFactorAuth/ALoginSetupController.php
@@ -3,27 +3,9 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2019, 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/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Authentication\TwoFactorAuth;
use OCP\AppFramework\Controller;
diff --git a/lib/public/Authentication/TwoFactorAuth/IActivatableAtLogin.php b/lib/public/Authentication/TwoFactorAuth/IActivatableAtLogin.php
index f1f67f3a4dc..176b593afb7 100644
--- a/lib/public/Authentication/TwoFactorAuth/IActivatableAtLogin.php
+++ b/lib/public/Authentication/TwoFactorAuth/IActivatableAtLogin.php
@@ -3,27 +3,9 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2019, 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/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Authentication\TwoFactorAuth;
use OCP\IUser;
@@ -32,7 +14,6 @@ use OCP\IUser;
* @since 17.0.0
*/
interface IActivatableAtLogin extends IProvider {
-
/**
* @param IUser $user
*
diff --git a/lib/public/Authentication/TwoFactorAuth/IActivatableByAdmin.php b/lib/public/Authentication/TwoFactorAuth/IActivatableByAdmin.php
index 98160d94647..fffb154b174 100644
--- a/lib/public/Authentication/TwoFactorAuth/IActivatableByAdmin.php
+++ b/lib/public/Authentication/TwoFactorAuth/IActivatableByAdmin.php
@@ -3,27 +3,9 @@
declare(strict_types=1);
/**
- * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Authentication\TwoFactorAuth;
use OCP\IUser;
@@ -36,7 +18,6 @@ use OCP\IUser;
* @since 15.0.0
*/
interface IActivatableByAdmin extends IProvider {
-
/**
* Enable this provider for the given user.
*
diff --git a/lib/public/Authentication/TwoFactorAuth/IDeactivatableByAdmin.php b/lib/public/Authentication/TwoFactorAuth/IDeactivatableByAdmin.php
index 0f8b527e34a..e6cf91ac6a3 100644
--- a/lib/public/Authentication/TwoFactorAuth/IDeactivatableByAdmin.php
+++ b/lib/public/Authentication/TwoFactorAuth/IDeactivatableByAdmin.php
@@ -3,27 +3,9 @@
declare(strict_types=1);
/**
- * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Authentication\TwoFactorAuth;
use OCP\IUser;
@@ -36,7 +18,6 @@ use OCP\IUser;
* @since 15.0.0
*/
interface IDeactivatableByAdmin extends IProvider {
-
/**
* Disable this provider for the given user.
*
diff --git a/lib/public/Authentication/TwoFactorAuth/ILoginSetupProvider.php b/lib/public/Authentication/TwoFactorAuth/ILoginSetupProvider.php
index 7165588566a..32ede4f385c 100644
--- a/lib/public/Authentication/TwoFactorAuth/ILoginSetupProvider.php
+++ b/lib/public/Authentication/TwoFactorAuth/ILoginSetupProvider.php
@@ -3,40 +3,20 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2019, 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/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Authentication\TwoFactorAuth;
-use OCP\Template;
+use OCP\Template\ITemplate;
/**
* @since 17.0.0
*/
interface ILoginSetupProvider {
-
/**
- * @return Template
- *
* @since 17.0.0
+ * @since 32.0.0 Broader return type ITemplate instead of \OCP\Template
*/
- public function getBody(): Template;
+ public function getBody(): ITemplate;
}
diff --git a/lib/public/Authentication/TwoFactorAuth/IPersonalProviderSettings.php b/lib/public/Authentication/TwoFactorAuth/IPersonalProviderSettings.php
index 5178792b3ae..3cf7946272e 100644
--- a/lib/public/Authentication/TwoFactorAuth/IPersonalProviderSettings.php
+++ b/lib/public/Authentication/TwoFactorAuth/IPersonalProviderSettings.php
@@ -3,30 +3,13 @@
declare(strict_types=1);
/**
- *
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Authentication\TwoFactorAuth;
-use OCP\Template;
+use OCP\Template\ITemplate;
/**
* Interface IPersonalProviderSettings
@@ -34,11 +17,9 @@ use OCP\Template;
* @since 15.0.0
*/
interface IPersonalProviderSettings {
-
/**
- * @return Template
- *
* @since 15.0.0
+ * @since 32.0.0 Broader return type ITemplate instead of \OCP\Template
*/
- public function getBody(): Template;
+ public function getBody(): ITemplate;
}
diff --git a/lib/public/Authentication/TwoFactorAuth/IProvider.php b/lib/public/Authentication/TwoFactorAuth/IProvider.php
index 83545fa4f6c..27c4121f4ac 100644
--- a/lib/public/Authentication/TwoFactorAuth/IProvider.php
+++ b/lib/public/Authentication/TwoFactorAuth/IProvider.php
@@ -1,50 +1,20 @@
<?php
declare(strict_types=1);
-
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
-
namespace OCP\Authentication\TwoFactorAuth;
use OCP\IUser;
-use OCP\Template;
+use OCP\Template\ITemplate;
/**
* @since 9.1.0
*/
interface IProvider {
-
- /**
- * @since 14.0.0
- * @deprecated 22.0.0
- */
- public const EVENT_SUCCESS = self::class . '::success';
-
- /**
- * @deprecated 22.0.0
- */
- public const EVENT_FAILED = self::class . '::failed';
-
/**
* Get unique identifier of this 2FA provider
*
@@ -80,11 +50,9 @@ interface IProvider {
* Get the template for rending the 2FA provider view
*
* @since 9.1.0
- *
- * @param IUser $user
- * @return Template
+ * @since 32.0.0 Broader return type ITemplate instead of \OCP\Template.
*/
- public function getTemplate(IUser $user): Template;
+ public function getTemplate(IUser $user): ITemplate;
/**
* Verify the given challenge
diff --git a/lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php b/lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php
index 1611e0da73c..8dd0a1dd205 100644
--- a/lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php
+++ b/lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php
@@ -3,28 +3,9 @@
declare(strict_types=1);
/**
- *
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Authentication\TwoFactorAuth;
use OCP\AppFramework\Http\ContentSecurityPolicy;
@@ -33,7 +14,6 @@ use OCP\AppFramework\Http\ContentSecurityPolicy;
* @since 13.0.0
*/
interface IProvidesCustomCSP {
-
/**
* @return ContentSecurityPolicy
*
diff --git a/lib/public/Authentication/TwoFactorAuth/IProvidesIcons.php b/lib/public/Authentication/TwoFactorAuth/IProvidesIcons.php
index 60315dc8030..b19926cab03 100644
--- a/lib/public/Authentication/TwoFactorAuth/IProvidesIcons.php
+++ b/lib/public/Authentication/TwoFactorAuth/IProvidesIcons.php
@@ -3,27 +3,9 @@
declare(strict_types=1);
/**
- * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Authentication\TwoFactorAuth;
/**
@@ -33,7 +15,6 @@ namespace OCP\Authentication\TwoFactorAuth;
* @since 15.0.0
*/
interface IProvidesIcons extends IProvider {
-
/**
* Get the path to the light (white) icon of this provider
*
diff --git a/lib/public/Authentication/TwoFactorAuth/IProvidesPersonalSettings.php b/lib/public/Authentication/TwoFactorAuth/IProvidesPersonalSettings.php
index 3668e60cd50..4c922318950 100644
--- a/lib/public/Authentication/TwoFactorAuth/IProvidesPersonalSettings.php
+++ b/lib/public/Authentication/TwoFactorAuth/IProvidesPersonalSettings.php
@@ -3,27 +3,9 @@
declare(strict_types=1);
/**
- *
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Authentication\TwoFactorAuth;
use OCP\IUser;
@@ -36,7 +18,6 @@ use OCP\IUser;
* @since 15.0.0
*/
interface IProvidesPersonalSettings extends IProvider {
-
/**
* @param IUser $user
*
diff --git a/lib/public/Authentication/TwoFactorAuth/IRegistry.php b/lib/public/Authentication/TwoFactorAuth/IRegistry.php
index 2e5951aaf2d..6817f1763cf 100644
--- a/lib/public/Authentication/TwoFactorAuth/IRegistry.php
+++ b/lib/public/Authentication/TwoFactorAuth/IRegistry.php
@@ -3,28 +3,9 @@
declare(strict_types=1);
/**
- * @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Authentication\TwoFactorAuth;
use OCP\IUser;
@@ -40,11 +21,13 @@ use OCP\IUser;
*/
interface IRegistry {
/**
+ * @since 15.0.0
* @deprecated 22.0.0
*/
public const EVENT_PROVIDER_ENABLED = self::class . '::enable';
/**
+ * @since 15.0.0
* @deprecated 22.0.0
*/
public const EVENT_PROVIDER_DISABLED = self::class . '::disable';
@@ -54,8 +37,8 @@ interface IRegistry {
* the given user.
*
* @since 14.0.0
- * @return string[] where the array key is the provider ID (string) and the
- * value is the enabled state (bool)
+ * @return array<string, bool> where the array key is the provider ID (string) and the
+ * value is the enabled state (bool)
*/
public function getProviderStates(IUser $user): array;
diff --git a/lib/public/Authentication/TwoFactorAuth/RegistryEvent.php b/lib/public/Authentication/TwoFactorAuth/RegistryEvent.php
index 570998b0ad4..d498f51316f 100644
--- a/lib/public/Authentication/TwoFactorAuth/RegistryEvent.php
+++ b/lib/public/Authentication/TwoFactorAuth/RegistryEvent.php
@@ -3,28 +3,9 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2018, Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Authentication\TwoFactorAuth;
use OCP\EventDispatcher\Event;
@@ -32,14 +13,14 @@ use OCP\IUser;
/**
* @since 15.0.0
+ * @deprecated 28.0.0 Use TwoFactorProviderForUserRegistered or TwoFactorProviderForUserUnregistered instead
+ * @see \OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserRegistered
+ * @see \OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserUnregistered
*/
class RegistryEvent extends Event {
+ private IProvider $provider;
- /** @var IProvider */
- private $provider;
-
- /** @IUser */
- private $user;
+ private IUser $user;
/**
* @since 15.0.0
diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorException.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorException.php
index 95ec88de99a..4a8d265b9ce 100644
--- a/lib/public/Authentication/TwoFactorAuth/TwoFactorException.php
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorException.php
@@ -3,27 +3,9 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016, ownCloud GmbH.
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Cornelius Kölbel <cornelius.koelbel@netknights.it>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016 ownCloud GmbH.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
-
namespace OCP\Authentication\TwoFactorAuth;
use Exception;
diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengeFailed.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengeFailed.php
new file mode 100644
index 00000000000..42ca855df35
--- /dev/null
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengeFailed.php
@@ -0,0 +1,41 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Authentication\TwoFactorAuth;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 28.0.0
+ */
+class TwoFactorProviderChallengeFailed extends Event {
+ /**
+ * @since 28.0.0
+ */
+ public function __construct(
+ private IUser $user,
+ private IProvider $provider,
+ ) {
+ parent::__construct();
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getProvider(): IProvider {
+ return $this->provider;
+ }
+}
diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengePassed.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengePassed.php
new file mode 100644
index 00000000000..396fbf9e9a5
--- /dev/null
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderChallengePassed.php
@@ -0,0 +1,41 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Authentication\TwoFactorAuth;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 28.0.0
+ */
+class TwoFactorProviderChallengePassed extends Event {
+ /**
+ * @since 28.0.0
+ */
+ public function __construct(
+ private IUser $user,
+ private IProvider $provider,
+ ) {
+ parent::__construct();
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getProvider(): IProvider {
+ return $this->provider;
+ }
+}
diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderDisabled.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderDisabled.php
index 925bd6914ba..48690cb9e2a 100644
--- a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderDisabled.php
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderDisabled.php
@@ -3,36 +3,19 @@
declare(strict_types=1);
/**
- * @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @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/>.
- *
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Authentication\TwoFactorAuth;
use OCP\EventDispatcher\Event;
/**
* @since 20.0.0
+ * @deprecated 28.0.0 Use \OCP\Authentication\TwoFactorAuth\TwoFactorProviderUserDeleted instead
+ * @see \OCP\Authentication\TwoFactorAuth\TwoFactorProviderUserDeleted
*/
final class TwoFactorProviderDisabled extends Event {
-
/** @var string */
private $providerId;
diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserDisabled.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserDisabled.php
new file mode 100644
index 00000000000..002ac079e06
--- /dev/null
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserDisabled.php
@@ -0,0 +1,49 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Authentication\TwoFactorAuth;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 22.0.0
+ * @deprecated 28.0.0 Use \OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengeFailed instead
+ * @see \OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengeFailed
+ */
+class TwoFactorProviderForUserDisabled extends Event {
+ /** @var IProvider */
+ private $provider;
+
+ /** @var IUser */
+ private $user;
+
+ /**
+ * @since 22.0.0
+ */
+ public function __construct(IUser $user, IProvider $provider) {
+ $this->user = $user;
+ $this->provider = $provider;
+ }
+
+ /**
+ * @return IUser
+ * @since 22.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+ /**
+ * @return IProvider
+ * @since 22.0.0
+ */
+ public function getProvider(): IProvider {
+ return $this->provider;
+ }
+}
diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserEnabled.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserEnabled.php
new file mode 100644
index 00000000000..9172358cd16
--- /dev/null
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserEnabled.php
@@ -0,0 +1,49 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Authentication\TwoFactorAuth;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 22.0.0
+ * @deprecated 28.0.0 Use \OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengePassed instead
+ * @see \OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengePassed
+ */
+class TwoFactorProviderForUserEnabled extends Event {
+ /** @var IProvider */
+ private $provider;
+
+ /** @var IUser */
+ private $user;
+
+ /**
+ * @since 22.0.0
+ */
+ public function __construct(IUser $user, IProvider $provider) {
+ $this->user = $user;
+ $this->provider = $provider;
+ }
+
+ /**
+ * @return IUser
+ * @since 22.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+ /**
+ * @return IProvider
+ * @since 22.0.0
+ */
+ public function getProvider(): IProvider {
+ return $this->provider;
+ }
+}
diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserRegistered.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserRegistered.php
new file mode 100644
index 00000000000..ed51cee99c8
--- /dev/null
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserRegistered.php
@@ -0,0 +1,41 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Authentication\TwoFactorAuth;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 28.0.0
+ */
+class TwoFactorProviderForUserRegistered extends Event {
+ /**
+ * @since 28.0.0
+ */
+ public function __construct(
+ private IUser $user,
+ private IProvider $provider,
+ ) {
+ parent::__construct();
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getProvider(): IProvider {
+ return $this->provider;
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+}
diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserUnregistered.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserUnregistered.php
new file mode 100644
index 00000000000..1c488a04cdf
--- /dev/null
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserUnregistered.php
@@ -0,0 +1,41 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Authentication\TwoFactorAuth;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 28.0.0
+ */
+class TwoFactorProviderForUserUnregistered extends Event {
+ /**
+ * @since 28.0.0
+ */
+ public function __construct(
+ private IUser $user,
+ private IProvider $provider,
+ ) {
+ parent::__construct();
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getProvider(): IProvider {
+ return $this->provider;
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+}
diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderUserDeleted.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderUserDeleted.php
new file mode 100644
index 00000000000..e99c91b8464
--- /dev/null
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderUserDeleted.php
@@ -0,0 +1,41 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Authentication\TwoFactorAuth;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 28.0.0
+ */
+final class TwoFactorProviderUserDeleted extends Event {
+ /**
+ * @since 28.0.0
+ */
+ public function __construct(
+ private IUser $user,
+ private string $providerId,
+ ) {
+ parent::__construct();
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getProviderId(): string {
+ return $this->providerId;
+ }
+}