<?php
// Own namespace
-namespace CoreFramework\Auth;
+namespace Org\Mxchange\CoreFramework\Auth;
// Import framework stuff
-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 - 2020 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
// Get a new instance
$loginInstance = new CookieAuth();
- // Set the response instance
- $loginInstance->setResponseInstance($responseInstance);
-
// Return the prepared instance
return $loginInstance;
}
* @param $userName The username from request we shall set
* @return void
*/
- public function setUserAuth ($userName) {
- $this->getResponseInstance()->addCookie('username', $userName);
+ public function setUserAuth (string $userName) {
+ FrameworkBootstrap::getResponseInstance()->addCookie('username', $userName);
}
/**
* @param $passHash The hashed password from request we shall set
* @return void
*/
- public function setPasswordAuth ($passHash) {
- $this->getResponseInstance()->addCookie('u_hash', $passHash);
+ public function setPasswordAuth (string $passHash) {
+ FrameworkBootstrap::getResponseInstance()->addCookie('u_hash', $passHash);
}
/**
*/
public function getUserAuth () {
// Get the username from cookie
- $userName = $this->getRequestInstance()->readCookie('username');
+ $userName = FrameworkBootstrap::getRequestInstance()->readCookie('username');
// Return the username
return $userName;
*/
public function getPasswordAuth () {
// Get the username from cookie
- $passHash = $this->getRequestInstance()->readCookie('u_hash');
+ $passHash = FrameworkBootstrap::getRequestInstance()->readCookie('u_hash');
// Return the username
return $passHash;
*/
public function destroyAuthData () {
// Expire both cookies
- $this->getResponseInstance()->expireCookie('username');
- $this->getResponseInstance()->expireCookie('u_hash');
+ FrameworkBootstrap::getResponseInstance()->expireCookie('username');
+ FrameworkBootstrap::getResponseInstance()->expireCookie('u_hash');
}
/**
* @return void
*/
public function updateAuthData () {
- $this->getResponseInstance()->refreshCookie('username');
- $this->getResponseInstance()->refreshCookie('u_hash');
+ FrameworkBootstrap::getResponseInstance()->refreshCookie('username');
+ FrameworkBootstrap::getResponseInstance()->refreshCookie('u_hash');
}
}