add method

This commit is contained in:
Looly
2022-10-26 10:54:56 +08:00
parent 6064586ef9
commit c79cdc1f6f
17 changed files with 131 additions and 103 deletions

View File

@@ -388,7 +388,7 @@ public class JWT implements RegisteredPayload<JWT> {
// 校验时间字段
try {
JWTValidator.of(this).validateDate(DateUtil.date(), leeway);
JWTValidator.of(this).validateDate(DateUtil.now(), leeway);
} catch (final ValidateException e) {
return false;
}

View File

@@ -90,7 +90,7 @@ public class JWTValidator {
* @since 5.7.3
*/
public JWTValidator validateDate() throws ValidateException {
return validateDate(DateUtil.beginOfSecond(DateUtil.date()));
return validateDate(DateUtil.beginOfSecond(DateUtil.now()));
}
/**
@@ -190,7 +190,7 @@ public class JWTValidator {
private static void validateDate(final JWTPayload payload, Date now, final long leeway) throws ValidateException {
if (null == now) {
// 默认当前时间
now = DateUtil.date();
now = DateUtil.now();
// truncate millis
now.setTime(now.getTime() / 1000 * 1000);
}