diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 44a741f5fa4a1..7602f25031e6d 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -7716,6 +7716,8 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false) '/libraries/vendor/tobscure/json-api/.git/hooks', '/libraries/vendor/tobscure/json-api/.git/branches', '/libraries/vendor/tobscure/json-api/.git', + // From 4.1.1 to 4.1.2 + '/administrator/components/com_users/src/Field/PrimaryauthprovidersField.php', ); $status['files_checked'] = $files; diff --git a/administrator/components/com_users/forms/user.xml b/administrator/components/com_users/forms/user.xml index f8b0e68639fe4..c955c98c092b5 100644 --- a/administrator/components/com_users/forms/user.xml +++ b/administrator/components/com_users/forms/user.xml @@ -124,15 +124,6 @@ - - - - type . $plugin->name; - - if (!class_exists($className)) - { - continue; - } - - if (!is_subclass_of( - $className, - "Joomla\CMS\Authentication\ProviderAwareAuthenticationPluginInterface" - ) - || !$className::isPrimaryProvider()) - { - continue; - } - - $options[] = (object) ['value' => $className::getProviderName(), 'text' => $className::getProviderName()]; - } - - // Merge any additional options in the XML definition. - return array_merge(parent::getOptions(), $options); - } -} diff --git a/administrator/components/com_users/src/Model/UserModel.php b/administrator/components/com_users/src/Model/UserModel.php index 957afb703a859..d0003a0ba6280 100644 --- a/administrator/components/com_users/src/Model/UserModel.php +++ b/administrator/components/com_users/src/Model/UserModel.php @@ -1215,13 +1215,6 @@ public function getOtpConfigEncryptionKey() public function getTwofactorform($userId = null) { $userId = (!empty($userId)) ? $userId : (int) $this->getState('user.id'); - $user = $this->getItem($userId); - - // Check if core is the auth provider - if ($user->authProvider !== 'Joomla') - { - return []; - } $otpConfig = $this->getOtpConfig($userId); diff --git a/administrator/language/en-GB/com_users.ini b/administrator/language/en-GB/com_users.ini index bea350e079b0a..a539988039189 100644 --- a/administrator/language/en-GB/com_users.ini +++ b/administrator/language/en-GB/com_users.ini @@ -350,8 +350,6 @@ COM_USERS_USER_FIELD_PASSWORD1_MESSAGE="The passwords you entered do not match. COM_USERS_USER_FIELD_PASSWORD2_LABEL="Confirm Password" COM_USERS_USER_FIELD_REGISTERDATE_LABEL="Registration Date" COM_USERS_USER_FIELD_REQUIRERESET_LABEL="Require Password Reset" -COM_USERS_USER_FIELD_AUTHPROVIDER_DESC="The authentication method you want to set on the user account." -COM_USERS_USER_FIELD_AUTHPROVIDER_LABEL="Authentication Method" COM_USERS_USER_FIELD_RESETCOUNT_LABEL="Password Reset Count" COM_USERS_USER_FIELD_SENDEMAIL_LABEL="Receive System Emails" COM_USERS_USER_FIELD_TIMEZONE_LABEL="Time Zone" diff --git a/components/com_users/src/Model/ProfileModel.php b/components/com_users/src/Model/ProfileModel.php index 3cc0719dc1b87..6742e8a6adef2 100644 --- a/components/com_users/src/Model/ProfileModel.php +++ b/components/com_users/src/Model/ProfileModel.php @@ -366,14 +366,6 @@ public function getTwofactorform($userId = null) $model = $this->bootComponent('com_users')->getMVCFactory() ->createModel('User', 'Administrator'); - $user = $model->getItem($userId); - - // Check if core is the auth provider - if ($user->authProvider !== 'Joomla') - { - return array(); - } - $otpConfig = $model->getOtpConfig($userId); PluginHelper::importPlugin('twofactorauth'); diff --git a/libraries/src/Authentication/Authentication.php b/libraries/src/Authentication/Authentication.php index 282a6c0fba8f2..05f2b629372c2 100644 --- a/libraries/src/Authentication/Authentication.php +++ b/libraries/src/Authentication/Authentication.php @@ -16,7 +16,6 @@ use Joomla\CMS\Plugin\PluginHelper; use Joomla\Event\DispatcherAwareTrait; use Joomla\Event\DispatcherInterface; -use Joomla\CMS\Authentication\ProviderAwareAuthenticationPluginInterface; /** * Authentication class, provides an interface for the Joomla authentication system @@ -156,16 +155,6 @@ public function authenticate($credentials, $options = array()) // Create authentication response $response = new AuthenticationResponse; - // Query existing authProvider constraint - $db = Factory::getContainer()->get('DatabaseDriver'); - - $pluginConstraint = $db->setQuery( - $db->getQuery(true) - ->select($db->quoteName('authProvider')) - ->from($db->quoteName('#__users')) - ->where($db->quoteName('username') . ' = ' . $db->quote($credentials['username'])) - )->loadResult(); - /* * Loop through the plugins and check if the credentials can be used to authenticate * the user @@ -184,15 +173,6 @@ public function authenticate($credentials, $options = array()) continue; } - // Check auth provider constraint - if ($pluginConstraint - && $plugin instanceof ProviderAwareAuthenticationPluginInterface - && $plugin::isPrimaryProvider() - && $plugin::getProviderName() !== $pluginConstraint) - { - continue; - } - // Try to authenticate $plugin->onUserAuthenticate($credentials, $options, $response); diff --git a/libraries/src/Authentication/ProviderAwareAuthenticationPluginInterface.php b/libraries/src/Authentication/ProviderAwareAuthenticationPluginInterface.php index b8742b6a6391b..759eaa46a5bb3 100644 --- a/libraries/src/Authentication/ProviderAwareAuthenticationPluginInterface.php +++ b/libraries/src/Authentication/ProviderAwareAuthenticationPluginInterface.php @@ -12,6 +12,7 @@ /** * Interface class defining the necessary methods for an authentication plugin to be provider aware + * Please note: might be deprecated with Joomla 4.2 * * @since 3.10.7 */ diff --git a/libraries/src/Table/User.php b/libraries/src/Table/User.php index 93ac77e4fd197..8847c34e19ea7 100644 --- a/libraries/src/Table/User.php +++ b/libraries/src/Table/User.php @@ -565,41 +565,4 @@ public function setLastVisit($timeStamp = null, $userId = null) return true; } - - /** - * Updates auth provider of a user - * - * @param string $authProvider The auth provider name - * @param integer $userId The user id (optional). - * - * @return boolean False if an error occurs - * - * @since 3.10.7 - */ - public function setAuthProvider($authProvider, $userId = null) - { - // Check for User ID - if (is_null($userId)) - { - if (isset($this)) - { - $userId = $this->id; - } - else - { - jexit('No userid in setAuthProvider'); - } - } - - // Update the database row for the user. - $db = $this->_db; - $query = $db->getQuery(true) - ->update($db->quoteName($this->_tbl)) - ->set($db->quoteName('authProvider') . '=' . $db->quote($authProvider)) - ->where($db->quoteName('id') . '=' . (int) $userId); - $db->setQuery($query); - $db->execute(); - - return true; - } } diff --git a/libraries/src/User/User.php b/libraries/src/User/User.php index 67602038dddff..85e0e832a7d30 100644 --- a/libraries/src/User/User.php +++ b/libraries/src/User/User.php @@ -524,25 +524,6 @@ public function getTimezone() return new \DateTimeZone($timezone); } - /** - * Pass through method to the table for setting the auth provider in login contexts. - * Works around issues with hardcoded permission checks in save() associated to super admins - * - * @param string $authProvider The auth plugin name - * - * @return boolean True on success. - * - * @since 3.10.7 - */ - public function setAuthProvider($authProvider) - { - // Create the user table object - $table = $this->getTable(); - $table->load($this->id); - - return $table->setAuthProvider($authProvider); - } - /** * Method to get the user parameters * diff --git a/plugins/authentication/cookie/cookie.php b/plugins/authentication/cookie/cookie.php index 7c34ea6e0781d..378279991e9c4 100644 --- a/plugins/authentication/cookie/cookie.php +++ b/plugins/authentication/cookie/cookie.php @@ -17,8 +17,6 @@ use Joomla\CMS\User\User; use Joomla\CMS\User\UserHelper; -use Joomla\CMS\Authentication\ProviderAwareAuthenticationPluginInterface; - /** * Joomla Authentication plugin * @@ -26,7 +24,7 @@ * @note Code based on http://jaspan.com/improved_persistent_login_cookie_best_practice * and http://fishbowl.pastiche.org/2004/01/19/persistent_login_cookie_best_practice/ */ -class PlgAuthenticationCookie extends CMSPlugin implements ProviderAwareAuthenticationPluginInterface +class PlgAuthenticationCookie extends CMSPlugin { /** * Application object @@ -109,7 +107,7 @@ public function onUserAuthenticate($credentials, $options, &$response) return false; } - $response->type = self::getProviderName(); + $response->type = 'Cookie'; // Filter series since we're going to use it in the query $filter = new InputFilter; @@ -448,28 +446,4 @@ public function onUserAfterLogout($options) return true; } - - /** - * Remember Me shall work with any other auth plugin - * - * @return false - * - * @since 3.10.7 - */ - public static function isPrimaryProvider() - { - return false; - } - - /** - * Return provider name - * - * @return string - * - * @since 3.10.7 - */ - public static function getProviderName() - { - return 'Cookie'; - } } diff --git a/plugins/authentication/joomla/joomla.php b/plugins/authentication/joomla/joomla.php index 9e6f97f67ccec..4eff44f675703 100644 --- a/plugins/authentication/joomla/joomla.php +++ b/plugins/authentication/joomla/joomla.php @@ -17,14 +17,12 @@ use Joomla\CMS\User\User; use Joomla\CMS\User\UserHelper; -use Joomla\CMS\Authentication\ProviderAwareAuthenticationPluginInterface; - /** * Joomla Authentication plugin * * @since 1.5 */ -class PlgAuthenticationJoomla extends CMSPlugin implements ProviderAwareAuthenticationPluginInterface +class PlgAuthenticationJoomla extends CMSPlugin { /** * Application object @@ -55,7 +53,7 @@ class PlgAuthenticationJoomla extends CMSPlugin implements ProviderAwareAuthenti */ public function onUserAuthenticate($credentials, $options, &$response) { - $response->type = self::getProviderName(); + $response->type = 'Joomla'; // Joomla does not like blank passwords if (empty($credentials['password'])) @@ -239,28 +237,4 @@ public function onUserAuthenticate($credentials, $options, &$response) } } } - - /** - * Acts as primary auth provider - * - * @return true - * - * @since 3.10.7 - */ - public static function isPrimaryProvider() - { - return true; - } - - /** - * Return provider name - * - * @return string - * - * @since 3.10.7 - */ - public static function getProviderName() - { - return 'Joomla'; - } } diff --git a/plugins/authentication/ldap/ldap.php b/plugins/authentication/ldap/ldap.php index 25c1849967e9c..95a30e2cf7a63 100644 --- a/plugins/authentication/ldap/ldap.php +++ b/plugins/authentication/ldap/ldap.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; use Joomla\CMS\Authentication\Authentication; -use Joomla\CMS\Authentication\ProviderAwareAuthenticationPluginInterface; use Joomla\CMS\Language\Text; use Joomla\CMS\Plugin\CMSPlugin; use Symfony\Component\Ldap\Entry; @@ -23,7 +22,7 @@ * * @since 1.5 */ -class PlgAuthenticationLdap extends CMSPlugin implements ProviderAwareAuthenticationPluginInterface +class PlgAuthenticationLdap extends CMSPlugin { /** * This method should handle any authentication and report back to the subject @@ -45,7 +44,7 @@ public function onUserAuthenticate($credentials, $options, &$response) } // For JLog - $response->type = self::getProviderName(); + $response->type = 'LDAP'; // Strip null bytes from the password $credentials['password'] = str_replace(chr(0), '', $credentials['password']); @@ -224,28 +223,4 @@ private function searchByString($search, Ldap $ldap) } } } - - /** - * Acts as primary auth provider - * - * @return true - * - * @since 3.10.7 - */ - public static function isPrimaryProvider() - { - return true; - } - - /** - * Return provider name - * - * @return string - * - * @since 3.10.7 - */ - public static function getProviderName() - { - return 'LDAP'; - } } diff --git a/plugins/user/joomla/joomla.php b/plugins/user/joomla/joomla.php index 80488934bffdf..c2457900f84d3 100644 --- a/plugins/user/joomla/joomla.php +++ b/plugins/user/joomla/joomla.php @@ -409,12 +409,6 @@ protected function _getUser($user, $options = []) { $instance->load($id); - // Add auth provider constraint if not set yet - if (!$instance->authProvider) - { - $instance->setAuthProvider($user['type']); - } - return $instance; } @@ -428,7 +422,6 @@ protected function _getUser($user, $options = []) $instance->name = $user['fullname']; $instance->username = $user['username']; $instance->password_clear = $user['password_clear']; - $instance->authProvider = $user['type']; // Result should contain an email (check). $instance->email = $user['email'];