对所有存在userId的请求进行鉴权

master
yangjie 4 years ago
parent a496c7b643
commit 379426bad0
  1. 11
      src/main/java/com/yipin/liuwanr/filter/AuthInterceptor.java

@ -38,15 +38,16 @@ public class AuthInterceptor implements HandlerInterceptor {
Object loginStatus = ops.get(token); Object loginStatus = ops.get(token);
//userid //userid
String userId = request.getParameter("userId"); String userId = request.getParameter("userId");
if (!StringUtils.isEmpty(userId)){
return userId.equals(ops.get(token));
}
if( Objects.isNull(loginStatus)){ if( Objects.isNull(loginStatus)){
response.getWriter().print("1");//token错误 response.getWriter().print("1");//token错误
return false; return false;
}else {
if (!StringUtils.isEmpty(userId)){
return userId.equals(loginStatus);
}else {
return false;
}
} }
return true;
} }
@Override @Override

Loading…
Cancel
Save