Skip to content

Commit

Permalink
fix: only check iat if nbf is not used (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
croensch authored May 23, 2023
1 parent 6c8f5e7 commit 398ccd2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/JWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public static function decode(
// Check that this token has been created before 'now'. This prevents
// using tokens that have been created for later use (and haven't
// correctly used the nbf claim).
if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) {
if (!isset($payload->nbf) && isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) {
throw new BeforeValidException(
'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->iat)
);
Expand Down

0 comments on commit 398ccd2

Please sign in to comment.