|
|
|
@ -18,13 +18,6 @@ import java.util.Map;
|
|
|
|
|
public class IsLoginInterceptor implements Interceptor {
|
|
|
|
|
@Override
|
|
|
|
|
public void intercept(Invocation inv) {
|
|
|
|
|
// //增加IP范围检查,在合法的范围内就放行即可 2022-12-09
|
|
|
|
|
// boolean flag = CommonUtil.checkAllowIpAddress(inv.getController().getRequest());
|
|
|
|
|
// if(flag) {
|
|
|
|
|
// inv.invoke();
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//正常的登录验证逻辑代码
|
|
|
|
|
IsLoginInterface annotation = inv.getMethod().getAnnotation(IsLoginInterface.class);
|
|
|
|
|
if (annotation != null) {
|
|
|
|
@ -41,32 +34,10 @@ public class IsLoginInterceptor implements Interceptor {
|
|
|
|
|
inv.invoke();
|
|
|
|
|
}
|
|
|
|
|
//1、读取cookie,获取所有本域下的配置值
|
|
|
|
|
boolean isTrue;
|
|
|
|
|
|
|
|
|
|
boolean isTrue = false;
|
|
|
|
|
|
|
|
|
|
if ((con.getCookie("toupiaoren_tel"))==null || (con.getCookie("person_id") == null) || (con.getCookie("bureau_id") == null) ||
|
|
|
|
|
(con.getCookie("identity_id") == null || (con.getCookie("org_code") == null))) {
|
|
|
|
|
isTrue = false;
|
|
|
|
|
} else {
|
|
|
|
|
Map loginMap = new HashMap<String, String>();
|
|
|
|
|
loginMap.put("identity_id", con.getCookie("identity_id"));
|
|
|
|
|
loginMap.put("person_id", con.getCookie("person_id"));
|
|
|
|
|
loginMap.put("bureau_id", con.getCookie("bureau_id"));
|
|
|
|
|
loginMap.put("org_code", con.getCookie("org_code"));
|
|
|
|
|
//2、根据cookie中获取到的map,得到一个 share
|
|
|
|
|
String token = CommonUtil.Sign(loginMap, PropKit.get("CookieMd5SingPwd"));
|
|
|
|
|
//3、与cookie中的token进行对比
|
|
|
|
|
if (token.equals(con.getCookie("token"))) {
|
|
|
|
|
isTrue = true;
|
|
|
|
|
} else {
|
|
|
|
|
//清空cookie
|
|
|
|
|
con.setCookie("bureau_id", null, 0, true);
|
|
|
|
|
con.setCookie("identity_id", null, 0, true);
|
|
|
|
|
con.setCookie("person_id", null, 0, true);
|
|
|
|
|
con.setCookie("org_code", null, 0, true);
|
|
|
|
|
con.setCookie("token", null, 0, true);
|
|
|
|
|
isTrue = false;
|
|
|
|
|
}
|
|
|
|
|
if ((con.getCookie("toupiaoren_tel")) != null || (con.getCookie("person_id") != null)) {
|
|
|
|
|
isTrue = true;
|
|
|
|
|
}
|
|
|
|
|
if (isTrue) {
|
|
|
|
|
inv.invoke();
|
|
|
|
|