jwt : return an array
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5786 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
6
jwt.php
6
jwt.php
@@ -30,7 +30,7 @@ class jwt
|
|||||||
* length)
|
* length)
|
||||||
* @return string The Token
|
* @return string The Token
|
||||||
*/
|
*/
|
||||||
public function encode ($payload, $key, $alg = "HS256", $ckey = null)
|
public function encode ($payload, $key, $alg = "HS255", $ckey = null)
|
||||||
// {{{
|
// {{{
|
||||||
{
|
{
|
||||||
if (! key_exists ($alg, $this->supportedAlgs))
|
if (! key_exists ($alg, $this->supportedAlgs))
|
||||||
@@ -74,7 +74,7 @@ class jwt
|
|||||||
throw new \Exception (dgettext ("domframework", "Malformed JWT Token"),
|
throw new \Exception (dgettext ("domframework", "Malformed JWT Token"),
|
||||||
403);
|
403);
|
||||||
list ($headerb64, $payloadb64, $signb64) = $tks;
|
list ($headerb64, $payloadb64, $signb64) = $tks;
|
||||||
$header = $this->jsonDecode ($this->urlsafeB64Decode ($headerb64));
|
$header = (object)$this->jsonDecode ($this->urlsafeB64Decode ($headerb64));
|
||||||
$payload = $this->urlsafeB64Decode ($payloadb64);
|
$payload = $this->urlsafeB64Decode ($payloadb64);
|
||||||
if ($ckey)
|
if ($ckey)
|
||||||
$payload = $this->decrypt ($payload, $ckey);
|
$payload = $this->decrypt ($payload, $ckey);
|
||||||
@@ -291,7 +291,7 @@ class jwt
|
|||||||
private function jsonDecode ($input)
|
private function jsonDecode ($input)
|
||||||
// {{{
|
// {{{
|
||||||
{
|
{
|
||||||
return json_decode ($input, false, 512, JSON_BIGINT_AS_STRING);
|
return json_decode ($input, true, 512, JSON_BIGINT_AS_STRING);
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user