Skip to content

Commit be5a7af

Browse files
author
WeiziPlus
committed
过滤器可以选择是否检验时间戳
1 parent 3591d94 commit be5a7af

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

springboot/demo-pc/src/main/java/com/weiziplus/pc/common/interceptor/AuthorizationInterceptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ private boolean handleTimeStamp(HttpServletRequest request) {
7373
}
7474
long timeMillis = System.currentTimeMillis();
7575
Long timeStampLong = Long.valueOf(timeStamp);
76-
int allowTime = 120000;
77-
//如果请求时间戳和服务器当前时间相差超过120秒,本次请求失败
76+
int allowTime = 180000;
77+
//如果请求时间戳和服务器当前时间相差超过3分钟,本次请求失败
7878
return allowTime > Math.abs(timeMillis - timeStampLong);
7979
}
8080

springboot/demo-web/src/main/java/com/weiziplus/web/common/interceptor/AuthorizationInterceptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ private boolean handleTimeStamp(HttpServletRequest request) {
6969
}
7070
long timeMillis = System.currentTimeMillis();
7171
Long timeStampLong = Long.valueOf(timeStamp);
72-
int allowTime = 120000;
73-
//如果请求时间戳和服务器当前时间相差超过120秒,本次请求失败
72+
int allowTime = 180000;
73+
//如果请求时间戳和服务器当前时间相差超过3分钟,本次请求失败
7474
return allowTime > Math.abs(timeMillis - timeStampLong);
7575
}
7676

0 commit comments

Comments
 (0)