diff options
author | Redian <redian.ibra@gmail.com> | 2014-03-13 16:45:43 +0000 |
---|---|---|
committer | Redian <redian.ibra@gmail.com> | 2014-03-13 16:45:43 +0000 |
commit | 280bf6b9cded67f0edc1ed724fef6c18cbb6edf4 (patch) | |
tree | 6cb33c5fbe6e9dad4240cd62b857dac32e1b450b | |
parent | 53669d621149e49c2a428722a62acfef3342c260 (diff) | |
download | php-jwt-280bf6b9cded67f0edc1ed724fef6c18cbb6edf4.zip php-jwt-280bf6b9cded67f0edc1ed724fef6c18cbb6edf4.tar.gz php-jwt-280bf6b9cded67f0edc1ed724fef6c18cbb6edf4.tar.bz2 |
Checking the token expiry time
Checking if our token has expired.
-rw-r--r-- | Authentication/JWT.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Authentication/JWT.php b/Authentication/JWT.php index 7a7b4a0..afceed6 100644 --- a/Authentication/JWT.php +++ b/Authentication/JWT.php @@ -61,6 +61,11 @@ class JWT if ($sig != JWT::sign("$headb64.$bodyb64", $key, $header->alg)) { throw new UnexpectedValueException('Signature verification failed'); } + // Check token expiry time if defined. + if (isset($payload->exp) && time() >= $payload->exp){ + throw new UnexpectedValueException('Expired Token'); + } + } return $payload; } |