authjwt : Update property name
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5291 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -6,12 +6,15 @@
|
||||
|
||||
require_once ("domframework/jwt.php");
|
||||
|
||||
/** User authentication against JSON Web Token */
|
||||
/** User authentication against JSON Web Token
|
||||
* To use it, the $serverKey must be defined. It can be created by example,
|
||||
* by using $serverKey = sha1 (microtime (true));
|
||||
*/
|
||||
class authjwt extends auth
|
||||
{
|
||||
/** The JSON Web Token Server key if used
|
||||
*/
|
||||
public $jwtServerKey = null;
|
||||
public $serverKey = null;
|
||||
|
||||
/** If the user is valid, return the email in details
|
||||
*/
|
||||
@@ -41,7 +44,7 @@ class authjwt extends auth
|
||||
throw new \Exception ("No Bearer Authentication available", 401);
|
||||
$token = substr ($_SERVER["HTTP_AUTHENTICATION"], 7);
|
||||
$jwt = new jwt ();
|
||||
$payload = $jwt->decode ($token, $this->jwtServerKey);
|
||||
$payload = $jwt->decode ($token, $this->serverKey);
|
||||
if (! key_exists ("email", $payload))
|
||||
return null;
|
||||
// The JWT was tested in authparams. End of process
|
||||
|
||||
Reference in New Issue
Block a user