| | |
| | | import com.moon.server.entity.all.*; |
| | | import com.moon.server.entity.sys.ResEntity; |
| | | import com.moon.server.entity.sys.ResLogEntity; |
| | | import com.moon.server.entity.sys.TokenEntity; |
| | | import com.moon.server.entity.sys.UserEntity; |
| | | import com.moon.server.helper.AsyncHelper; |
| | | import com.moon.server.helper.HttpHelper; |
| | |
| | | } |
| | | // 7.检查白名单和IP一致性 |
| | | if (!checkWhiteList(ip, req)) { |
| | | if (!ip.equals(sysService.tokenService.getEntityByToken(token).getIp())) { |
| | | if (!checkIpSource(ip, token)) { |
| | | return WebHelper.writeStr2Page(res, AuthInterceptor.ILLEGAL_TOKEN); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | return whiteList.contains(ip); |
| | | } |
| | | |
| | | /** |
| | | * 检查IP一致性:固定令牌不检查 |
| | | */ |
| | | private boolean checkIpSource(String ip, String token) { |
| | | TokenEntity te = sysService.tokenService.getEntityByToken(token); |
| | | |
| | | return StaticData.I1 == te.getType() || te.getIp().equals(ip); |
| | | } |
| | | |
| | | /** |
| | |
| | | String layersKey = isLower ? StaticData.LAYERS : StaticData.LAYERS.toUpperCase(); |
| | | String layers = req.getParameter(layersKey); |
| | | String request = req.getParameter(isLower ? StaticData.REQUEST : StaticData.REQUEST.toUpperCase()); |
| | | if (!StaticData.GET_CAPABILITIES.equals(request) && null != layers) { |
| | | if (!StaticData.GET_CAPABILITIES.equals(request)) { |
| | | int start = str.indexOf(layersKey); |
| | | int end = str.indexOf("&", start); |
| | | layers = filterGeoLayers(ue, layers); |
| | |
| | | */ |
| | | private String filterGeoLayers(UserEntity ue, String layers) { |
| | | List<String> tabs = StaticData.ADMIN.equals(ue.getUid()) ? permsService.selectAllTabs() : permsService.selectTabs(ue.getUid()); |
| | | if (null == tabs || tabs.isEmpty()) { |
| | | if (null == tabs || tabs.isEmpty() || StringHelper.isEmpty(layers)) { |
| | | return ""; |
| | | } |
| | | |