jwt : update docs and folding

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5285 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2019-05-24 09:14:57 +00:00
parent dfc3e94e28
commit 76548f8cf0

View File

@@ -25,6 +25,7 @@ class jwt
* @param string $key The key to be used to sign the token * @param string $key The key to be used to sign the token
* @param string|null $alg The algorithm to use to sign the token (default * @param string|null $alg The algorithm to use to sign the token (default
* is HS256) * is HS256)
* Allowed algorithms : HS256, HS512, HS384
* @return string The Token * @return string The Token
*/ */
public function encode ($payload, $key, $alg = "HS256") public function encode ($payload, $key, $alg = "HS256")
@@ -54,6 +55,7 @@ class jwt
* provided password * provided password
*/ */
public function decode ($jwt, $key, $allowedAlg = null) public function decode ($jwt, $key, $allowedAlg = null)
// {{{
{ {
if ($allowedAlg === null) if ($allowedAlg === null)
$allowedAlg = array_keys ($this->supportedAlgs); $allowedAlg = array_keys ($this->supportedAlgs);
@@ -95,6 +97,7 @@ class jwt
"JWT Signature verification failed"), 403); "JWT Signature verification failed"), 403);
return $payload; return $payload;
} }
// }}}
/** Verify the provided token with the key and generate an return true if it /** Verify the provided token with the key and generate an return true if it
* can be verify * can be verify