From 6b64eb453efe113cadac9b1fe6a26e0dfbe30146 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 9 Dec 2019 14:17:47 +0000 Subject: [PATCH] authentication : bad $auth usage git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5821 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- authentication.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/authentication.php b/authentication.php index dfbbad4..517ba71 100644 --- a/authentication.php +++ b/authentication.php @@ -125,6 +125,18 @@ class authentication if ($this->route->debug) echo "Unset the JSON Web Token '$tokenName'
\n"; echo "\n"; + $algorithm = "HS256"; + $cipherKey = null; + $cacheDir = "data/jwtCache"; + $authjwt = new authjwt (); + $authjwt->serverKey = $this->authServers["authjwt"]["serverKey"]; + if (isset ($this->authServers["authjwt"]["cipherKey"])) + $authjwt->cipherKey = $this->authServers["authjwt"]["cipherKey"]; + if (isset ($this->authServers["authjwt"]["algorithm"])) + $authjwt->algorithm = $this->authServers["authjwt"]["algorithm"]; + if (isset ($this->authServers["authjwt"]["cacheDir"])) + $authjwt->cacheDir = $this->authServers["authjwt"]["cacheDir"]; + $authjwt->logout (); } if ($this->debug) echo "Redirect to authentication page"; if ($this->debug) $this->route->debug = $this->debug; @@ -312,9 +324,9 @@ class authentication if (isset ($this->authServers["authjwt"]["cacheDir"])) $cacheDir = $this->authServers["authjwt"]["cacheDir"]; $payloadArray = array(); - $payloadArray["email"] = $payload; - if (is_array ($payload)) - $payloadArray = $payload; + $payloadArray["email"] = $auth; + if (is_array ($auth)) + $payloadArray = $auth; if (! key_exists ("email", $payloadArray) || $payloadArray["email"] === "anonymous") throw new \Exception ("JWT Must authenticate", 401);