]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/auth/class_CookieAuth.php
Continued:
[core.git] / framework / main / classes / auth / class_CookieAuth.php
index f1c38e4098e7fa8b47814c0a40b786082ea1dea1..5ea4d9dcf38683f89c132b70c1479876141918b4 100644 (file)
@@ -1,19 +1,19 @@
 <?php
 // Own namespace
-namespace CoreFramework\Auth;
+namespace Org\Mxchange\CoreFramework\Auth;
 
 // Import framework stuff
-use CoreFramework\Bootstrap\FrameworkBootstrap;
-use CoreFramework\Object\BaseFrameworkSystem;
-use CoreFramework\Registry\Registerable;
-use CoreFramework\Response\Responseable;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Response\Responseable;
 
 /**
  * A cookie-bases authorization class
  *
  * @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
  *
@@ -36,7 +36,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         *
         * @return      void
         */
-       protected function __construct () {
+       private function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
        }
@@ -47,7 +47,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         * @param       $responseInstance       An instance of a Responseable class
         * @return      $loginInstance          An instance of this login class
         */
-       public static final function createCookieAuth (Responseable $responseInstance) {
+       public static final function createCookieAuth (Responseable $responseInstance): Authorizeable {
                // Get a new instance
                $loginInstance = new CookieAuth();
 
@@ -61,7 +61,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         * @param       $userName       The username from request we shall set
         * @return      void
         */
-       public function setUserAuth ($userName) {
+       public function setUserAuth (string $userName): void {
                FrameworkBootstrap::getResponseInstance()->addCookie('username', $userName);
        }
 
@@ -71,7 +71,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         * @param       $passHash       The hashed password from request we shall set
         * @return      void
         */
-       public function setPasswordAuth ($passHash) {
+       public function setPasswordAuth (string $passHash): void {
                FrameworkBootstrap::getResponseInstance()->addCookie('u_hash', $passHash);
        }
 
@@ -80,7 +80,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         *
         * @return      $userName       Username to get from cookie
         */
-       public function getUserAuth () {
+       public function getUserAuth (): string {
                // Get the username from cookie
                $userName = FrameworkBootstrap::getRequestInstance()->readCookie('username');
 
@@ -93,7 +93,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         *
         * @return      $passHash       Password hash to get from cookie
         */
-       public function getPasswordAuth () {
+       public function getPasswordAuth (): string {
                // Get the username from cookie
                $passHash = FrameworkBootstrap::getRequestInstance()->readCookie('u_hash');
 
@@ -106,7 +106,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         *
         * @return      void
         */
-       public function destroyAuthData () {
+       public function destroyAuthData (): void {
                // Expire both cookies
                FrameworkBootstrap::getResponseInstance()->expireCookie('username');
                FrameworkBootstrap::getResponseInstance()->expireCookie('u_hash');
@@ -117,7 +117,7 @@ class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registera
         *
         * @return      void
         */
-       public function updateAuthData () {
+       public function updateAuthData (): void {
                FrameworkBootstrap::getResponseInstance()->refreshCookie('username');
                FrameworkBootstrap::getResponseInstance()->refreshCookie('u_hash');
        }