From 159f1147f064471d7f32a6f036b450e64f5bd9ae Mon Sep 17 00:00:00 2001 From: zhenggm Date: Thu, 8 Sep 2022 18:49:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=EF=BC=9A=E6=8B=A6=E6=88=AA?= =?UTF-8?q?=E5=99=A8=E8=B0=83=E6=95=B4=EF=BC=8C=E7=BB=9F=E4=B8=80=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=A4=84=E7=90=86=EF=BC=8C=E9=98=B2=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=8C=87=E7=BA=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cc/smtweb/framework/core/session/SessionUtil.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/session/SessionUtil.java b/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/session/SessionUtil.java index 60f9b51..91b02d2 100644 --- a/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/session/SessionUtil.java +++ b/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/session/SessionUtil.java @@ -170,12 +170,13 @@ public class SessionUtil { //校验指纹 String fpKey = us != null ? String.valueOf(us.getUserId()): request.getSession(true).getId(); int fpv = readFingerVal(request); - - SessionCache cache = SessionCacheFactory.getInstance().getCache(KEY_PARAM_FP_KEY, 1200L); - AtomicInteger ai = cache.get(fpKey + "_" + fpk); - int bv = ai != null ? ai.get() : 0; - if (fpv != bv) { - throw new BizException(SwConsts.ErrorCode.TOKEN_INVALID, "指纹错误,请勿重复提交!"); + if (fpv > 0) { + SessionCache cache = SessionCacheFactory.getInstance().getCache(KEY_PARAM_FP_KEY, 1200L); + AtomicInteger ai = cache.get(fpKey + "_" + fpk); + int bv = ai != null ? ai.get(): 0; + if (fpv != bv) { + throw new BizException(SwConsts.ErrorCode.TOKEN_INVALID, "指纹错误,请勿重复提交!"); + } } } }