<?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
*
*
* @return void
*/
- protected function __construct () {
+ private function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
}
* @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();
* @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);
}
* @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);
}
*
* @return $userName Username to get from cookie
*/
- public function getUserAuth () {
+ public function getUserAuth (): string {
// Get the username from cookie
$userName = FrameworkBootstrap::getRequestInstance()->readCookie('username');
*
* @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');
*
* @return void
*/
- public function destroyAuthData () {
+ public function destroyAuthData (): void {
// Expire both cookies
FrameworkBootstrap::getResponseInstance()->expireCookie('username');
FrameworkBootstrap::getResponseInstance()->expireCookie('u_hash');
*
* @return void
*/
- public function updateAuthData () {
+ public function updateAuthData (): void {
FrameworkBootstrap::getResponseInstance()->refreshCookie('username');
FrameworkBootstrap::getResponseInstance()->refreshCookie('u_hash');
}