记得上下班打卡 | git大法好,push需谨慎

Commit 1197111d authored by 姜秀龙's avatar 姜秀龙

Merge branch 'jxl-datongfensi' into container-test

parents a8cf8150 3b6f11a9
...@@ -8,8 +8,7 @@ import javax.crypto.Mac; ...@@ -8,8 +8,7 @@ import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.time.LocalDateTime; import java.time.Instant;
import java.time.ZoneOffset;
/** /**
* 静默登录 v2:otp = hex(HMAC-SHA256(secret, mobile + Unix秒UTC)),与 v1 DES 隔离。 * 静默登录 v2:otp = hex(HMAC-SHA256(secret, mobile + Unix秒UTC)),与 v1 DES 隔离。
...@@ -32,7 +31,7 @@ public class SilentMobileOtpV2Support { ...@@ -32,7 +31,7 @@ public class SilentMobileOtpV2Support {
if (!otp.matches("^[0-9a-fA-F]{64}$")) { if (!otp.matches("^[0-9a-fA-F]{64}$")) {
return false; return false;
} }
long now = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC); long now = Instant.now().getEpochSecond();
long from = now - windowSeconds; long from = now - windowSeconds;
if (from < 0) { if (from < 0) {
from = 0; from = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment