This commit is contained in:
Yuri Kuznetsov
2020-07-08 10:30:56 +03:00
parent 1648eb78f0
commit 2f7843687f
18 changed files with 32 additions and 39 deletions
@@ -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,
@@ -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,
@@ -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,
@@ -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;
@@ -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
{
@@ -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;
@@ -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,
@@ -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;
@@ -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
{
@@ -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;
}
}
@@ -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();
}
}
@@ -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;
}
}
@@ -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;
}
}
+1 -1
View File
@@ -41,7 +41,7 @@ use Espo\Entities\{
AuthLogRecord,
};
use Espo\Core\Utils\Authentication\{
use Espo\Core\Authentication\{
Login,
TwoFA\СodeVerify as TwoFACodeVerify,
Utils\AuthenticationFactory,
@@ -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"
+2 -2
View File
@@ -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
{