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.php21
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IActivatableAtLogin.php22
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IActivatableByAdmin.php22
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IDeactivatableByAdmin.php22
-rw-r--r--lib/public/Authentication/TwoFactorAuth/ILoginSetupProvider.php29
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IPersonalProviderSettings.php30
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IProvider.php43
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php23
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IProvidesIcons.php22
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IProvidesPersonalSettings.php22
-rw-r--r--lib/public/Authentication/TwoFactorAuth/IRegistry.php28
-rw-r--r--lib/public/Authentication/TwoFactorAuth/RegistryEvent.php32
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorException.php21
-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.php24
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserDisabled.php23
-rw-r--r--lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserEnabled.php23
-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, 263 insertions, 349 deletions
diff --git a/lib/public/Authentication/TwoFactorAuth/ALoginSetupController.php b/lib/public/Authentication/TwoFactorAuth/ALoginSetupController.php
index 0ac23cc8915..f298ccbc64b 100644
--- a/lib/public/Authentication/TwoFactorAuth/ALoginSetupController.php
+++ b/lib/public/Authentication/TwoFactorAuth/ALoginSetupController.php
@@ -3,25 +3,8 @@
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;
diff --git a/lib/public/Authentication/TwoFactorAuth/IActivatableAtLogin.php b/lib/public/Authentication/TwoFactorAuth/IActivatableAtLogin.php
index e3ef7c62f40..176b593afb7 100644
--- a/lib/public/Authentication/TwoFactorAuth/IActivatableAtLogin.php
+++ b/lib/public/Authentication/TwoFactorAuth/IActivatableAtLogin.php
@@ -3,25 +3,8 @@
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;
@@ -31,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 d9fd8099235..fffb154b174 100644
--- a/lib/public/Authentication/TwoFactorAuth/IActivatableByAdmin.php
+++ b/lib/public/Authentication/TwoFactorAuth/IActivatableByAdmin.php
@@ -3,25 +3,8 @@
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;
@@ -35,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 1acf3e575d8..e6cf91ac6a3 100644
--- a/lib/public/Authentication/TwoFactorAuth/IDeactivatableByAdmin.php
+++ b/lib/public/Authentication/TwoFactorAuth/IDeactivatableByAdmin.php
@@ -3,25 +3,8 @@
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;
@@ -35,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 9d07b11ebed..32ede4f385c 100644
--- a/lib/public/Authentication/TwoFactorAuth/ILoginSetupProvider.php
+++ b/lib/public/Authentication/TwoFactorAuth/ILoginSetupProvider.php
@@ -3,39 +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 23913b761b2..3cf7946272e 100644
--- a/lib/public/Authentication/TwoFactorAuth/IPersonalProviderSettings.php
+++ b/lib/public/Authentication/TwoFactorAuth/IPersonalProviderSettings.php
@@ -3,29 +3,13 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016 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: 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
@@ -33,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 8f1c4ae2802..27c4121f4ac 100644
--- a/lib/public/Authentication/TwoFactorAuth/IProvider.php
+++ b/lib/public/Authentication/TwoFactorAuth/IProvider.php
@@ -1,49 +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
*
@@ -79,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 5d4c010fbdc..8dd0a1dd205 100644
--- a/lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php
+++ b/lib/public/Authentication/TwoFactorAuth/IProvidesCustomCSP.php
@@ -3,26 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016 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: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Authentication\TwoFactorAuth;
@@ -32,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 cd5205e5416..b19926cab03 100644
--- a/lib/public/Authentication/TwoFactorAuth/IProvidesIcons.php
+++ b/lib/public/Authentication/TwoFactorAuth/IProvidesIcons.php
@@ -3,25 +3,8 @@
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;
@@ -32,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 3a101764c94..4c922318950 100644
--- a/lib/public/Authentication/TwoFactorAuth/IProvidesPersonalSettings.php
+++ b/lib/public/Authentication/TwoFactorAuth/IProvidesPersonalSettings.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016 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: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Authentication\TwoFactorAuth;
@@ -35,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 1f1b82a4426..6817f1763cf 100644
--- a/lib/public/Authentication/TwoFactorAuth/IRegistry.php
+++ b/lib/public/Authentication/TwoFactorAuth/IRegistry.php
@@ -3,26 +3,8 @@
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;
@@ -39,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';
@@ -53,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 830ce8e1c3b..d498f51316f 100644
--- a/lib/public/Authentication/TwoFactorAuth/RegistryEvent.php
+++ b/lib/public/Authentication/TwoFactorAuth/RegistryEvent.php
@@ -3,26 +3,8 @@
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;
@@ -31,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 e601f6c33d9..4a8d265b9ce 100644
--- a/lib/public/Authentication/TwoFactorAuth/TwoFactorException.php
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorException.php
@@ -3,25 +3,8 @@
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;
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 539c5716bbd..48690cb9e2a 100644
--- a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderDisabled.php
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderDisabled.php
@@ -3,25 +3,8 @@
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;
@@ -29,9 +12,10 @@ 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
index 5a56adc3cc9..002ac079e06 100644
--- a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserDisabled.php
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserDisabled.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2021 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: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Authentication\TwoFactorAuth;
@@ -30,6 +13,8 @@ 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 */
diff --git a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserEnabled.php b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserEnabled.php
index c577d1484a3..9172358cd16 100644
--- a/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserEnabled.php
+++ b/lib/public/Authentication/TwoFactorAuth/TwoFactorProviderForUserEnabled.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2021 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: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Authentication\TwoFactorAuth;
@@ -30,6 +13,8 @@ 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 */
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;
+ }
+}