| | |
| | | private String[] excludeUrls; |
| | | |
| | | /** |
| | | * 非法请求返回结果 |
| | | * 非法请求返回结果 |
| | | */ |
| | | private String forbidden = JSONObject.toJSONString(new Result(false,Result.CODE_FORBIDDEN)); |
| | | |
| | |
| | | |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException { |
| | | // 从配置文件中获取excludeUrls |
| | | // 从配置文件中获取excludeUrls |
| | | String excludeUrl = sccConfig.getExcludeUrl(); |
| | | |
| | | if (!StringUtils.isEmpty(excludeUrl)) { |
| | |
| | | String url = httpRequest.getRequestURI(); |
| | | log.debug("request URI:" + url); |
| | | |
| | | // 是否略过 |
| | | // 是否略过 |
| | | if (ArrayUtils.isEmpty(excludeUrls) || isExclude(httpRequest)) { |
| | | filterChain.doFilter(httpRequest, httpResponse); |
| | | return; |
| | | } |
| | | |
| | | //是否合法 |
| | | //是否合法 |
| | | // if(!licenseService.isValid()) { |
| | | // log.debug("license invalid"); |
| | | // forbiddenAsLicense(httpResponse); |
| | | // return; |
| | | // } |
| | | //// forbiddenAsLicense(httpResponse); |
| | | //// return; |
| | | //// } |
| | | |
| | | if (!addClientInfo(httpRequest)) { |
| | | log.debug("非法请求:" + httpRequest.getRequestURI()); |
| | | log.debug("非法请求:" + httpRequest.getRequestURI()); |
| | | forbidden(httpResponse); |
| | | return; |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 绑定客户端信息 |
| | | * 绑定客户端信息 |
| | | * |
| | | * @param httpRequest |
| | | * @param cookieKey |
| | |
| | | return false; |
| | | } |
| | | |
| | | //获取用户对应的sessionId是否与保存在redis中的一致,如果不一致,如果不一致则跳转到登录页面 |
| | | //获取用户对应的sessionId是否与保存在redis中的一致,如果不一致,如果不一致则跳转到登录页面 |
| | | //String currOnlineSessinId = (String) stringRedisTemplate.opsForHash().get(UserInfoWrapper.REDIS_USER_ONLINE_MAP_KEY, wrapper.getInfo(UserInfoWrapper.INF_USER_ID)); |
| | | |
| | | //如果不存在,则返回 |
| | | //如果不存在,则返回 |
| | | // if(!session.getId().equalsIgnoreCase(currOnlineSessinId)){ |
| | | // session.invalidate(); |
| | | // return false; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 是否过滤掉 |
| | | * 是否过滤掉 |
| | | * |
| | | * @param httpRequest |
| | | * @return |