Commit 4782adaa authored by wzp's avatar wzp

修改bug

parent d5a6ed7d
......@@ -46,15 +46,20 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
@Override
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
LOGGER.info("isAccessAllowed");
if (isLoginAttempt(request, response)) {
// if (isLoginAttempt(request, response)) {
//if (!isLoginAttempt(request, response) || !executeLogin(request,response)) {
try {
executeLogin(request, response);
} catch (UnauthorizedException | AuthenticationException e) {
throw new AuthenticationException("Token失效,请重新登录", e);
}
}
return true;
} catch (UnauthorizedException e) {
// response403(request,response);
return false;
} catch (AuthenticationException ae) {
// response401(request, response);
return false;
}
// }
// return true;
}
/**
......@@ -97,8 +102,8 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
HttpServletResponse response = (HttpServletResponse) resp;
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json;charset=utf-8");
response.setStatus(401);
response.getWriter().write("{\"status\":401,\"message\":\"未登录!\"}");
response.setStatus(1109);
response.getWriter().write("{\"resultCode\":1109,\"message\":\"账号认证失败!\"}");
} catch (IOException e) {
LOGGER.error(e.getMessage());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment