diff --git a/agileboot-common/wol-common-satoken/src/main/java/com/agileboot/common/satoken/config/SaTokenMvcConfiguration.java b/agileboot-common/wol-common-satoken/src/main/java/com/agileboot/common/satoken/config/SaTokenMvcConfiguration.java index cf4f67e..ab14f27 100644 --- a/agileboot-common/wol-common-satoken/src/main/java/com/agileboot/common/satoken/config/SaTokenMvcConfiguration.java +++ b/agileboot-common/wol-common-satoken/src/main/java/com/agileboot/common/satoken/config/SaTokenMvcConfiguration.java @@ -1,11 +1,13 @@ package com.agileboot.common.satoken.config; +import cn.dev33.satoken.exception.NotLoginException; import cn.dev33.satoken.filter.SaServletFilter; import cn.dev33.satoken.interceptor.SaInterceptor; import cn.dev33.satoken.router.SaRouter; import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.util.SaResult; import com.agileboot.common.core.constant.HttpStatus; +import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.context.annotation.Bean; @@ -17,6 +19,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; * * @author Lion Li */ +@Slf4j @AutoConfiguration @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) public class SaTokenMvcConfiguration implements WebMvcConfigurer { @@ -41,7 +44,13 @@ public class SaTokenMvcConfiguration implements WebMvcConfigurer { .setAuth(obj -> { SaRouter.match("/**", "/auth/login", StpUtil::checkLogin); }) - .setError(e -> SaResult.error("认证失败,无法访问系统资源").setCode(HttpStatus.UNAUTHORIZED)); + .setError(e -> { + if (e instanceof NotLoginException) { + return SaResult.error(e.getMessage()).setCode(HttpStatus.UNAUTHORIZED); + } + log.error("认证失败'{}',无法访问系统资源", e.getMessage()); + return SaResult.error("认证失败,无法访问系统资源").setCode(HttpStatus.UNAUTHORIZED); + }); } } diff --git a/wol-auth/src/main/resources/application.yml b/wol-auth/src/main/resources/application.yml index 398d2e6..ca1118d 100644 --- a/wol-auth/src/main/resources/application.yml +++ b/wol-auth/src/main/resources/application.yml @@ -5,7 +5,5 @@ server: spring: application: name: @application.name@ - config: - import: classpath:base.yml,classpath:nacos.yml profiles: active: dev diff --git a/wol-gateway/src/main/java/com/agileboot/gateway/config/SaTokenConfig.java b/wol-gateway/src/main/java/com/agileboot/gateway/config/SaTokenConfig.java index 4135cdc..f42bfc9 100644 --- a/wol-gateway/src/main/java/com/agileboot/gateway/config/SaTokenConfig.java +++ b/wol-gateway/src/main/java/com/agileboot/gateway/config/SaTokenConfig.java @@ -8,6 +8,7 @@ import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.util.SaResult; import com.agileboot.common.core.constant.HttpStatus; import com.agileboot.common.satoken.utils.LoginHelper; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -18,6 +19,7 @@ import org.springframework.http.server.reactive.ServerHttpRequest; * * @author Lion Li */ +@Slf4j @Configuration public class SaTokenConfig { @@ -56,6 +58,7 @@ public class SaTokenConfig { if (e instanceof NotLoginException) { return SaResult.error(e.getMessage()).setCode(HttpStatus.UNAUTHORIZED); } + log.error("认证失败'{}',无法访问系统资源", e.getMessage()); return SaResult.error("认证失败,无法访问系统资源").setCode(HttpStatus.UNAUTHORIZED); }); } diff --git a/wol-gateway/src/main/resources/application-dev.yml b/wol-gateway/src/main/resources/application-dev.yml index e0d5d0e..fad5b3a 100644 --- a/wol-gateway/src/main/resources/application-dev.yml +++ b/wol-gateway/src/main/resources/application-dev.yml @@ -9,3 +9,7 @@ spring: uri: lb://wol-auth predicates: - Path=/auth/** + - id: wol-module-codegen + uri: lb://wol-module-codegen + predicates: + - Path=/codegen/** diff --git a/wol-gateway/src/main/resources/application.yml b/wol-gateway/src/main/resources/application.yml index 9b17947..21f4f17 100644 --- a/wol-gateway/src/main/resources/application.yml +++ b/wol-gateway/src/main/resources/application.yml @@ -7,8 +7,6 @@ server: spring: application: name: @application.name@ - config: - import: classpath:base.yml,classpath:nacos.yml profiles: active: dev main: diff --git a/wol-modules/agileboot-system-base/pom.xml b/wol-modules/agileboot-system-base/pom.xml index 888a678..ba6be43 100644 --- a/wol-modules/agileboot-system-base/pom.xml +++ b/wol-modules/agileboot-system-base/pom.xml @@ -12,18 +12,6 @@ agileboot-system-base - - com.agileboot - wol-common-web - - - com.agileboot - wol-common-mybatis - - - com.agileboot - wol-domain - com.github.oshi diff --git a/wol-modules/pom.xml b/wol-modules/pom.xml index f635daa..29625bc 100644 --- a/wol-modules/pom.xml +++ b/wol-modules/pom.xml @@ -15,5 +15,31 @@ wol-module-ai + + + com.agileboot + wol-common-nacos + + + com.agileboot + wol-common-satoken + + + com.agileboot + wol-common-web + + + com.agileboot + wol-common-mybatis + + + com.agileboot + wol-common-redis + + + com.agileboot + wol-domain + + diff --git a/wol-modules/wol-module-codegen/pom.xml b/wol-modules/wol-module-codegen/pom.xml index cccd52f..763f7d7 100644 --- a/wol-modules/wol-module-codegen/pom.xml +++ b/wol-modules/wol-module-codegen/pom.xml @@ -17,15 +17,6 @@ - - com.agileboot - wol-common-web - - - com.agileboot - wol-common-mybatis - - org.springframework.boot diff --git a/wol-modules/wol-module-codegen/src/main/resources/application.yml b/wol-modules/wol-module-codegen/src/main/resources/application.yml index 3307b1c..99f7307 100644 --- a/wol-modules/wol-module-codegen/src/main/resources/application.yml +++ b/wol-modules/wol-module-codegen/src/main/resources/application.yml @@ -3,5 +3,3 @@ server: spring: application: name: @application.name@ - config: - import: classpath:base.yml diff --git a/wol-modules/wol-module-codegen/src/main/resources/bootstrap.yml b/wol-modules/wol-module-codegen/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..c74ed41 --- /dev/null +++ b/wol-modules/wol-module-codegen/src/main/resources/bootstrap.yml @@ -0,0 +1,5 @@ +spring: + application: + name: @application.name@ + config: + import: classpath:base.yml,classpath:nacos.yml