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);