Ver Fonte

跨域问题修复

macro há 5 anos atrás
pai
commit
d11be8cc0e

+ 2 - 0
mall-security/src/main/java/com/macro/mall/security/component/RestAuthenticationEntryPoint.java

@@ -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())));