|
@ -145,10 +145,21 @@ public class BasicZuulFilter extends ZuulFilter {
|
|
|
}
|
|
|
//获取所有token资源
|
|
|
String resourceIds[] = urls.split(",");
|
|
|
String platform = request.getHeader("platform");
|
|
|
for (String resourceId : resourceIds) {
|
|
|
if (resourceId.equals("/**")) {
|
|
|
System.out.println("/**"+true);
|
|
|
this.checkTimeout(oAuth2AccessToken);
|
|
|
//判断用户操作间隔
|
|
|
if (null!=platform&&"city-ihealth-admin-web".equalsIgnoreCase(platform)){
|
|
|
//判断用户操作间隔
|
|
|
String userId = userAgent.getUID();
|
|
|
System.out.println(userId);
|
|
|
Boolean checkTimeOut = baseLoginLogService.checkTime(userId);
|
|
|
System.out.println("即将进入验证操作时间接口");
|
|
|
if (!checkTimeOut){
|
|
|
return this.forbidden(ctx, ResultStatus.OPERATE_TIME, "expired token");
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
if (!resourceId.startsWith("/")) {
|
|
@ -158,33 +169,34 @@ public class BasicZuulFilter extends ZuulFilter {
|
|
|
if (path.startsWith(resourceId)
|
|
|
&& (path.length() == resourceId.length() || path.charAt(resourceId.length()) == '/')) {
|
|
|
System.out.println("158"+true);
|
|
|
this.checkTimeout(oAuth2AccessToken);
|
|
|
//判断用户操作间隔
|
|
|
if (null!=platform&&"city-ihealth-admin-web".equalsIgnoreCase(platform)){
|
|
|
//判断用户操作间隔
|
|
|
String userId = userAgent.getUID();
|
|
|
System.out.println(userId);
|
|
|
Boolean checkTimeOut = baseLoginLogService.checkTime(userId);
|
|
|
System.out.println("即将进入验证操作时间接口");
|
|
|
if (!checkTimeOut){
|
|
|
return this.forbidden(ctx, ResultStatus.OPERATE_TIME, "expired token");
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
//判断用户操作间隔
|
|
|
String userId = userAgent.getUID();
|
|
|
System.out.println(userId);
|
|
|
Boolean checkTimeOut = baseLoginLogService.checkTime(userId);
|
|
|
System.out.println("即将进入验证操作时间接口");
|
|
|
if (!checkTimeOut){
|
|
|
tokenStore.removeAccessToken(oAuth2AccessToken);
|
|
|
return this.forbidden(ctx, ResultStatus.OPERATE_TIME, "expired token");
|
|
|
|
|
|
if (null!=platform&&"city-ihealth-admin-web".equalsIgnoreCase(platform)){
|
|
|
//判断用户操作间隔
|
|
|
String userId = userAgent.getUID();
|
|
|
System.out.println(userId);
|
|
|
Boolean checkTimeOut = baseLoginLogService.checkTime(userId);
|
|
|
System.out.println("即将进入验证操作时间接口");
|
|
|
if (!checkTimeOut){
|
|
|
return this.forbidden(ctx, ResultStatus.OPERATE_TIME, "expired token");
|
|
|
}
|
|
|
}
|
|
|
return this.forbidden(ctx, ResultStatus.NO_PERMI, "invalid token does not contain request resource " + path);
|
|
|
}
|
|
|
private void checkTimeout(OAuth2AccessToken oAuth2AccessToken){
|
|
|
//判断用户操作间隔
|
|
|
String userId = userAgent.getUID();
|
|
|
System.out.println(userId);
|
|
|
Boolean checkTimeOut = baseLoginLogService.checkTime(userId);
|
|
|
System.out.println("即将进入验证操作时间接口");
|
|
|
if (!checkTimeOut){
|
|
|
tokenStore.removeAccessToken(oAuth2AccessToken);
|
|
|
redisTokenStore.removeAccessToken(oAuth2AccessToken.getValue());
|
|
|
redisTokenStore.removeRefreshToken(oAuth2AccessToken.getRefreshToken().getValue());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private String extractToken(HttpServletRequest request) {
|
|
|
String accessToken = request.getHeader(ACCESS_TOKEN_PARAMETER);
|
|
|
if (null == accessToken) {
|