diff --git a/README.md b/README.md index 32fd4c3926bd807c79d3cff731bb50c7b3c3dd44..3d1d61d825e6dcf5de2f495f0d386010ed47bb1f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # zlt-microservices-platform

- Downloads - Downloads + Downloads + Downloads Downloads Downloads Downloads diff --git a/pom.xml b/pom.xml index d0004a8ae23af5e2338567dee592d75d481f9f5f..cd9c7b6c0e6780dad7163ffe83f896da23cb6f69 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.zlt central-platform - 5.3.0 + 5.4.0 pom @@ -14,7 +14,7 @@ UTF-8 8 2021.1 - 2.5.13 + 2.5.14 2020.0.5 4.4 2.0.1 diff --git a/zlt-business/code-generator/pom.xml b/zlt-business/code-generator/pom.xml index a0bdc4216f32a40f42459fb283b42bd337f0abd5..276283ad888ba7078adb913bb01fd2b772847125 100644 --- a/zlt-business/code-generator/pom.xml +++ b/zlt-business/code-generator/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-business - 5.3.0 + 5.4.0 code-generator diff --git a/zlt-business/file-center/pom.xml b/zlt-business/file-center/pom.xml index 351485ff19b5e75761def0c106f4c8e070474f06..38a2e06f76144c28ce2f3175fdebc9c452aca3de 100644 --- a/zlt-business/file-center/pom.xml +++ b/zlt-business/file-center/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-business - 5.3.0 + 5.4.0 file-center 文件中心 diff --git a/zlt-business/pom.xml b/zlt-business/pom.xml index dffd738b079cdd2a69d4a358658c2ae00277a25f..a5ec9e4f0fe6d18af2d6f032edf48bd4c5c2d05f 100644 --- a/zlt-business/pom.xml +++ b/zlt-business/pom.xml @@ -4,7 +4,7 @@ com.zlt central-platform - 5.3.0 + 5.4.0 zlt-business 业务中心 diff --git a/zlt-business/search-center/pom.xml b/zlt-business/search-center/pom.xml index ea8eb12faa816e2f9c620557d839e3fd4760bf28..6a62964cdafbaed2a7108661bc220fe73a74ebcd 100644 --- a/zlt-business/search-center/pom.xml +++ b/zlt-business/search-center/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-business - 5.3.0 + 5.4.0 search-center 搜索中心 diff --git a/zlt-business/search-center/search-client/pom.xml b/zlt-business/search-center/search-client/pom.xml index 9ede2871d7c02308a3611e3b17d5c117f7538e98..30188b405486c7e375dc0a99dd70a532249131aa 100644 --- a/zlt-business/search-center/search-client/pom.xml +++ b/zlt-business/search-center/search-client/pom.xml @@ -4,7 +4,7 @@ com.zlt search-center - 5.3.0 + 5.4.0 search-client 搜索中心客户端 diff --git a/zlt-business/search-center/search-server/pom.xml b/zlt-business/search-center/search-server/pom.xml index a971e9c69bc2354ffdde26668afa3e7f9c23768f..8a2330d79163a514ab688b0f77022e97150574a9 100644 --- a/zlt-business/search-center/search-server/pom.xml +++ b/zlt-business/search-center/search-server/pom.xml @@ -4,7 +4,7 @@ com.zlt search-center - 5.3.0 + 5.4.0 search-server 搜索中心服务端 diff --git a/zlt-business/user-center/pom.xml b/zlt-business/user-center/pom.xml index 5a2bce6cc920d73d5f6bdd14aa8fd2e94586dd0c..acbf12b158a5c986012ea13ec11d042ce6bd47a9 100644 --- a/zlt-business/user-center/pom.xml +++ b/zlt-business/user-center/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-business - 5.3.0 + 5.4.0 user-center 用户中心 diff --git a/zlt-commons/pom.xml b/zlt-commons/pom.xml index cad68d5ef5b5bd2e837814711e019bed0c04595e..617efea0de64dde1e96638cfb8d52218df51ed56 100644 --- a/zlt-commons/pom.xml +++ b/zlt-commons/pom.xml @@ -4,7 +4,7 @@ com.zlt central-platform - 5.3.0 + 5.4.0 zlt-commons 通用组件 diff --git a/zlt-commons/zlt-auth-client-spring-boot-starter/pom.xml b/zlt-commons/zlt-auth-client-spring-boot-starter/pom.xml index 7986d8b26d77647cbcd370346061ec93b67f2d09..f6a3d8a477cf2d3052f6ddb33ec523dc1a1085c1 100644 --- a/zlt-commons/zlt-auth-client-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-auth-client-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 5.3.0 + 5.4.0 4.0.0 jar diff --git a/zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java b/zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java index 609e81c210c451b984f2ccf551ccfbc6faa1a1bb..2ed47e1316ffac96a6e9c44c4d3ee5a5cf59c04c 100644 --- a/zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java +++ b/zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java @@ -2,11 +2,14 @@ package com.central.oauth2.common.util; import com.central.common.constant.CommonConstant; import com.central.common.constant.SecurityConstants; +import com.central.common.context.LoginUserContextHolder; import com.central.common.model.SysUser; import com.central.common.utils.SpringUtil; import com.central.oauth2.common.token.CustomWebAuthenticationDetails; import lombok.extern.slf4j.Slf4j; +import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.oauth2.common.OAuth2AccessToken; import org.springframework.security.oauth2.common.exceptions.InvalidTokenException; import org.springframework.security.oauth2.common.exceptions.UnapprovedClientAuthenticationException; @@ -15,15 +18,16 @@ import org.springframework.security.oauth2.provider.token.TokenStore; import javax.servlet.http.HttpServletRequest; import java.nio.charset.StandardCharsets; -import java.util.Base64; -import java.util.Enumeration; -import java.util.Map; +import java.util.*; /** * 认证授权相关工具类 * * @author zlt * @date 2018/5/13 + *

+ * Blog: https://zlt2000.gitee.io + * Github: https://github.com/zlt2000 */ @Slf4j public class AuthUtils { @@ -73,12 +77,12 @@ public class AuthUtils { /** * 校验accessToken */ - public static void checkAccessToken(HttpServletRequest request) { + public static SysUser checkAccessToken(HttpServletRequest request) { String accessToken = extractToken(request); - checkAccessToken(accessToken); + return checkAccessToken(accessToken); } - public static void checkAccessToken(String accessTokenValue) { + public static SysUser checkAccessToken(String accessTokenValue) { TokenStore tokenStore = SpringUtil.getBean(TokenStore.class); OAuth2AccessToken accessToken = tokenStore.readAccessToken(accessTokenValue); if (accessToken == null || accessToken.getValue() == null) { @@ -91,6 +95,17 @@ public class AuthUtils { if (result == null) { throw new InvalidTokenException("Invalid access token: " + accessTokenValue); } + return setContext(result); + } + + /** + * 用户信息赋值 context 对象 + */ + public static SysUser setContext(Authentication authentication) { + SecurityContextHolder.getContext().setAuthentication(authentication); + SysUser user = getUser(authentication); + LoginUserContextHolder.setUser(user); + return user; } /** @@ -134,6 +149,21 @@ public class AuthUtils { return username; } + /** + * 获取登陆的用户对象 + */ + public static SysUser getUser(Authentication authentication) { + SysUser user = null; + if (authentication != null && !(authentication instanceof AnonymousAuthenticationToken)) { + Object principal = authentication.getPrincipal(); + //客户端模式只返回一个clientId + if (principal instanceof SysUser) { + user = (SysUser)principal; + } + } + return user; + } + /** * 获取登陆的帐户类型 */ diff --git a/zlt-commons/zlt-common-core/pom.xml b/zlt-commons/zlt-common-core/pom.xml index 8d0c9467be36e2047633bc5591049bff53abff59..55e6d54036d67f828cab35340b7893b89b1f789d 100644 --- a/zlt-commons/zlt-common-core/pom.xml +++ b/zlt-commons/zlt-common-core/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-commons - 5.3.0 + 5.4.0 zlt-common-core 公共通用组件 diff --git a/zlt-commons/zlt-common-core/src/main/java/com/central/common/constant/CommonConstant.java b/zlt-commons/zlt-common-core/src/main/java/com/central/common/constant/CommonConstant.java index c2d97a8b97008f3e5093126dac57a8a7b15fcb58..e5a83b24fa6471389f31f621a7ba74aef3f659e7 100644 --- a/zlt-commons/zlt-common-core/src/main/java/com/central/common/constant/CommonConstant.java +++ b/zlt-commons/zlt-common-core/src/main/java/com/central/common/constant/CommonConstant.java @@ -10,7 +10,7 @@ public interface CommonConstant { /** * 项目版本号(banner使用) */ - String PROJECT_VERSION = "5.3.0"; + String PROJECT_VERSION = "5.4.0"; /** * token请求头名称 diff --git a/zlt-commons/zlt-common-core/src/main/java/com/central/common/context/LoginUserContextHolder.java b/zlt-commons/zlt-common-core/src/main/java/com/central/common/context/LoginUserContextHolder.java new file mode 100644 index 0000000000000000000000000000000000000000..64500e986f4185c99a8fe75c1973a11f6f1dfc2b --- /dev/null +++ b/zlt-commons/zlt-common-core/src/main/java/com/central/common/context/LoginUserContextHolder.java @@ -0,0 +1,29 @@ +package com.central.common.context; + +import com.alibaba.ttl.TransmittableThreadLocal; +import com.central.common.model.SysUser; + +/** + * 登录用户holder + * + * @author zlt + * @date 2022/6/26 + *

+ * Blog: https://zlt2000.gitee.io + * Github: https://github.com/zlt2000 + */ +public class LoginUserContextHolder { + private static final ThreadLocal CONTEXT = new TransmittableThreadLocal<>(); + + public static void setUser(SysUser user) { + CONTEXT.set(user); + } + + public static SysUser getUser() { + return CONTEXT.get(); + } + + public static void clear() { + CONTEXT.remove(); + } +} \ No newline at end of file diff --git a/zlt-commons/zlt-common-core/src/main/java/com/central/common/resolver/TokenArgumentResolver.java b/zlt-commons/zlt-common-core/src/main/java/com/central/common/resolver/TokenArgumentResolver.java index 32e5ef377bd2570fa25ac8d57b7efbdf9f7d99aa..d035c7087bfd15eb74d0131d681b2b7c366e11d2 100644 --- a/zlt-commons/zlt-common-core/src/main/java/com/central/common/resolver/TokenArgumentResolver.java +++ b/zlt-commons/zlt-common-core/src/main/java/com/central/common/resolver/TokenArgumentResolver.java @@ -6,8 +6,12 @@ import com.central.common.constant.SecurityConstants; import com.central.common.feign.UserService; import com.central.common.model.SysRole; import com.central.common.model.SysUser; +import com.central.common.utils.LoginUserUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.core.MethodParameter; +import org.springframework.security.authentication.AnonymousAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.support.WebDataBinderFactory; import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.method.support.HandlerMethodArgumentResolver; @@ -61,30 +65,9 @@ public class TokenArgumentResolver implements HandlerMethodArgumentResolver { LoginUser loginUser = methodParameter.getParameterAnnotation(LoginUser.class); boolean isFull = loginUser.isFull(); HttpServletRequest request = nativeWebRequest.getNativeRequest(HttpServletRequest.class); - String userId = request.getHeader(SecurityConstants.USER_ID_HEADER); - String username = request.getHeader(SecurityConstants.USER_HEADER); - String roles = request.getHeader(SecurityConstants.ROLE_HEADER); //账号类型 String accountType = request.getHeader(SecurityConstants.ACCOUNT_TYPE_HEADER); - if (StrUtil.isBlank(username)) { - log.warn("resolveArgument error username is empty"); - return null; - } - SysUser user; - if (isFull) { - user = userService.selectByUsername(username); - } else { - user = new SysUser(); - user.setId(Long.valueOf(userId)); - user.setUsername(username); - } - List sysRoleList = new ArrayList<>(); - Arrays.stream(roles.split(",")).forEach(role -> { - SysRole sysRole = new SysRole(); - sysRole.setCode(role); - sysRoleList.add(sysRole); - }); - user.setRoles(sysRoleList); - return user; + + return LoginUserUtils.getCurrentUser(request, isFull); } } diff --git a/zlt-commons/zlt-common-core/src/main/java/com/central/common/utils/LoginUserUtils.java b/zlt-commons/zlt-common-core/src/main/java/com/central/common/utils/LoginUserUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..3fdf1be4996df848c40baada961cb02861f97129 --- /dev/null +++ b/zlt-commons/zlt-common-core/src/main/java/com/central/common/utils/LoginUserUtils.java @@ -0,0 +1,69 @@ +package com.central.common.utils; + +import cn.hutool.core.util.StrUtil; +import com.central.common.constant.SecurityConstants; +import com.central.common.feign.UserService; +import com.central.common.model.SysRole; +import com.central.common.model.SysUser; +import org.springframework.security.authentication.AnonymousAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * 获取当前登录人工具类 + * + * @author zlt + * @version 1.0 + * @date 2022/6/26 + *

+ * Blog: https://zlt2000.gitee.io + * Github: https://github.com/zlt2000 + */ +public class LoginUserUtils { + /** + * 获取当前登录人 + */ + public static SysUser getCurrentUser(HttpServletRequest request, boolean isFull) { + SysUser user = null; + + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication != null && !(authentication instanceof AnonymousAuthenticationToken)) { + Object principal = authentication.getPrincipal(); + //客户端模式只返回一个clientId + if (principal instanceof SysUser) { + user = (SysUser)principal; + } + } + if (user == null) { + String userId = request.getHeader(SecurityConstants.USER_ID_HEADER); + String username = request.getHeader(SecurityConstants.USER_HEADER); + String roles = request.getHeader(SecurityConstants.ROLE_HEADER); + + if (StrUtil.isAllNotBlank(username, userId)) { + if (isFull) { + UserService userService = SpringUtil.getBean(UserService.class); + user = userService.selectByUsername(username); + } else { + user = new SysUser(); + user.setId(Long.valueOf(userId)); + user.setUsername(username); + } + if (StrUtil.isNotBlank(roles)) { + List sysRoleList = new ArrayList<>(); + Arrays.stream(roles.split(",")).forEach(role -> { + SysRole sysRole = new SysRole(); + sysRole.setCode(role); + sysRoleList.add(sysRole); + }); + user.setRoles(sysRoleList); + } + } + } + return user; + } +} diff --git a/zlt-commons/zlt-common-spring-boot-starter/pom.xml b/zlt-commons/zlt-common-spring-boot-starter/pom.xml index f948cf1944a15146cb2d3fcdba2de7f7c83ea8c7..c327e8d98c28f141774e6a1393490a7153fdaf3e 100644 --- a/zlt-commons/zlt-common-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-common-spring-boot-starter/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-commons - 5.3.0 + 5.4.0 zlt-common-spring-boot-starter 公共通用组件 diff --git a/zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/filter/LoginUserFilter.java b/zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/filter/LoginUserFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..21c9a3ebdba710c2cd2cbe86150a63c022f56b9d --- /dev/null +++ b/zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/filter/LoginUserFilter.java @@ -0,0 +1,40 @@ +package com.central.common.filter; + +import com.central.common.context.LoginUserContextHolder; +import com.central.common.model.SysUser; +import com.central.common.utils.LoginUserUtils; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.core.annotation.Order; +import org.springframework.web.filter.OncePerRequestFilter; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 获取当前登录人过滤器 + * + * @author zlt + * @date 2022/6/26 + *

+ * Blog: https://zlt2000.gitee.io + * Github: https://github.com/zlt2000 + */ +@ConditionalOnClass(Filter.class) +@Order +public class LoginUserFilter extends OncePerRequestFilter { + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, + FilterChain filterChain) throws IOException, ServletException { + try { + SysUser user = LoginUserUtils.getCurrentUser(request, false); + LoginUserContextHolder.setUser(user); + filterChain.doFilter(request, response); + } finally { + LoginUserContextHolder.clear(); + } + } +} diff --git a/zlt-commons/zlt-common-spring-boot-starter/src/main/resources/META-INF/spring.factories b/zlt-commons/zlt-common-spring-boot-starter/src/main/resources/META-INF/spring.factories index baf1f7304d1d84fb379c311fcab3f52b6398be33..ffb5ffd996a812249dfb67ca43ed13972844bf5a 100644 --- a/zlt-commons/zlt-common-spring-boot-starter/src/main/resources/META-INF/spring.factories +++ b/zlt-commons/zlt-common-spring-boot-starter/src/main/resources/META-INF/spring.factories @@ -1,2 +1,3 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.central.common.filter.TenantFilter \ No newline at end of file +com.central.common.filter.TenantFilter, \ +com.central.common.filter.LoginUserFilter \ No newline at end of file diff --git a/zlt-commons/zlt-db-spring-boot-starter/pom.xml b/zlt-commons/zlt-db-spring-boot-starter/pom.xml index cc8201b065e26dfd3f0981a0c929abe62c25c69d..f4dd384cb33b2e62d55f85b94e17cf821a4ec6ae 100644 --- a/zlt-commons/zlt-db-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-db-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 5.3.0 + 5.4.0 4.0.0 jar diff --git a/zlt-commons/zlt-elasticsearch-spring-boot-starter/pom.xml b/zlt-commons/zlt-elasticsearch-spring-boot-starter/pom.xml index 4d2bce09a8ea9b39b0c7e3bbaf33f0269dad9206..97cea36f8ba79ae74d0648461614657a6eccef6c 100644 --- a/zlt-commons/zlt-elasticsearch-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-elasticsearch-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 5.3.0 + 5.4.0 4.0.0 jar diff --git a/zlt-commons/zlt-loadbalancer-spring-boot-starter/pom.xml b/zlt-commons/zlt-loadbalancer-spring-boot-starter/pom.xml index 8336ea38d3de7f50c67623401eb609092cdf2028..ae21c49f793a6e886a3a5f51640efd23f4ec785d 100644 --- a/zlt-commons/zlt-loadbalancer-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-loadbalancer-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 5.3.0 + 5.4.0 4.0.0 jar diff --git a/zlt-commons/zlt-log-spring-boot-starter/pom.xml b/zlt-commons/zlt-log-spring-boot-starter/pom.xml index 6ba3e818ab888d6909b4269ef1bf4cdbf32ed73b..d7ad982ab84cb40d0d03b391a6fce4cd6622440d 100644 --- a/zlt-commons/zlt-log-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-log-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 5.3.0 + 5.4.0 4.0.0 jar diff --git a/zlt-commons/zlt-oss-spring-boot-starter/pom.xml b/zlt-commons/zlt-oss-spring-boot-starter/pom.xml index 207c770957c9e30ec0515f1a605bb35a4f339a77..5b9090276645ec807915f85627572b5b82726f38 100644 --- a/zlt-commons/zlt-oss-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-oss-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 5.3.0 + 5.4.0 4.0.0 jar diff --git a/zlt-commons/zlt-redis-spring-boot-starter/pom.xml b/zlt-commons/zlt-redis-spring-boot-starter/pom.xml index 29fa499fd41d6c6e574bb6eddd3df2b0914b87d7..7360b0b1e1699fef7c9f18c665eda845cf2f86d9 100644 --- a/zlt-commons/zlt-redis-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-redis-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 5.3.0 + 5.4.0 4.0.0 jar diff --git a/zlt-commons/zlt-sentinel-spring-boot-starter/pom.xml b/zlt-commons/zlt-sentinel-spring-boot-starter/pom.xml index 2370b9154478f59b888af66bfa3940ace963ed2f..ebe27115565ea03ecfda35168a117eacb29d204c 100644 --- a/zlt-commons/zlt-sentinel-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-sentinel-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 5.3.0 + 5.4.0 4.0.0 jar diff --git a/zlt-commons/zlt-swagger2-spring-boot-starter/pom.xml b/zlt-commons/zlt-swagger2-spring-boot-starter/pom.xml index b699bc748e0b36083ec320342e90212c0c75302a..9e6471bbba2668046a2009f994682b1442a8df50 100644 --- a/zlt-commons/zlt-swagger2-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-swagger2-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 5.3.0 + 5.4.0 4.0.0 jar diff --git a/zlt-commons/zlt-zookeeper-spring-boot-starter/pom.xml b/zlt-commons/zlt-zookeeper-spring-boot-starter/pom.xml index 601b894aa39fc3e50eca1ffd5cec47ecf4cd1ae2..776ac56a15d092524013f113ba4bd7088d9ec435 100644 --- a/zlt-commons/zlt-zookeeper-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-zookeeper-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt zlt-commons - 5.3.0 + 5.4.0 4.0.0 jar diff --git a/zlt-config/pom.xml b/zlt-config/pom.xml index bd4ed8a415ec5281d68e328638ed3da6df8661e6..f6f7c46009ca8766f319e8d9974b122bda158a5c 100644 --- a/zlt-config/pom.xml +++ b/zlt-config/pom.xml @@ -5,7 +5,7 @@ com.zlt central-platform - 5.3.0 + 5.4.0 4.0.0 jar diff --git a/zlt-config/src/main/resources/bootstrap.properties b/zlt-config/src/main/resources/bootstrap.properties index 5fe083086b9ec5188c53e2c196daf8aaf6a9a410..639ab88d964bf2d69c7c2dd335399775f2f36355 100644 --- a/zlt-config/src/main/resources/bootstrap.properties +++ b/zlt-config/src/main/resources/bootstrap.properties @@ -7,8 +7,8 @@ spring.cloud.nacos.server-addr=192.168.28.130:8848 #spring.cloud.nacos.username=nacos #spring.cloud.nacos.password=nacos spring.cloud.nacos.config.file-extension=yml -spring.cloud.nacos.config.shared-dataids=common.yml -spring.cloud.nacos.config.refreshable-dataids=common.yml +spring.cloud.nacos.config.shared-configs[0].data-id=common.yml +spring.cloud.nacos.config.shared-configs[0].refresh=true ##### spring-boot-actuator配置 management.endpoints.web.exposure.include=* diff --git a/zlt-demo/dubbo-demo/pom.xml b/zlt-demo/dubbo-demo/pom.xml index 46ef12a8347a50ddb026d022ce902c548e296663..3f5aa128881e574397a26415db3599dd4df14f05 100644 --- a/zlt-demo/dubbo-demo/pom.xml +++ b/zlt-demo/dubbo-demo/pom.xml @@ -6,7 +6,7 @@ com.zlt zlt-demo - 5.3.0 + 5.4.0 dubbo-demo diff --git a/zlt-demo/pom.xml b/zlt-demo/pom.xml index cfb804918fb98ab263acf22e101c10a144ed9b31..26595a2b210b92d7ad57057ada3e2371f8dd6fe6 100644 --- a/zlt-demo/pom.xml +++ b/zlt-demo/pom.xml @@ -4,7 +4,7 @@ com.zlt central-platform - 5.3.0 + 5.4.0 zlt-demo pom @@ -24,5 +24,7 @@ dubbo-demo websocket-demo + + resources-server-demo \ No newline at end of file diff --git a/zlt-demo/resources-server-demo/README.md b/zlt-demo/resources-server-demo/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3abae7a91c2018c6160cd2ed11b87e2305ebe8b5 --- /dev/null +++ b/zlt-demo/resources-server-demo/README.md @@ -0,0 +1,45 @@ +## 一、说明 +资源服务器 demo 样例,以最简化的代码演示如何快速集成一个带鉴权功能的服务,适用于 `无网络隔离` 架构。 + +> 关于无网络隔离架构的设计可参考文档:[无网络隔离架构](https://www.kancloud.cn/zlt2000/microservices-platform/1153640) + +  +## 二、启动以下服务 +1. zlt-uaa:统一认证中心 +2. user-center:用户服务 +3. sc-gateway:api网关 +4. resources-server-demo + +> 环境配置与启动参考文档:https://www.kancloud.cn/zlt2000/microservices-platform/919418 + +  +## 三、测试 +### 3.1. 测试接口一 +http://localhost:8093/test/notAuth +> 无需token访问 + +  +### 3.2. 测试接口二 +通过 @LoginUser 获取当前登录人 + +http://localhost:8093/test/auth?access_token=xxx +> - xxx 需替换为正确的 access_token +> - 可以通过修改 `bootstrap.yml` 文件中的 `zlt.security.ignore.httpUrls` 参数添加排除校验的url。 + +  +### 3.3. 测试接口三 +通过 LoginUserContextHolder 获取当前登录人 + +http://localhost:8093/test/auth2?access_token=xxx +> - xxx 需替换为正确的 access_token + +  +## 四、获取access_token +可使用任意授权模式获取; + +例如:密码模式授权 +- 请求方式:POST +- 请求头:Authorization:Basic d2ViQXBwOndlYkFwcA== +- 请求地址:http://localhost:9900/api-uaa/oauth/token?grant_type=password&username=admin&password=admin + +> 授权接口清单参考文档:https://www.kancloud.cn/zlt2000/microservices-platform/1158135 diff --git a/zlt-demo/resources-server-demo/pom.xml b/zlt-demo/resources-server-demo/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..e8f420de6ca15fc7c9f157f423107216fc509e73 --- /dev/null +++ b/zlt-demo/resources-server-demo/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + + com.zlt + zlt-demo + 5.4.0 + + resources-server-demo + + + + com.zlt + zlt-config + + + com.zlt + zlt-common-spring-boot-starter + + + com.zlt + zlt-auth-client-spring-boot-starter + + + com.zlt + zlt-redis-spring-boot-starter + + + org.springframework.boot + spring-boot-starter-web + + + com.baomidou + mybatis-plus-extension + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + \ No newline at end of file diff --git a/zlt-demo/resources-server-demo/src/main/java/org/zlt/ResourcesServerApp.java b/zlt-demo/resources-server-demo/src/main/java/org/zlt/ResourcesServerApp.java new file mode 100644 index 0000000000000000000000000000000000000000..58306000f333dbe5ff88b656aefc805b0c20c993 --- /dev/null +++ b/zlt-demo/resources-server-demo/src/main/java/org/zlt/ResourcesServerApp.java @@ -0,0 +1,18 @@ +package org.zlt; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author zlt + * @date 2022/6/25 + *

+ * Blog: https://zlt2000.gitee.io + * Github: https://github.com/zlt2000 + */ +@SpringBootApplication +public class ResourcesServerApp { + public static void main(String[] args) { + SpringApplication.run(ResourcesServerApp.class, args); + } +} diff --git a/zlt-demo/resources-server-demo/src/main/java/org/zlt/config/MyResourceConfig.java b/zlt-demo/resources-server-demo/src/main/java/org/zlt/config/MyResourceConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..06582143b8c41b92be0f6c388414831104c0d347 --- /dev/null +++ b/zlt-demo/resources-server-demo/src/main/java/org/zlt/config/MyResourceConfig.java @@ -0,0 +1,20 @@ +package org.zlt.config; + +import com.central.oauth2.common.config.DefaultResourceServerConf; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; + +/** + * security资源服务器配置 + * + * @author zlt + * @version 1.0 + * @date 2022/6/25 + *

+ * Blog: https://zlt2000.gitee.io + * Github: https://github.com/zlt2000 + */ +@Configuration +@EnableResourceServer +public class MyResourceConfig extends DefaultResourceServerConf { +} diff --git a/zlt-demo/resources-server-demo/src/main/java/org/zlt/config/WebMvcConfig.java b/zlt-demo/resources-server-demo/src/main/java/org/zlt/config/WebMvcConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..f2d0670296846c10102a9f69fa26919a02b66754 --- /dev/null +++ b/zlt-demo/resources-server-demo/src/main/java/org/zlt/config/WebMvcConfig.java @@ -0,0 +1,18 @@ +package org.zlt.config; + +import com.central.common.config.DefaultWebMvcConfig; +import org.springframework.context.annotation.Configuration; + +/** + * web服务器配置 + * + * @author zlt + * @version 1.0 + * @date 2022/6/25 + *

+ * Blog: https://zlt2000.gitee.io + * Github: https://github.com/zlt2000 + */ +@Configuration +public class WebMvcConfig extends DefaultWebMvcConfig { +} diff --git a/zlt-demo/resources-server-demo/src/main/java/org/zlt/controller/TestController.java b/zlt-demo/resources-server-demo/src/main/java/org/zlt/controller/TestController.java new file mode 100644 index 0000000000000000000000000000000000000000..5ea4eb6f93b57e43c0d19da24db78b83de71ca8b --- /dev/null +++ b/zlt-demo/resources-server-demo/src/main/java/org/zlt/controller/TestController.java @@ -0,0 +1,40 @@ +package org.zlt.controller; + +import com.central.common.annotation.LoginUser; +import com.central.common.context.LoginUserContextHolder; +import com.central.common.model.SysUser; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author zlt + * @date 2022/6/25 + *

+ * Blog: https://zlt2000.gitee.io + * Github: https://github.com/zlt2000 + */ +@Slf4j +@RestController +public class TestController { + /** + * 通过 @LoginUser 获取当前登录人 + */ + @GetMapping("/test/auth") + public String auth(@LoginUser SysUser user) { + return "auth:" + user.getUsername(); + } + + /** + * 通过 LoginUserContextHolder 获取当前登录人 + */ + @GetMapping("/test/auth2") + public String auth() { + return "auth2:" + LoginUserContextHolder.getUser().getUsername(); + } + + @GetMapping("/test/notAuth") + public String notAuth() { + return "notAuth:ok"; + } +} diff --git a/zlt-demo/resources-server-demo/src/main/resources/bootstrap.yml b/zlt-demo/resources-server-demo/src/main/resources/bootstrap.yml new file mode 100644 index 0000000000000000000000000000000000000000..cd2bc3d3194f8b0f6be43908dc68afd7903accfd --- /dev/null +++ b/zlt-demo/resources-server-demo/src/main/resources/bootstrap.yml @@ -0,0 +1,14 @@ +server: + port: 8093 + +spring: + application: + name: zlt-resources-server + main: + allow-bean-definition-overriding: true + +zlt: + security: + ignore: + httpUrls: > + /test/notAuth \ No newline at end of file diff --git a/zlt-demo/rocketmq-demo/pom.xml b/zlt-demo/rocketmq-demo/pom.xml index 2fb80a0bd71ec4ba8cc64492c7f9a00bd5053ef6..91a152316305fb883787af181ce77c39f3396627 100644 --- a/zlt-demo/rocketmq-demo/pom.xml +++ b/zlt-demo/rocketmq-demo/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-demo - 5.3.0 + 5.4.0 rocketmq-demo pom diff --git a/zlt-demo/rocketmq-demo/rocketmq-consume/pom.xml b/zlt-demo/rocketmq-demo/rocketmq-consume/pom.xml index ee15dd553d3d6c508387b4ce28e8d0e20d6751aa..afddb73ee2048c353a97541109fcc22ac1ff96b4 100644 --- a/zlt-demo/rocketmq-demo/rocketmq-consume/pom.xml +++ b/zlt-demo/rocketmq-demo/rocketmq-consume/pom.xml @@ -4,7 +4,7 @@ com.zlt rocketmq-demo - 5.3.0 + 5.4.0 rocketmq-consume rocketMQ消费者demo diff --git a/zlt-demo/rocketmq-demo/rocketmq-produce/pom.xml b/zlt-demo/rocketmq-demo/rocketmq-produce/pom.xml index 2201711ec9cbb59900055af42ab40ff746ce0662..2bccffc44e3daf6977c56b4decae1bb4abcdddae 100644 --- a/zlt-demo/rocketmq-demo/rocketmq-produce/pom.xml +++ b/zlt-demo/rocketmq-demo/rocketmq-produce/pom.xml @@ -4,7 +4,7 @@ com.zlt rocketmq-demo - 5.3.0 + 5.4.0 rocketmq-produce rocketMQ生产者demo diff --git a/zlt-demo/rocketmq-demo/rocketmq-transactional/pom.xml b/zlt-demo/rocketmq-demo/rocketmq-transactional/pom.xml index 0973e0e90ca280b3def6aaaf0cfc3abadaf6ceb7..2fd9aa7a69cc87c0e5190c41de8b2253feefed20 100644 --- a/zlt-demo/rocketmq-demo/rocketmq-transactional/pom.xml +++ b/zlt-demo/rocketmq-demo/rocketmq-transactional/pom.xml @@ -4,7 +4,7 @@ com.zlt rocketmq-demo - 5.3.0 + 5.4.0 rocketmq-transactional rocketMQ事务消息demo diff --git a/zlt-demo/seata-demo/account-service/pom.xml b/zlt-demo/seata-demo/account-service/pom.xml index 4c5f4143d643438a1291820adb1a628f9b8f7780..5daa83ea8ebffc805626e36b682ed7de33e0126e 100644 --- a/zlt-demo/seata-demo/account-service/pom.xml +++ b/zlt-demo/seata-demo/account-service/pom.xml @@ -5,7 +5,7 @@ com.zlt seata-demo - 5.3.0 + 5.4.0 account-service diff --git a/zlt-demo/seata-demo/business-service/pom.xml b/zlt-demo/seata-demo/business-service/pom.xml index a29e3f5221ce2eded6305195b3e5d9956d673171..39aff9c11217187d613939c783e8e13ddf819248 100644 --- a/zlt-demo/seata-demo/business-service/pom.xml +++ b/zlt-demo/seata-demo/business-service/pom.xml @@ -5,7 +5,7 @@ com.zlt seata-demo - 5.3.0 + 5.4.0 business-service diff --git a/zlt-demo/seata-demo/order-service/pom.xml b/zlt-demo/seata-demo/order-service/pom.xml index 230e9cba67b2947976186b2c2291a375eb8df337..da9d834b0eb4431cf60e65270ef4480d893c3cf7 100644 --- a/zlt-demo/seata-demo/order-service/pom.xml +++ b/zlt-demo/seata-demo/order-service/pom.xml @@ -5,7 +5,7 @@ com.zlt seata-demo - 5.3.0 + 5.4.0 order-service diff --git a/zlt-demo/seata-demo/pom.xml b/zlt-demo/seata-demo/pom.xml index 0a9ced3a6e7d3f07168d3b76e8dfd842d7c7ff13..dcf2c7003c6195dd26726c8ed70cb616fc16e809 100644 --- a/zlt-demo/seata-demo/pom.xml +++ b/zlt-demo/seata-demo/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-demo - 5.3.0 + 5.4.0 seata-demo seata分布式事务demo diff --git a/zlt-demo/seata-demo/seata-common-starter/pom.xml b/zlt-demo/seata-demo/seata-common-starter/pom.xml index 0a82b22d31cd2b247cc7db1df077b9b46b71c628..390556fabd997a0d65eec4e65c8c5c8e0ea8a15c 100644 --- a/zlt-demo/seata-demo/seata-common-starter/pom.xml +++ b/zlt-demo/seata-demo/seata-common-starter/pom.xml @@ -5,7 +5,7 @@ com.zlt seata-demo - 5.3.0 + 5.4.0 seata-common-starter diff --git a/zlt-demo/seata-demo/storage-service/pom.xml b/zlt-demo/seata-demo/storage-service/pom.xml index 2a524d5c9e9a476ce853544da73c7b4eec4a9aa6..03675083e5d4e007304494c6789c67577590a971 100644 --- a/zlt-demo/seata-demo/storage-service/pom.xml +++ b/zlt-demo/seata-demo/storage-service/pom.xml @@ -5,7 +5,7 @@ com.zlt seata-demo - 5.3.0 + 5.4.0 storage-service diff --git a/zlt-demo/sharding-jdbc-demo/pom.xml b/zlt-demo/sharding-jdbc-demo/pom.xml index f578125906389a856da270e43aeaff69398b92bc..88cdc9853e4eee7990a3c191802c5c5e170eef99 100644 --- a/zlt-demo/sharding-jdbc-demo/pom.xml +++ b/zlt-demo/sharding-jdbc-demo/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-demo - 5.3.0 + 5.4.0 sharding-jdbc-demo sharding-jdbc分库分表demo diff --git a/zlt-demo/sso-demo/oidc-sso/pom.xml b/zlt-demo/sso-demo/oidc-sso/pom.xml index fd7566980053717c12a4e728706ca3abae1602db..84d2665a6ab7b60ce5eb49786b9ee797bffac531 100644 --- a/zlt-demo/sso-demo/oidc-sso/pom.xml +++ b/zlt-demo/sso-demo/oidc-sso/pom.xml @@ -4,7 +4,7 @@ com.zlt sso-demo - 5.3.0 + 5.4.0 oidc-sso OIDC协议单点登录demo diff --git a/zlt-demo/sso-demo/pom.xml b/zlt-demo/sso-demo/pom.xml index b2e0bdb05de677d088a20653e58f7fd794dfc686..de8b07ce18b1b08f0bf6c766bb301e59cd6170dd 100644 --- a/zlt-demo/sso-demo/pom.xml +++ b/zlt-demo/sso-demo/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-demo - 5.3.0 + 5.4.0 sso-demo pom diff --git a/zlt-demo/sso-demo/ss-sso/pom.xml b/zlt-demo/sso-demo/ss-sso/pom.xml index bdf857707fa561657c249cf8dac0babc6bdab2f3..ab6584ac82078259822a4ae9b1c2e6a1051457f1 100644 --- a/zlt-demo/sso-demo/ss-sso/pom.xml +++ b/zlt-demo/sso-demo/ss-sso/pom.xml @@ -4,7 +4,7 @@ com.zlt sso-demo - 5.3.0 + 5.4.0 ss-sso springSecurity单点登录demo diff --git a/zlt-demo/sso-demo/web-sso/pom.xml b/zlt-demo/sso-demo/web-sso/pom.xml index d1a1984ff97c6c7086b84f5a2315446dee665ca1..b6be2dc2aa2959ba308374f5ff6b617a67367f90 100644 --- a/zlt-demo/sso-demo/web-sso/pom.xml +++ b/zlt-demo/sso-demo/web-sso/pom.xml @@ -4,7 +4,7 @@ com.zlt sso-demo - 5.3.0 + 5.4.0 web-sso 前后端分离单点登录demo diff --git a/zlt-demo/txlcn-demo/pom.xml b/zlt-demo/txlcn-demo/pom.xml index 0ce4dae32e9094e72c4f92c3eba86bc1fb5dd579..5f111095fad00b6eacc0f3ade37800ec0db82283 100644 --- a/zlt-demo/txlcn-demo/pom.xml +++ b/zlt-demo/txlcn-demo/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-demo - 5.3.0 + 5.4.0 txlcn-demo txlcn分布式事务demo diff --git a/zlt-demo/txlcn-demo/txlcn-demo-common/pom.xml b/zlt-demo/txlcn-demo/txlcn-demo-common/pom.xml index 72ac8d041d7e8c19fffaeb849e0754bf9eb92ff4..0659442090dc41aee106d4a763fc3b75b27da55b 100644 --- a/zlt-demo/txlcn-demo/txlcn-demo-common/pom.xml +++ b/zlt-demo/txlcn-demo/txlcn-demo-common/pom.xml @@ -4,7 +4,7 @@ com.zlt txlcn-demo - 5.3.0 + 5.4.0 txlcn-demo-common demo-common diff --git a/zlt-demo/txlcn-demo/txlcn-demo-spring-service-a/pom.xml b/zlt-demo/txlcn-demo/txlcn-demo-spring-service-a/pom.xml index bff2f2d7bec5e6eac4a7a0eb1f664c859f93f5dc..2f15e2abb1a054d1183a0fa682b0f129c5d914c4 100644 --- a/zlt-demo/txlcn-demo/txlcn-demo-spring-service-a/pom.xml +++ b/zlt-demo/txlcn-demo/txlcn-demo-spring-service-a/pom.xml @@ -3,7 +3,7 @@ com.zlt txlcn-demo - 5.3.0 + 5.4.0 4.0.0 diff --git a/zlt-demo/txlcn-demo/txlcn-demo-spring-service-b/pom.xml b/zlt-demo/txlcn-demo/txlcn-demo-spring-service-b/pom.xml index 8877bd4e0b757e2d9f2e9a40e245464c5bfba392..86dca5340f28d1d9dd0f5b7b04ce533968ed86ac 100644 --- a/zlt-demo/txlcn-demo/txlcn-demo-spring-service-b/pom.xml +++ b/zlt-demo/txlcn-demo/txlcn-demo-spring-service-b/pom.xml @@ -3,7 +3,7 @@ com.zlt txlcn-demo - 5.3.0 + 5.4.0 4.0.0 txlcn-demo-spring-service-b diff --git a/zlt-demo/txlcn-demo/txlcn-demo-spring-service-c/pom.xml b/zlt-demo/txlcn-demo/txlcn-demo-spring-service-c/pom.xml index ee7f3671cc17737e58c9df7c51fb86ba7ea71096..9c6690e6e8e98a0fcd67eb2404b2305accf72e85 100644 --- a/zlt-demo/txlcn-demo/txlcn-demo-spring-service-c/pom.xml +++ b/zlt-demo/txlcn-demo/txlcn-demo-spring-service-c/pom.xml @@ -3,7 +3,7 @@ com.zlt txlcn-demo - 5.3.0 + 5.4.0 4.0.0 txlcn-demo-spring-service-c diff --git a/zlt-demo/websocket-demo/pom.xml b/zlt-demo/websocket-demo/pom.xml index ee322a0bd6e1ae3c5b09467d211933674284f71d..2644e3306073d009daf8faffabf5ef9f1ce35487 100644 --- a/zlt-demo/websocket-demo/pom.xml +++ b/zlt-demo/websocket-demo/pom.xml @@ -6,7 +6,7 @@ com.zlt zlt-demo - 5.3.0 + 5.4.0 websocket-demo diff --git a/zlt-gateway/pom.xml b/zlt-gateway/pom.xml index e58ce502e5b3c29354ab5f0c8e55362c9f8d90a9..e34d5a2085a19678be54087d214608f268cde320 100644 --- a/zlt-gateway/pom.xml +++ b/zlt-gateway/pom.xml @@ -4,7 +4,7 @@ com.zlt central-platform - 5.3.0 + 5.4.0 zlt-gateway pom diff --git a/zlt-gateway/sc-gateway/pom.xml b/zlt-gateway/sc-gateway/pom.xml index d15fdfd72627d3999015d1968a9941df03b99db4..8d28f24e287482a58b3321009bd92560f06feffc 100644 --- a/zlt-gateway/sc-gateway/pom.xml +++ b/zlt-gateway/sc-gateway/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-gateway - 5.3.0 + 5.4.0 sc-gateway spring cloud gateway网关 diff --git a/zlt-gateway/sc-gateway/src/main/java/com/central/gateway/error/CustomErrorWebFluxAutoConfiguration.java b/zlt-gateway/sc-gateway/src/main/java/com/central/gateway/error/CustomErrorWebFluxAutoConfiguration.java index 830f33d88965b9f9c77ee477d55e64090061b7be..174d70c0ad64c748cf3f55ed3e93eafa9caff011 100644 --- a/zlt-gateway/sc-gateway/src/main/java/com/central/gateway/error/CustomErrorWebFluxAutoConfiguration.java +++ b/zlt-gateway/sc-gateway/src/main/java/com/central/gateway/error/CustomErrorWebFluxAutoConfiguration.java @@ -4,8 +4,8 @@ import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.web.ResourceProperties; import org.springframework.boot.autoconfigure.web.ServerProperties; +import org.springframework.boot.autoconfigure.web.WebProperties; import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.web.reactive.error.ErrorAttributes; @@ -35,26 +35,26 @@ import java.util.List; @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) @ConditionalOnClass(WebFluxConfigurer.class) @AutoConfigureBefore(WebFluxAutoConfiguration.class) -@EnableConfigurationProperties({ServerProperties.class, ResourceProperties.class}) +@EnableConfigurationProperties({ServerProperties.class, WebProperties.class}) public class CustomErrorWebFluxAutoConfiguration { private final ServerProperties serverProperties; private final ApplicationContext applicationContext; - private final ResourceProperties resourceProperties; + private final WebProperties webProperties; private final List viewResolvers; private final ServerCodecConfigurer serverCodecConfigurer; public CustomErrorWebFluxAutoConfiguration(ServerProperties serverProperties, - ResourceProperties resourceProperties, + WebProperties webProperties, ObjectProvider> viewResolversProvider, ServerCodecConfigurer serverCodecConfigurer, ApplicationContext applicationContext) { this.serverProperties = serverProperties; this.applicationContext = applicationContext; - this.resourceProperties = resourceProperties; + this.webProperties = webProperties; this.viewResolvers = viewResolversProvider.getIfAvailable(Collections::emptyList); this.serverCodecConfigurer = serverCodecConfigurer; } @@ -64,7 +64,7 @@ public class CustomErrorWebFluxAutoConfiguration { public ErrorWebExceptionHandler errorWebExceptionHandler(ErrorAttributes errorAttributes) { JsonErrorWebExceptionHandler exceptionHandler = new JsonErrorWebExceptionHandler( errorAttributes, - this.resourceProperties, + this.webProperties.getResources(), this.serverProperties.getError(), this.applicationContext); exceptionHandler.setViewResolvers(this.viewResolvers); diff --git a/zlt-gateway/sc-gateway/src/main/java/com/central/gateway/error/JsonErrorWebExceptionHandler.java b/zlt-gateway/sc-gateway/src/main/java/com/central/gateway/error/JsonErrorWebExceptionHandler.java index 6cd1101f5eb0f8deb0a1a16b19b595f9454413b9..93814e37f21c481c564276fc2855b2d2d0871c9f 100644 --- a/zlt-gateway/sc-gateway/src/main/java/com/central/gateway/error/JsonErrorWebExceptionHandler.java +++ b/zlt-gateway/sc-gateway/src/main/java/com/central/gateway/error/JsonErrorWebExceptionHandler.java @@ -1,7 +1,7 @@ package com.central.gateway.error; import org.springframework.boot.autoconfigure.web.ErrorProperties; -import org.springframework.boot.autoconfigure.web.ResourceProperties; +import org.springframework.boot.autoconfigure.web.WebProperties; import org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler; import org.springframework.boot.web.error.ErrorAttributeOptions; import org.springframework.boot.web.reactive.error.ErrorAttributes; @@ -23,7 +23,7 @@ import java.util.Map; * Github: https://github.com/zlt2000 */ public class JsonErrorWebExceptionHandler extends DefaultErrorWebExceptionHandler { - public JsonErrorWebExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties, + public JsonErrorWebExceptionHandler(ErrorAttributes errorAttributes, WebProperties.Resources resourceProperties, ErrorProperties errorProperties, ApplicationContext applicationContext) { super(errorAttributes, resourceProperties, errorProperties, applicationContext); } diff --git a/zlt-job/job-admin/pom.xml b/zlt-job/job-admin/pom.xml index 102da016aeadba9ab69cf3cb2d8125cc2c819377..ae520d5ad0f8b446a281b473615eca38fb9a853b 100644 --- a/zlt-job/job-admin/pom.xml +++ b/zlt-job/job-admin/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-job - 5.3.0 + 5.4.0 job-admin jar diff --git a/zlt-job/job-core/pom.xml b/zlt-job/job-core/pom.xml index 7a279d19b2f622d34691303f4698868c17fde86a..e97b0bf29ecc2504245be2a239e3b9f436f1edcb 100644 --- a/zlt-job/job-core/pom.xml +++ b/zlt-job/job-core/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-job - 5.3.0 + 5.4.0 job-core jar diff --git a/zlt-job/job-executor-samples/pom.xml b/zlt-job/job-executor-samples/pom.xml index 2a31f63ca4d779a682c03c60b244dab93dd4c805..b0a91ce9a9b308680aa74181b98d60913e3fe905 100644 --- a/zlt-job/job-executor-samples/pom.xml +++ b/zlt-job/job-executor-samples/pom.xml @@ -6,7 +6,7 @@ com.zlt zlt-job - 5.3.0 + 5.4.0 job-executor-samples jar diff --git a/zlt-job/pom.xml b/zlt-job/pom.xml index 60747d33dea7297c9d39f1e932ee2eaba4617082..06202f4c8799bd3768b6ab883432bc93a9d97f86 100644 --- a/zlt-job/pom.xml +++ b/zlt-job/pom.xml @@ -4,7 +4,7 @@ com.zlt central-platform - 5.3.0 + 5.4.0 zlt-job pom diff --git a/zlt-monitor/log-center/pom.xml b/zlt-monitor/log-center/pom.xml index 87e0bb0cb3165994e44b8578511bcc6791070fff..8f5ae3fbafc6c1e137aa6ce2953acda4a1c6f20a 100644 --- a/zlt-monitor/log-center/pom.xml +++ b/zlt-monitor/log-center/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-monitor - 5.3.0 + 5.4.0 log-center diff --git a/zlt-monitor/pom.xml b/zlt-monitor/pom.xml index 724bb2803043c6a3f2bc98c4451f7e085d3ea2ba..b98b8f49eb90abe99ab7954f4621a4db3c336596 100644 --- a/zlt-monitor/pom.xml +++ b/zlt-monitor/pom.xml @@ -3,7 +3,7 @@ com.zlt central-platform - 5.3.0 + 5.4.0 zlt-monitor pom diff --git a/zlt-monitor/sc-admin/pom.xml b/zlt-monitor/sc-admin/pom.xml index e544528bbeaffc4e915e48fa6e18478dc52634f7..707ed0b3681c80f4808920a2b6f641cfdd058f3b 100644 --- a/zlt-monitor/sc-admin/pom.xml +++ b/zlt-monitor/sc-admin/pom.xml @@ -4,7 +4,7 @@ com.zlt zlt-monitor - 5.3.0 + 5.4.0 sc-admin diff --git a/zlt-transaction/pom.xml b/zlt-transaction/pom.xml index 9e0140b298b9a318e9473d4d21fe2403666f1bf6..fad9d2d42443cddd47b5994edb9eb894ab60df35 100644 --- a/zlt-transaction/pom.xml +++ b/zlt-transaction/pom.xml @@ -4,7 +4,7 @@ com.zlt central-platform - 5.3.0 + 5.4.0 zlt-transaction 事务 diff --git a/zlt-transaction/txlcn-tm/pom.xml b/zlt-transaction/txlcn-tm/pom.xml index 405b7c43dc8f858493662dd7870e30575bc72cdb..6f36da1f5a606b2e48a1f5ce52115f64e30fd13b 100644 --- a/zlt-transaction/txlcn-tm/pom.xml +++ b/zlt-transaction/txlcn-tm/pom.xml @@ -3,7 +3,7 @@ com.zlt zlt-transaction - 5.3.0 + 5.4.0 4.0.0 txlcn-tm diff --git a/zlt-uaa/pom.xml b/zlt-uaa/pom.xml index fe987f5057c08342ebd2e95f6f5dc70948194974..10c2c963e932cb801d137fb082c312f0f69ca890 100644 --- a/zlt-uaa/pom.xml +++ b/zlt-uaa/pom.xml @@ -4,7 +4,7 @@ com.zlt central-platform - 5.3.0 + 5.4.0 zlt-uaa 认证中心 diff --git a/zlt-web/back-web/pom.xml b/zlt-web/back-web/pom.xml index d18a4eaf5d6f40bec214313e952109f1912f1e2a..e30a22c38bcd0e0b5e0588e5b2a28e9fb72f6d29 100644 --- a/zlt-web/back-web/pom.xml +++ b/zlt-web/back-web/pom.xml @@ -6,7 +6,7 @@ com.zlt zlt-web - 5.3.0 + 5.4.0 back-web 后台管理前端 diff --git a/zlt-web/pom.xml b/zlt-web/pom.xml index 1ea73fdd759b429363aebf9c9fe739b6dd397b35..34169a1c2a0faa600791dbae7f5b4778999adba3 100644 --- a/zlt-web/pom.xml +++ b/zlt-web/pom.xml @@ -6,7 +6,7 @@ com.zlt central-platform - 5.3.0 + 5.4.0 zlt-web 前端