| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 检查IP一致性:固定令牌不检查 |
| | | */ |
| | | private boolean checkIpSource(String ip, String token) { |
| | | TokenEntity te = sysService.tokenService.getEntityByToken(token); |
| | | |
| | | return StaticData.I1 == te.getType() || te.getIp().equals(ip); |
| | | } |
| | | |
| | | /** |
| | | * 检查资源权限 |
| | | */ |
| | | private ResEntity getResEntity(UserEntity ue, int resId) { |