wangjun před 4 roky
rodič
revize
ef5191bbd4

+ 29 - 19
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java

@ -145,16 +145,20 @@ 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);
                //判断用户操作间隔
                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");
                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;
            }
@ -166,23 +170,29 @@ public class BasicZuulFilter extends ZuulFilter {
                    && (path.length() == resourceId.length() || path.charAt(resourceId.length()) == '/')) {
                System.out.println("158"+true);
                //判断用户操作间隔
                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");
                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){
            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);
    }