This commit is contained in:
mkm 2023-11-20 17:20:46 +08:00
parent 9513aceba0
commit b1d1d54187

View File

@ -139,20 +139,20 @@ class JWT
// Check the nbf if it is defined. This is the time that the // Check the nbf if it is defined. This is the time that the
// token can actually be used. If it's not yet that time, abort. // token can actually be used. If it's not yet that time, abort.
// 取消时间验证 // 取消时间验证
// if (isset($payload->nbf) && $payload->nbf > ($timestamp + static::$leeway)) { if (isset($payload->nbf) && $payload->nbf > ($timestamp + static::$leeway)) {
// throw new BeforeValidException( throw new BeforeValidException(
// 'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->nbf) 'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->nbf)
// ); );
// } }
// Check that this token has been created before 'now'. This prevents // Check that this token has been created before 'now'. This prevents
// using tokens that have been created for later use (and haven't // using tokens that have been created for later use (and haven't
// correctly used the nbf claim). // correctly used the nbf claim).
// if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) { if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) {
// throw new BeforeValidException( throw new BeforeValidException(
// 'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->iat) 'Cannot handle token prior to ' . \date(DateTime::ISO8601, $payload->iat)
// ); );
// } }
// Check if this token has expired. // Check if this token has expired.
if (isset($payload->exp) && ($timestamp - static::$leeway) >= $payload->exp) { if (isset($payload->exp) && ($timestamp - static::$leeway) >= $payload->exp) {