]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/filter/auth/class_UserAuthFilter.php
Continued:
[core.git] / framework / main / classes / filter / auth / class_UserAuthFilter.php
index bab1a5b1e4f7f8e6fee36fe9b3cfac5b97b78d81..41d9b135a71d89ecaaebc1d1e1fe528c38653bf1 100644 (file)
@@ -3,11 +3,13 @@
 namespace Org\Mxchange\CoreFramework\Filter\User\Auth;
 
 // Import framework stuff
-use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
 use Org\Mxchange\CoreFramework\Filter\BaseFilter;
 use Org\Mxchange\CoreFramework\Filter\Filterable;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 use Org\Mxchange\CoreFramework\Loader\NoClassException;
-use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+use Org\Mxchange\CoreFramework\Registry\Object\ObjectRegistry;
 use Org\Mxchange\CoreFramework\Request\Requestable;
 use Org\Mxchange\CoreFramework\Response\Responseable;
 use Org\Mxchange\CoreFramework\User\BaseUser;
@@ -17,7 +19,7 @@ use Org\Mxchange\CoreFramework\User\BaseUser;
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -48,7 +50,7 @@ class UserAuthFilter extends BaseFilter implements Filterable {
         *
         * @return      void
         */
-       protected function __construct () {
+       private function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
        }
@@ -75,7 +77,7 @@ class UserAuthFilter extends BaseFilter implements Filterable {
         * @return      void
         */
        protected function setDefaultAuthMethod () {
-               $this->authMethod = $this->getConfigInstance()->getConfigEntry('auth_method_class');
+               $this->authMethod = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('auth_method_class');
        }
 
        /**
@@ -102,44 +104,44 @@ class UserAuthFilter extends BaseFilter implements Filterable {
                        $authInstance->destroyAuthData();
 
                        // Mark the request as invalid
-                       $requestInstance->requestIsValid(false);
+                       $requestInstance->setIsRequestValid(FALSE);
 
                        // Add fatal message
                        $responseInstance->addFatalMessage('auth_data_incomplete');
 
                        // Stop here
                        throw new UserAuthorizationException($this, self::EXCEPTION_AUTH_DATA_INVALID);
-               } // END - if
+               }
 
                // Regular user account
-               $className = $this->getConfigInstance()->getConfigEntry('user_class');
+               $className = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_class');
                $methodName = 'createMemberByUserName';
 
                // Now, try to get a user or guest instance
-               if ($authLogin == $this->getConfigInstance()->getConfigEntry('guest_login_user')) {
+               if ($authLogin == FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('guest_login_user')) {
                        // Set class
-                       $className = $this->getConfigInstance()->getConfigEntry('guest_class');
+                       $className = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('guest_class');
                        $methodName = 'createGuestByUserName';
-               } // END - if
+               }
 
                // Does the guest class exist?
                if (!class_exists($className)) {
                        // Then abort here
-                       throw new NoClassException (array($this, $className), self::EXCEPTION_CLASS_NOT_FOUND);
-               } // END - if
+                       throw new NoClassException ([$this, $className], FrameworkInterface::EXCEPTION_CLASS_NOT_FOUND);
+               }
 
                // Now try the dynamic login
-               $userInstance = call_user_func_array(array($className, $methodName), array($authLogin));
+               $userInstance = call_user_func_array([$className, $methodName], [$authLogin]);
 
                // Is the password correct?
                if ($userInstance->getPasswordHash() !== $authHash) {
                        // Mismatching password
                        throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH);
-               } // END - if
+               }
 
                // Remember auth and user instances in registry
-               GenericRegistry::getRegistry()->addInstance('auth', $authInstance);
-               GenericRegistry::getRegistry()->addInstance('user', $userInstance);
+               ObjectRegistry::getRegistry('generic')->addInstance('auth', $authInstance);
+               ObjectRegistry::getRegistry('generic')->addInstance('user', $userInstance);
        }
 
 }