From 9588ace87f407a21c57256bd63272ce7cec5f00c Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Fri, 8 Dec 2023 17:06:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1=E5=9F=9F?= =?UTF-8?q?=E5=90=8D=E6=96=87=E4=BB=B6=E8=AE=A4=E8=AF=81=E4=B8=87=E8=83=BD?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/config/shiro/ShiroConfig.java | 2 ++ .../controller/WechatVerifyController.java | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/WechatVerifyController.java diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java b/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java index 597f2650..1e205a11 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java @@ -119,6 +119,8 @@ public class ShiroConfig { filterChainDefinitionMap.put("/swagger**/**", "anon"); filterChainDefinitionMap.put("/webjars/**", "anon"); filterChainDefinitionMap.put("/v2/**", "anon"); + // 企业微信证书排除 + filterChainDefinitionMap.put("/WW_verify*", "anon"); filterChainDefinitionMap.put("/sys/annountCement/show/**", "anon"); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/WechatVerifyController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/WechatVerifyController.java new file mode 100644 index 00000000..0a41276c --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/WechatVerifyController.java @@ -0,0 +1,36 @@ +package org.jeecg.modules.system.controller; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; + +/** + * @Description: 企业微信证书验证 + * @author: wangshuai + * @date: 2023/12/6 10:42 + */ +@RestController +@Slf4j +public class WechatVerifyController { + + /** + * 企业微信验证 + */ + @RequestMapping(value = "/WW_verify_{code}.txt") + public void mpVerify(@PathVariable("code") String code, HttpServletResponse response) { + try { + PrintWriter writer = response.getWriter(); + writer.write(code); + writer.close(); + } catch (Exception e) { + log.error("企业微信证书验证失败!"); + log.error(e.getMessage(), e); + e.printStackTrace(); + } + } +} +