跨域问题修复

This commit is contained in:
macro 2020-04-03 20:14:04 +08:00
parent 56bd15494e
commit d11be8cc0e

View File

@ -18,6 +18,8 @@ import java.io.IOException;
public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Cache-Control","no-cache");
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
response.getWriter().println(JSONUtil.parse(CommonResult.unauthorized(authException.getMessage())));