summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Authentication/JWT.php5
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;
}