From ab2e3e657350c7b93483bdcd33c416a1f73a46b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E7=8E=89=E7=A5=A5?= Date: Sat, 29 Oct 2022 14:49:06 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E5=A4=8DC=E7=AB=AF=E6=8E=A5=E5=8F=A3=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiaonuo/core/config/GlobalConfigure.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/snowy-web-app/src/main/java/vip/xiaonuo/core/config/GlobalConfigure.java b/snowy-web-app/src/main/java/vip/xiaonuo/core/config/GlobalConfigure.java index a7ccc505..c1cd344b 100644 --- a/snowy-web-app/src/main/java/vip/xiaonuo/core/config/GlobalConfigure.java +++ b/snowy-web-app/src/main/java/vip/xiaonuo/core/config/GlobalConfigure.java @@ -55,6 +55,7 @@ import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import vip.xiaonuo.auth.core.util.StpClientUtil; import vip.xiaonuo.common.annotation.CommonNoRepeat; import vip.xiaonuo.common.annotation.CommonWrapper; import vip.xiaonuo.common.enums.CommonDeleteFlagEnum; @@ -180,11 +181,31 @@ public class GlobalConfigure implements WebMvcConfigurer { // 设置鉴权的接口 .setAuth(r -> { + // B端的接口校验B端登录 SaRouter.match("/**") + // 排除无需登录接口 .notMatch(CollectionUtil.newArrayList(NO_LOGIN_PATH_ARR)) + // 排除C端认证接口 + .notMatch("/auth/c/**") + // 校验B端登录 .check(r1 -> StpUtil.checkLogin()); - SaRouter.match(CollectionUtil.newArrayList(SUPER_PERMISSION_PATH_ARR)) + + // C端的接口校验C端登录 + SaRouter.match("/**") + // 排除无需登录接口 .notMatch(CollectionUtil.newArrayList(NO_LOGIN_PATH_ARR)) + // 匹配C端认证接口 + .match("/auth/c/**") + // 校验C端登录 + .check(r1 -> StpClientUtil.checkLogin()); + + // B端的超管接口校验B端超管角色 + SaRouter.match("/**") + // 排除无需登录接口 + .notMatch(CollectionUtil.newArrayList(NO_LOGIN_PATH_ARR)) + // 匹配超管接口 + .match(CollectionUtil.newArrayList(SUPER_PERMISSION_PATH_ARR)) + // 校验B端超管角色 .check(r1 -> StpUtil.checkRole(SysBuildInEnum.BUILD_IN_ROLE_CODE.getValue())); })