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:
12
authjwt.php
12
authjwt.php
@@ -45,6 +45,8 @@ class authjwt extends auth
|
|||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
/** Try to authenticate the email/password of the user
|
/** 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 $email Email not used (wait for Bearer)
|
||||||
* @param string $password Password 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 = (array)$payload;
|
||||||
$this->payload["bearer"] = substr ($_SERVER["HTTP_AUTHENTICATION"], 7);
|
$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);
|
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 ()
|
public function getdetails ()
|
||||||
{
|
{
|
||||||
if ($this->payload["email"] === "anonymous")
|
if ($this->payload["email"] === "anonymous")
|
||||||
|
|||||||
Reference in New Issue
Block a user