]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 26 Feb 2023 09:17:50 +0000 (10:17 +0100)
committerRoland Häder <roland@mxchange.org>
Sun, 26 Feb 2023 09:17:50 +0000 (10:17 +0100)
- invoke CryptoHelper::getSelfInstance() rather than creating new instances
  over ObjectFactory
- this also removed the overhead of initialization

framework/main/classes/commands/html/class_HtmlResendLinkCommand.php
framework/main/classes/filter/crypto/class_CaptchaEncryptFilter.php
framework/main/classes/filter/verifier/class_AccountPasswordVerifierFilter.php
framework/main/classes/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php
framework/main/classes/helper/captcha/web/class_GraphicalCodeCaptcha.php

index ebb2c5d3dab78b25f340e47d6928b65451b4c933..9d4a57d4fa2d55161658aa1ce3b468aa34635ca1 100644 (file)
@@ -10,6 +10,7 @@ use Org\Mxchange\CoreFramework\Controller\Controller;
 use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
 use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
 use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
+use Org\Mxchange\CoreFramework\Helper\Crypto\CryptoHelper;
 use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Resolver\Command\CommandResolver;
@@ -86,7 +87,7 @@ class HtmlResendLinkCommand extends BaseCommand implements Commandable {
                $randomString = $rngInstance->randomString(255);
 
                // Get a crypto instance
-               $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
+               $cryptoInstance = CryptoHelper::getSelfInstance();
 
                // Hash and encrypt the string
                $hashedString = $cryptoInstance->hashString($cryptoInstance->encryptString($randomString));
index 97a1f11a95975d78525e26a8e98121f554ecf352..aaab8dff42b178f79a0df145b876a14a575c89db 100644 (file)
@@ -82,7 +82,7 @@ class CaptchaEncryptFilter extends BaseFilter implements Filterable {
                $encryptDecoded = base64_decode(str_replace(' ', '+', urldecode($encryptRequest)));
 
                // Get a crypto helper and decrypt the string
-               $decryptedString = ObjectFactory::createObjectByConfiguredName('crypto_class')->decryptString($encryptDecoded);
+               $decryptedString = CryptoHelper::getSelfInstance()->decryptString($encryptDecoded);
 
                // Is it the expected length?
                if (strlen($decryptedString) != FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('captcha_string_length')) {
index 6369652fcb2dfbd37b0ac37d767e0effd11e9f3d..0d8dfbd518f2481a3e72a1d0b25e1bf33397443d 100644 (file)
@@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Filter\BaseFilter;
 use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException;
 use Org\Mxchange\CoreFramework\Filter\Filterable;
 use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
+use Org\Mxchange\CoreFramework\Helper\Crypto\CryptoHelper;
 use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Response\Responseable;
@@ -109,7 +110,7 @@ class AccountPasswordVerifierFilter extends BaseFilter implements Filterable {
                $currentHash = $userInstance->getField('pass_hash');
 
                // Get an encryption helper and encrypt the password
-               $passHash = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($password, $currentHash);
+               $passHash = CryptoHelper::getSelfInstance()->hashString($password, $currentHash);
 
                // Does it match?
                if ($currentHash != $passHash) {
index 2d8c77eebf9bb23773ac6680237cf464c8556837..3093692741d5f3e9d575c96ae98fedfca9e13b82 100644 (file)
@@ -8,6 +8,7 @@ use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filter\BaseFilter;
 use Org\Mxchange\CoreFramework\Filter\Chain\FilterChainException;
 use Org\Mxchange\CoreFramework\Filter\Filterable;
+use Org\Mxchange\CoreFramework\Helper\Crypto\CryptoHelper;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Response\Responseable;
 
@@ -136,7 +137,7 @@ class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterabl
                }
 
                // Now, both are set hash the given one. First get a crypto instance
-               $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
+               $cryptoInstance = CryptoHelper::getSelfInstance();
 
                // Then hash the code
                $hashedCode = $cryptoInstance->hashString($captchaCode, $captchaHash);
index b85536f0c0b49fc749882b996959885c8e857c0d..ade0e84ce94a8b44539f9d18e3752f920a99869c 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Mxchange\CoreFramework\Helper\Captcha;
 use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
 use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
+use Org\Mxchange\CoreFramework\Helper\Crypto\CryptoHelper;
 use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
 
 /**
@@ -121,7 +122,7 @@ class GraphicalCodeCaptcha extends BaseCaptcha implements SolveableCaptcha {
                }
 
                // Get crypto instance
-               $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
+               $cryptoInstance = CryptoHelper::getSelfInstance();
 
                // Hash the CAPTCHA code for later comparison
                $this->hashedString = $cryptoInstance->hashString($captchaString);