对所有存在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);
//userid
String userId = request.getParameter("userId");
if (!StringUtils.isEmpty(userId)){
return userId.equals(ops.get(token));
}
if( Objects.isNull(loginStatus)){
response.getWriter().print("1");//token错误
return false;
}else {
if (!StringUtils.isEmpty(userId)){
return userId.equals(loginStatus);
}else {
return false;
}
}
return true;
}
@Override

Loading…
Cancel
Save