From eb969a5c8e705cf049b0afaf6f1f6437c7c9f736 Mon Sep 17 00:00:00 2001 From: dingxl Date: Sat, 5 Sep 2020 22:58:34 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#I1TAAP=EF=BC=8C=E8=B7=A8=E5=9F=9F?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82=E5=A6=82=E6=9E=9C=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E9=9C=80=E8=A6=81=E4=BC=A0=E9=80=92cookie=EF=BC=8C?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=AB=AF=E9=9C=80=E8=A6=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?Access-Control-Allow-Credentials=E4=B8=BAtrue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jeecg/modules/shiro/authc/aop/JwtFilter.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/authc/aop/JwtFilter.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/authc/aop/JwtFilter.java index 33210d19..7931ec60 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/authc/aop/JwtFilter.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/authc/aop/JwtFilter.java @@ -64,6 +64,10 @@ public class JwtFilter extends BasicHttpAuthenticationFilter { httpServletResponse.setHeader("Access-control-Allow-Origin", httpServletRequest.getHeader("Origin")); httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,PUT,DELETE"); httpServletResponse.setHeader("Access-Control-Allow-Headers", httpServletRequest.getHeader("Access-Control-Request-Headers")); + + // 是否允许发送Cookie,默认Cookie不包括在CORS请求之中。设为true时,表示服务器允许Cookie包含在请求中。 + httpServletResponse.setHeader("Access-Control-Allow-Credentials", "true"); + // 跨域时会首先发送一个option请求,这里我们给option请求直接返回正常状态 if (httpServletRequest.getMethod().equals(RequestMethod.OPTIONS.name())) { httpServletResponse.setStatus(HttpStatus.OK.value());