diff --git a/application/Espo/Core/Utils/Authentication/ApiKey.php b/application/Espo/Core/Authentication/ApiKey.php similarity index 98% rename from application/Espo/Core/Utils/Authentication/ApiKey.php rename to application/Espo/Core/Authentication/ApiKey.php index 61cfb42d26..b6ae06fd14 100644 --- a/application/Espo/Core/Utils/Authentication/ApiKey.php +++ b/application/Espo/Core/Authentication/ApiKey.php @@ -27,7 +27,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication; +namespace Espo\Core\Authentication; use Espo\Entities\{ User, diff --git a/application/Espo/Core/Utils/Authentication/Espo.php b/application/Espo/Core/Authentication/Espo.php similarity index 98% rename from application/Espo/Core/Utils/Authentication/Espo.php rename to application/Espo/Core/Authentication/Espo.php index b0fa29f666..7a629c0d51 100644 --- a/application/Espo/Core/Utils/Authentication/Espo.php +++ b/application/Espo/Core/Authentication/Espo.php @@ -27,7 +27,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication; +namespace Espo\Core\Authentication; use Espo\Entities\{ User, diff --git a/application/Espo/Core/Utils/Authentication/Hmac.php b/application/Espo/Core/Authentication/Hmac.php similarity index 98% rename from application/Espo/Core/Utils/Authentication/Hmac.php rename to application/Espo/Core/Authentication/Hmac.php index 9c6db1382a..7c20d6639a 100644 --- a/application/Espo/Core/Utils/Authentication/Hmac.php +++ b/application/Espo/Core/Authentication/Hmac.php @@ -27,7 +27,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication; +namespace Espo\Core\Authentication; use Espo\Entities\{ User, diff --git a/application/Espo/Core/Utils/Authentication/LDAP.php b/application/Espo/Core/Authentication/LDAP.php similarity index 99% rename from application/Espo/Core/Utils/Authentication/LDAP.php rename to application/Espo/Core/Authentication/LDAP.php index d59e008dee..99f1e99389 100644 --- a/application/Espo/Core/Utils/Authentication/LDAP.php +++ b/application/Espo/Core/Authentication/LDAP.php @@ -27,7 +27,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication; +namespace Espo\Core\Authentication; use Espo\Core\Exceptions\Error; diff --git a/application/Espo/Core/Utils/Authentication/LDAP/Client.php b/application/Espo/Core/Authentication/LDAP/Client.php similarity index 96% rename from application/Espo/Core/Utils/Authentication/LDAP/Client.php rename to application/Espo/Core/Authentication/LDAP/Client.php index 45481b0f96..544c25a468 100644 --- a/application/Espo/Core/Utils/Authentication/LDAP/Client.php +++ b/application/Espo/Core/Authentication/LDAP/Client.php @@ -27,7 +27,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication\LDAP; +namespace Espo\Core\Authentication\LDAP; class Client extends \Laminas\Ldap\Ldap { diff --git a/application/Espo/Core/Utils/Authentication/LDAP/Utils.php b/application/Espo/Core/Authentication/LDAP/Utils.php similarity index 99% rename from application/Espo/Core/Utils/Authentication/LDAP/Utils.php rename to application/Espo/Core/Authentication/LDAP/Utils.php index 42fcf1528a..6a06ec5a46 100644 --- a/application/Espo/Core/Utils/Authentication/LDAP/Utils.php +++ b/application/Espo/Core/Authentication/LDAP/Utils.php @@ -27,7 +27,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication\LDAP; +namespace Espo\Core\Authentication\LDAP; use Espo\Core\Utils\Config; diff --git a/application/Espo/Core/Utils/Authentication/Login.php b/application/Espo/Core/Authentication/Login.php similarity index 97% rename from application/Espo/Core/Utils/Authentication/Login.php rename to application/Espo/Core/Authentication/Login.php index 6a217f6e13..8f79809548 100644 --- a/application/Espo/Core/Utils/Authentication/Login.php +++ b/application/Espo/Core/Authentication/Login.php @@ -27,7 +27,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication; +namespace Espo\Core\Authentication; use Espo\Entities\{ User, diff --git a/application/Espo/Core/Utils/Authentication/TwoFA/CodeVerify.php b/application/Espo/Core/Authentication/TwoFA/CodeVerify.php similarity index 96% rename from application/Espo/Core/Utils/Authentication/TwoFA/CodeVerify.php rename to application/Espo/Core/Authentication/TwoFA/CodeVerify.php index 1d76425748..8e3ae3fc35 100644 --- a/application/Espo/Core/Utils/Authentication/TwoFA/CodeVerify.php +++ b/application/Espo/Core/Authentication/TwoFA/CodeVerify.php @@ -27,7 +27,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication\TwoFA; +namespace Espo\Core\Authentication\TwoFA; use Espo\Entities\User; diff --git a/application/Espo/Core/Utils/Authentication/TwoFA/Totp.php b/application/Espo/Core/Authentication/TwoFA/Totp.php similarity index 95% rename from application/Espo/Core/Utils/Authentication/TwoFA/Totp.php rename to application/Espo/Core/Authentication/TwoFA/Totp.php index 1c44c37425..7b90666d5f 100644 --- a/application/Espo/Core/Utils/Authentication/TwoFA/Totp.php +++ b/application/Espo/Core/Authentication/TwoFA/Totp.php @@ -27,12 +27,12 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication\TwoFA; +namespace Espo\Core\Authentication\TwoFA; use Espo\Entities\User; use Espo\ORM\EntityManager; -use Espo\Core\Utils\Authentication\TwoFA\Utils\Totp as TotpUtils; +use Espo\Core\Authentication\TwoFA\Utils\Totp as TotpUtils; class Totp implements CodeVerify { diff --git a/application/Espo/Core/Utils/Authentication/TwoFA/User/CodeVerify.php b/application/Espo/Core/Authentication/TwoFA/User/CodeVerify.php similarity index 100% rename from application/Espo/Core/Utils/Authentication/TwoFA/User/CodeVerify.php rename to application/Espo/Core/Authentication/TwoFA/User/CodeVerify.php diff --git a/application/Espo/Core/Utils/Authentication/TwoFA/User/Totp.php b/application/Espo/Core/Authentication/TwoFA/User/Totp.php similarity index 100% rename from application/Espo/Core/Utils/Authentication/TwoFA/User/Totp.php rename to application/Espo/Core/Authentication/TwoFA/User/Totp.php diff --git a/application/Espo/Core/Utils/Authentication/TwoFA/Utils/Factory.php b/application/Espo/Core/Authentication/TwoFA/Utils/Factory.php similarity index 89% rename from application/Espo/Core/Utils/Authentication/TwoFA/Utils/Factory.php rename to application/Espo/Core/Authentication/TwoFA/Utils/Factory.php index 805959f5f8..f3fc085109 100644 --- a/application/Espo/Core/Utils/Authentication/TwoFA/Utils/Factory.php +++ b/application/Espo/Core/Authentication/TwoFA/Utils/Factory.php @@ -27,7 +27,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication\TwoFA\Utils; +namespace Espo\Core\Authentication\TwoFA\Utils; use Espo\Core\InjectableFactory; use Espo\Core\Utils\Metadata; @@ -52,9 +52,9 @@ class Factory if (!$className) { $sanitizedName = preg_replace('/[^a-zA-Z0-9]+/', '', $method); - $className = "\\Espo\\Custom\\Core\\Utils\\Authentication\\TwoFA\\" . $sanitizedName; + $className = "Espo\\Custom\\Core\\\Authentication\\TwoFA\\" . $sanitizedName; if (!class_exists($className)) { - $className = "\\Espo\\Core\\Utils\\Authentication\\TwoFA\\" . $sanitizedName; + $className = "Espo\\Core\\Authentication\\TwoFA\\" . $sanitizedName; } } diff --git a/application/Espo/Core/Utils/Authentication/TwoFA/Utils/Totp.php b/application/Espo/Core/Authentication/TwoFA/Utils/Totp.php similarity index 84% rename from application/Espo/Core/Utils/Authentication/TwoFA/Utils/Totp.php rename to application/Espo/Core/Authentication/TwoFA/Utils/Totp.php index 25f561fb07..9f84cc75f0 100644 --- a/application/Espo/Core/Utils/Authentication/TwoFA/Utils/Totp.php +++ b/application/Espo/Core/Authentication/TwoFA/Utils/Totp.php @@ -27,28 +27,21 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication\TwoFA\Utils; +namespace Espo\Core\Authentication\TwoFA\Utils; + +use RobThree\Auth\TwoFactorAuth; class Totp { - protected $config; - - public function __construct(\Espo\Core\Utils\Config $config) - { - $this->config = $config; - } - public function verifyCode(string $secret, string $code) { - $impl = new \RobThree\Auth\TwoFactorAuth(); - + $impl = new TwoFactorAuth(); return $impl->verifyCode($secret, $code); } public function createSecret() { - $impl = new \RobThree\Auth\TwoFactorAuth(); - + $impl = new TwoFactorAuth(); return $impl->createSecret(); } } diff --git a/application/Espo/Core/Utils/Authentication/TwoFA/Utils/UserFactory.php b/application/Espo/Core/Authentication/TwoFA/Utils/UserFactory.php similarity index 89% rename from application/Espo/Core/Utils/Authentication/TwoFA/Utils/UserFactory.php rename to application/Espo/Core/Authentication/TwoFA/Utils/UserFactory.php index 0b4f4d294c..fb9e5483a3 100644 --- a/application/Espo/Core/Utils/Authentication/TwoFA/Utils/UserFactory.php +++ b/application/Espo/Core/Authentication/TwoFA/Utils/UserFactory.php @@ -27,7 +27,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication\TwoFA\Utils; +namespace Espo\Core\Authentication\TwoFA\Utils; use Espo\Core\InjectableFactory; use Espo\Core\Utils\Metadata; @@ -52,9 +52,9 @@ class UserFactory if (!$className) { $sanitizedName = preg_replace('/[^a-zA-Z0-9]+/', '', $method); - $className = "\\Espo\\Custom\\Core\\Utils\\Authentication\\TwoFA\\User\\" . $sanitizedName; + $className = "Espo\\Custom\\Core\\Authentication\\TwoFA\\User\\" . $sanitizedName; if (!class_exists($className)) { - $className = "\\Espo\\Core\\Utils\\Authentication\\TwoFA\\User\\" . $sanitizedName; + $className = "Espo\\Core\\Authentication\\TwoFA\\User\\" . $sanitizedName; } } diff --git a/application/Espo/Core/Utils/Authentication/Utils/AuthenticationFactory.php b/application/Espo/Core/Authentication/Utils/AuthenticationFactory.php similarity index 88% rename from application/Espo/Core/Utils/Authentication/Utils/AuthenticationFactory.php rename to application/Espo/Core/Authentication/Utils/AuthenticationFactory.php index cd9daa4842..e392e7ca67 100644 --- a/application/Espo/Core/Utils/Authentication/Utils/AuthenticationFactory.php +++ b/application/Espo/Core/Authentication/Utils/AuthenticationFactory.php @@ -27,11 +27,11 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -namespace Espo\Core\Utils\Authentication\Utils; +namespace Espo\Core\Authentication\Utils; use Espo\Core\InjectableFactory; use Espo\Core\Utils\Metadata; -use Espo\Core\Utils\Authentication\Login; +use Espo\Core\Authentication\Login; class AuthenticationFactory { @@ -51,9 +51,9 @@ class AuthenticationFactory if (!$className) { $sanitizedName = preg_replace('/[^a-zA-Z0-9]+/', '', $method); - $className = "Espo\\Custom\\Core\\Utils\\Authentication\\" . $sanitizedName; + $className = "Espo\\Custom\\Core\\Authentication\\" . $sanitizedName; if (!class_exists($className)) { - $className = "Espo\\Core\\Utils\\Authentication\\" . $sanitizedName; + $className = "Espo\\Core\\Authentication\\" . $sanitizedName; } } diff --git a/application/Espo/Core/Utils/Auth.php b/application/Espo/Core/Utils/Auth.php index e16b0c0df5..fa4bd93b55 100644 --- a/application/Espo/Core/Utils/Auth.php +++ b/application/Espo/Core/Utils/Auth.php @@ -41,7 +41,7 @@ use Espo\Entities\{ AuthLogRecord, }; -use Espo\Core\Utils\Authentication\{ +use Espo\Core\Authentication\{ Login, TwoFA\СodeVerify as TwoFACodeVerify, Utils\AuthenticationFactory, diff --git a/application/Espo/Resources/metadata/app/containerServices.json b/application/Espo/Resources/metadata/app/containerServices.json index 4d4f403508..efd166ccf8 100644 --- a/application/Espo/Resources/metadata/app/containerServices.json +++ b/application/Espo/Resources/metadata/app/containerServices.json @@ -81,16 +81,16 @@ "className": "Espo\\Core\\Utils\\Hasher" }, "authenticationFactory": { - "className": "Espo\\Core\\Utils\\Authentication\\Utils\\AuthenticationFactory" + "className": "Espo\\Core\\Authentication\\Utils\\AuthenticationFactory" }, "auth2FAFactory": { - "className": "Espo\\Core\\Utils\\Authentication\\TwoFA\\Utils\\Factory" + "className": "Espo\\Core\\Authentication\\TwoFA\\Utils\\Factory" }, "auth2FAUserFactory": { - "className": "Espo\\Core\\Utils\\Authentication\\TwoFA\\Utils\\UserFactory" + "className": "Espo\\Core\\Authentication\\TwoFA\\Utils\\UserFactory" }, "totp": { - "className": "Espo\\Core\\Utils\\Authentication\\TwoFA\\Utils\\Totp" + "className": "Espo\\Core\\Authentication\\TwoFA\\Utils\\Totp" }, "emailFilterManager": { "className": "Espo\\Core\\Utils\\EmailFilterManager" diff --git a/application/Espo/Services/UserSecurity.php b/application/Espo/Services/UserSecurity.php index 2e6328321c..6138c9b140 100644 --- a/application/Espo/Services/UserSecurity.php +++ b/application/Espo/Services/UserSecurity.php @@ -44,8 +44,8 @@ use Espo\Core\{ Utils\Config, }; -use Espo\Core\Utils\Authentication\Utils\AuthenticationFactory; -use Espo\Core\Utils\Authentication\TwoFA\Utils\UserFactory as Auth2FAUserFactory; +use Espo\Core\Authentication\Utils\AuthenticationFactory; +use Espo\Core\Authentication\TwoFA\Utils\UserFactory as Auth2FAUserFactory; class UserSecurity {