authjwt : return all the token instead of just email

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5808 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2019-12-08 19:26:55 +00:00
parent 40ba4a155a
commit f2f7a5f0c6

View File

@@ -45,6 +45,8 @@ class authjwt extends auth
// }}}
/** Try to authenticate the email/password of the user
* If the token is valid, return all the data available in payload. Can
* return a value without email attribute !
* @param string $email Email not used (wait for Bearer)
* @param string $password Password not used (wait for Bearer)
*/
@@ -64,11 +66,17 @@ class authjwt extends auth
$this->payload = (array)$payload;
$this->payload["bearer"] = substr ($_SERVER["HTTP_AUTHENTICATION"], 7);
}
if (! key_exists ("email", $this->payload))
else
{
$this->payload = array ("lastname" => "anonymous",
"firstname" => "",
"email" => "anonymous");
throw new \Exception ("No email available in Bearer", 403);
}
}
/** Return all the parameters recorded for the authenticate user */
/** Return all the parameters recorded for the authenticate user
*/
public function getdetails ()
{
if ($this->payload["email"] === "anonymous")