Procházet zdrojové kódy

系统:拦截器调整,统一异常处理,防重复提交指纹

4.0
郑根木 před 2 roky
rodič
revize
159f1147f0
1 změnil soubory, kde provedl 7 přidání a 6 odebrání
  1. +7
    -6
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/session/SessionUtil.java

+ 7
- 6
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/session/SessionUtil.java Zobrazit soubor

@@ -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, "指纹错误,请勿重复提交!");
}
}
}
}


Načítá se…
Zrušit
Uložit