Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # README.md # pom.xml # zlt-business/code-generator/pom.xml # zlt-business/file-center/pom.xml # zlt-business/pom.xml # zlt-business/search-center/pom.xml # zlt-business/search-center/search-client/pom.xml # zlt-business/search-center/search-server/pom.xml # zlt-business/user-center/pom.xml # zlt-commons/pom.xml # zlt-commons/zlt-auth-client-spring-boot-starter/pom.xml # zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java # zlt-commons/zlt-common-core/pom.xml # zlt-commons/zlt-common-core/src/main/java/com/central/common/constant/CommonConstant.java # zlt-commons/zlt-common-core/src/main/java/com/central/common/resolver/TokenArgumentResolver.java # zlt-commons/zlt-common-core/src/main/resources/META-INF/spring.factories # zlt-commons/zlt-common-spring-boot-starter/pom.xml # zlt-commons/zlt-common-spring-boot-starter/src/main/resources/META-INF/spring.factories # zlt-commons/zlt-db-spring-boot-starter/pom.xml # zlt-commons/zlt-db-spring-boot-starter/src/main/java/com/central/db/config/MybatisPlusAutoConfigure.java # zlt-commons/zlt-elasticsearch-spring-boot-starter/pom.xml # zlt-commons/zlt-loadbalancer-spring-boot-starter/pom.xml # zlt-commons/zlt-loadbalancer-spring-boot-starter/src/main/java/com/central/common/lb/chooser/RandomRuleChooser.java # zlt-commons/zlt-loadbalancer-spring-boot-starter/src/main/java/com/central/common/lb/chooser/RoundRuleChooser.java # zlt-commons/zlt-loadbalancer-spring-boot-starter/src/main/java/com/central/common/lb/config/FeignHttpInterceptorConfig.java # zlt-commons/zlt-loadbalancer-spring-boot-starter/src/main/java/com/central/common/lb/config/VersionLoadBalancerConfig.java # zlt-commons/zlt-loadbalancer-spring-boot-starter/src/main/java/com/central/common/lb/config/VersionRegisterBeanPostProcessor.java # zlt-commons/zlt-loadbalancer-spring-boot-starter/src/main/java/com/central/common/lb/loadbalancer/VersionLoadBalancer.java # zlt-commons/zlt-loadbalancer-spring-boot-starter/src/main/java/com/central/common/lb/utils/QueryUtils.java # zlt-commons/zlt-log-spring-boot-starter/pom.xml # zlt-commons/zlt-oss-spring-boot-starter/pom.xml # zlt-commons/zlt-redis-spring-boot-starter/pom.xml # zlt-commons/zlt-sentinel-spring-boot-starter/pom.xml # zlt-commons/zlt-swagger2-spring-boot-starter/pom.xml # zlt-commons/zlt-zookeeper-spring-boot-starter/pom.xml # zlt-config/pom.xml # zlt-config/src/main/resources/bootstrap.properties # zlt-demo/dubbo-demo/pom.xml # zlt-demo/pom.xml # zlt-demo/rocketmq-demo/pom.xml # zlt-demo/rocketmq-demo/rocketmq-consume/pom.xml # zlt-demo/rocketmq-demo/rocketmq-produce/pom.xml # zlt-demo/rocketmq-demo/rocketmq-transactional/pom.xml # zlt-demo/seata-demo/account-service/pom.xml # zlt-demo/seata-demo/business-service/pom.xml # zlt-demo/seata-demo/order-service/pom.xml # zlt-demo/seata-demo/pom.xml # zlt-demo/seata-demo/seata-common-starter/pom.xml # zlt-demo/seata-demo/storage-service/pom.xml # zlt-demo/sharding-jdbc-demo/pom.xml # zlt-demo/sso-demo/oidc-sso/pom.xml # zlt-demo/sso-demo/pom.xml # zlt-demo/sso-demo/ss-sso/pom.xml # zlt-demo/sso-demo/web-sso/pom.xml # zlt-demo/txlcn-demo/pom.xml # zlt-demo/txlcn-demo/txlcn-demo-common/pom.xml # zlt-demo/txlcn-demo/txlcn-demo-spring-service-a/pom.xml # zlt-demo/txlcn-demo/txlcn-demo-spring-service-b/pom.xml # zlt-demo/txlcn-demo/txlcn-demo-spring-service-c/pom.xml # zlt-gateway/pom.xml # zlt-gateway/sc-gateway/pom.xml # zlt-job/job-admin/pom.xml # zlt-job/job-core/pom.xml # zlt-job/job-executor-samples/pom.xml # zlt-job/pom.xml # zlt-monitor/log-center/pom.xml # zlt-monitor/pom.xml # zlt-monitor/sc-admin/pom.xml # zlt-transaction/pom.xml # zlt-transaction/txlcn-tm/pom.xml # zlt-uaa/pom.xml # zlt-web/back-web/pom.xml # zlt-web/layui-web/Dockerfile # zlt-web/layui-web/src/main/resources/static/index.html # zlt-web/layui-web/src/main/resources/static/login.html # zlt-web/layui-web/src/main/resources/static/module/index.js # zlt-web/layui-web/src/main/resources/static/pages/attestation/app.html # zlt-web/layui-web/src/main/resources/static/pages/log/sysLog.html # zlt-web/layui-web/src/main/resources/static/pages/log/traceLog.html # zlt-web/layui-web/src/main/resources/static/pages/system/menus.html # zlt-web/pom.xml
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
# zlt-microservices-platform
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/Version-5.2.0-critical" alt="Downloads"/>
|
||||
<img src="https://img.shields.io/badge/Spring%20Boot-2.5.7-blue" alt="Downloads"/>
|
||||
<img src="https://img.shields.io/badge/Spring%20Cloud-2020.0.4-blue" alt="Downloads"/>
|
||||
<img src="https://img.shields.io/badge/Version-5.5.0-critical" alt="Downloads"/>
|
||||
<img src="https://img.shields.io/badge/Spring%20Boot-2.5.14-blue" alt="Downloads"/>
|
||||
<img src="https://img.shields.io/badge/Spring%20Cloud-2020.0.6-blue" alt="Downloads"/>
|
||||
<img src="https://img.shields.io/badge/Spring%20Cloud%20Alibaba-2021.1-blue" alt="Downloads"/>
|
||||
<img src="https://img.shields.io/badge/Elasticsearch-7.x-brightgreen" alt="Downloads"/>
|
||||
<img src="https://img.shields.io/badge/Ant%20Design-pro-9cf" alt="Downloads"/>
|
||||
<a target="_blank" href='https://gitee.com/zlt2000/microservices-platform'>
|
||||
<img src='https://gitee.com/zlt2000/microservices-platform/badge/star.svg' alt='star'/>
|
||||
</a>
|
||||
@@ -17,6 +18,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
## 如果您觉得有帮助,请点右上角 "Star" 支持一下谢谢
|
||||
|
||||
## 1. 总体架构图
|
||||
@@ -97,7 +99,8 @@ central-platform -- 父项目,公共依赖
|
||||
│ ├─zlt-uaa -- spring-security认证中心[8000]
|
||||
│ ├─zlt-register -- 注册中心Nacos[8848]
|
||||
│ ├─zlt-web -- 前端一级工程
|
||||
│ │ ├─back-web -- 后台前端[8066]
|
||||
│ │ ├─layui-web -- layui前端[8066]
|
||||
│ │ ├─react-web -- react前端[8066]
|
||||
│ ├─zlt-transaction -- 事务一级工程
|
||||
│ │ ├─txlcn-tm -- tx-lcn事务管理器[7970]
|
||||
│ ├─zlt-demo -- demo一级工程
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>central-platform</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
@@ -14,8 +14,8 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>8</java.version>
|
||||
<spring-cloud-alibaba-dependencies.version>2021.1</spring-cloud-alibaba-dependencies.version>
|
||||
<spring-boot-dependencies.version>2.5.9</spring-boot-dependencies.version>
|
||||
<spring-cloud-dependencies.version>2020.0.4</spring-cloud-dependencies.version>
|
||||
<spring-boot-dependencies.version>2.5.14</spring-boot-dependencies.version>
|
||||
<spring-cloud-dependencies.version>2020.0.6</spring-cloud-dependencies.version>
|
||||
<commons-collections4.version>4.4</commons-collections4.version>
|
||||
<swagger.butler.version>2.0.1</swagger.butler.version>
|
||||
<jjwt.version>0.9.1</jjwt.version>
|
||||
@@ -32,7 +32,7 @@
|
||||
<qiniu-java-sdk>7.2.28</qiniu-java-sdk>
|
||||
<easypoi.version>4.1.3</easypoi.version>
|
||||
<poi.version>4.1.1</poi.version>
|
||||
<spring-boot-admin.version>2.5.5</spring-boot-admin.version>
|
||||
<spring-boot-admin.version>2.5.6</spring-boot-admin.version>
|
||||
<velocity.version>1.7</velocity.version>
|
||||
<commons-configuration2.version>2.7</commons-configuration2.version>
|
||||
<txlcn.version>5.0.2.RELEASE</txlcn.version>
|
||||
@@ -483,7 +483,7 @@
|
||||
<!-- 业务 -->
|
||||
<module>zlt-business</module>
|
||||
<!-- 前端 -->
|
||||
<module>zlt-web</module>
|
||||
<!--<module>zlt-web</module>-->
|
||||
<!-- 任务 -->
|
||||
<module>zlt-job</module>
|
||||
<!-- 监控 -->
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-business</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>code-generator</artifactId>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-business</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>file-center</artifactId>
|
||||
<description>文件中心</description>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>central-platform</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>zlt-business</artifactId>
|
||||
<description>业务中心</description>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-business</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>search-center</artifactId>
|
||||
<description>搜索中心</description>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>search-center</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>search-client</artifactId>
|
||||
<description>搜索中心客户端</description>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>search-center</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>search-server</artifactId>
|
||||
<description>搜索中心服务端</description>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-business</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>user-center</artifactId>
|
||||
<description>用户中心</description>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>central-platform</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<description>通用组件</description>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
@@ -42,5 +42,10 @@
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-websocket</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
+6
-1
@@ -9,6 +9,7 @@ import org.springframework.security.config.annotation.web.configurers.Expression
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
|
||||
import org.springframework.security.oauth2.provider.authentication.TokenExtractor;
|
||||
import org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler;
|
||||
import org.springframework.security.oauth2.provider.expression.OAuth2WebSecurityExpressionHandler;
|
||||
import org.springframework.security.oauth2.provider.token.TokenStore;
|
||||
@@ -36,13 +37,17 @@ public class DefaultResourceServerConf extends ResourceServerConfigurerAdapter {
|
||||
@Autowired
|
||||
private SecurityProperties securityProperties;
|
||||
|
||||
@Resource
|
||||
private TokenExtractor tokenExtractor;
|
||||
|
||||
@Override
|
||||
public void configure(ResourceServerSecurityConfigurer resources) {
|
||||
resources.tokenStore(tokenStore)
|
||||
.stateless(true)
|
||||
.authenticationEntryPoint(authenticationEntryPoint)
|
||||
.expressionHandler(expressionHandler)
|
||||
.accessDeniedHandler(oAuth2AccessDeniedHandler);
|
||||
.accessDeniedHandler(oAuth2AccessDeniedHandler)
|
||||
.tokenExtractor(tokenExtractor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.central.oauth2.common.config;
|
||||
|
||||
import com.central.oauth2.common.util.AuthUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.websocket.server.ServerEndpointConfig;
|
||||
|
||||
/**
|
||||
* webSocket鉴权配置
|
||||
*
|
||||
* @author zlt
|
||||
* @version 1.0
|
||||
* @date 2022/5/8
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
@Slf4j
|
||||
public class WcAuthConfigurator extends ServerEndpointConfig.Configurator {
|
||||
@Override
|
||||
public boolean checkOrigin(String originHeaderValue) {
|
||||
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
try {
|
||||
//检查token有效性
|
||||
AuthUtils.checkAccessToken(servletRequestAttributes.getRequest());
|
||||
} catch (Exception e) {
|
||||
log.error("WebSocket-auth-error", e);
|
||||
return false;
|
||||
}
|
||||
return super.checkOrigin(originHeaderValue);
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.central.oauth2.common.service.impl;
|
||||
|
||||
import com.central.oauth2.common.properties.SecurityProperties;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.oauth2.provider.authentication.BearerTokenExtractor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 自定义 TokenExtractor
|
||||
*
|
||||
* @author zlt
|
||||
* @version 1.0
|
||||
* @date 2022/6/4
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
@ConditionalOnClass(HttpServletRequest.class)
|
||||
@Component
|
||||
public class CustomBearerTokenExtractor extends BearerTokenExtractor {
|
||||
@Resource
|
||||
private SecurityProperties securityProperties;
|
||||
|
||||
private final AntPathMatcher antPathMatcher = new AntPathMatcher();
|
||||
|
||||
/**
|
||||
* 解决只要请求携带access_token,排除鉴权的url依然会被拦截
|
||||
*/
|
||||
@Override
|
||||
public Authentication extract(HttpServletRequest request) {
|
||||
//判断当前请求为排除鉴权的url时,直接返回null
|
||||
for (String url : securityProperties.getIgnore().getUrls()) {
|
||||
if (antPathMatcher.match(url, request.getRequestURI())) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return super.extract(request);
|
||||
}
|
||||
}
|
||||
+60
-3
@@ -2,24 +2,32 @@ 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;
|
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||
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
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
@Slf4j
|
||||
public class AuthUtils {
|
||||
@@ -66,6 +74,40 @@ public class AuthUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验accessToken
|
||||
*/
|
||||
public static SysUser checkAccessToken(HttpServletRequest request) {
|
||||
String accessToken = extractToken(request);
|
||||
return checkAccessToken(accessToken);
|
||||
}
|
||||
|
||||
public static SysUser checkAccessToken(String accessTokenValue) {
|
||||
TokenStore tokenStore = SpringUtil.getBean(TokenStore.class);
|
||||
OAuth2AccessToken accessToken = tokenStore.readAccessToken(accessTokenValue);
|
||||
if (accessToken == null || accessToken.getValue() == null) {
|
||||
throw new InvalidTokenException("Invalid access token: " + accessTokenValue);
|
||||
} else if (accessToken.isExpired()) {
|
||||
tokenStore.removeAccessToken(accessToken);
|
||||
throw new InvalidTokenException("Access token expired: " + accessTokenValue);
|
||||
}
|
||||
OAuth2Authentication result = tokenStore.readAuthentication(accessToken);
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* *从header 请求中的clientId:clientSecret
|
||||
*/
|
||||
@@ -107,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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登陆的帐户类型
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>zlt-common-core</artifactId>
|
||||
<description>公共通用组件</description>
|
||||
@@ -16,8 +16,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus</artifactId>
|
||||
<optional>true</optional>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.social</groupId>
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ public interface CommonConstant {
|
||||
/**
|
||||
* 项目版本号(banner使用)
|
||||
*/
|
||||
String PROJECT_VERSION = "5.2.0";
|
||||
String PROJECT_VERSION = "5.5.0";
|
||||
|
||||
/**
|
||||
* token请求头名称
|
||||
|
||||
+29
@@ -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
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
public class LoginUserContextHolder {
|
||||
private static final ThreadLocal<SysUser> 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();
|
||||
}
|
||||
}
|
||||
+6
-23
@@ -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<SysRole> 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);
|
||||
}
|
||||
}
|
||||
|
||||
+69
@@ -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
|
||||
* <p>
|
||||
* 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<SysRole> sysRoleList = new ArrayList<>();
|
||||
Arrays.stream(roles.split(",")).forEach(role -> {
|
||||
SysRole sysRole = new SysRole();
|
||||
sysRole.setCode(role);
|
||||
sysRoleList.add(sysRole);
|
||||
});
|
||||
user.setRoles(sysRoleList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return user;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.central.common.utils;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -11,6 +12,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author 作者 owen E-mail: 624191343@qq.com
|
||||
*/
|
||||
@Component
|
||||
@Order(0)
|
||||
public class SpringUtil implements ApplicationContextAware {
|
||||
|
||||
private static ApplicationContext applicationContext = null;
|
||||
|
||||
@@ -3,4 +3,5 @@ com.central.common.config.BannerInitializer
|
||||
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.central.common.feign.fallback.UserServiceFallbackFactory,\
|
||||
com.central.common.lock.LockAspect
|
||||
com.central.common.lock.LockAspect,\
|
||||
com.central.common.utils.SpringUtil
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>zlt-common-spring-boot-starter</artifactId>
|
||||
<description>公共通用组件</description>
|
||||
|
||||
+40
@@ -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
|
||||
* <p>
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.central.common.filter.TenantFilter
|
||||
com.central.common.filter.TenantFilter, \
|
||||
com.central.common.filter.LoginUserFilter
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
+1
-1
@@ -40,7 +40,6 @@ public class MybatisPlusAutoConfigure {
|
||||
@Bean
|
||||
public MybatisPlusInterceptor paginationInterceptor() {
|
||||
MybatisPlusInterceptor mpInterceptor = new MybatisPlusInterceptor();
|
||||
mpInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
boolean enableTenant = tenantProperties.getEnable();
|
||||
//是否开启多租户隔离
|
||||
if (enableTenant) {
|
||||
@@ -48,6 +47,7 @@ public class MybatisPlusAutoConfigure {
|
||||
tenantLineHandler, tenantProperties.getIgnoreSqls());
|
||||
mpInterceptor.addInnerInterceptor(tenantInterceptor);
|
||||
}
|
||||
mpInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
return mpInterceptor;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.central.common.lb.chooser;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
public class RandomRuleChooser implements IRuleChooser {
|
||||
@Override
|
||||
public ServiceInstance choose(List<ServiceInstance> instances) {
|
||||
if(CollUtil.isNotEmpty(instances)){
|
||||
if(CollectionUtils.isNotEmpty(instances)){
|
||||
int randomValue = ThreadLocalRandom.current().nextInt(instances.size());
|
||||
ServiceInstance serviceInstance = instances.get(randomValue);
|
||||
log.info("选择了ip为{}, 端口为:{}的服务", serviceInstance.getHost(), serviceInstance.getPort());
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.central.common.lb.chooser;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class RoundRuleChooser implements IRuleChooser{
|
||||
|
||||
@Override
|
||||
public ServiceInstance choose(List<ServiceInstance> instances) {
|
||||
if(CollUtil.isNotEmpty(instances)){
|
||||
if(CollectionUtils.isNotEmpty(instances)){
|
||||
ServiceInstance serviceInstance = instances.get(Math.abs(position.incrementAndGet() % instances.size()));
|
||||
log.info("选择了ip为{}, 端口为:{}的服务", serviceInstance.getHost(), serviceInstance.getPort());
|
||||
return serviceInstance;
|
||||
|
||||
+1
@@ -4,6 +4,7 @@ import com.central.common.constant.CommonConstant;
|
||||
import com.central.common.constant.SecurityConstants;
|
||||
import com.central.common.lb.utils.QueryUtils;
|
||||
import feign.RequestInterceptor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
||||
+2
-4
@@ -1,11 +1,11 @@
|
||||
package com.central.common.lb.config;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.central.common.constant.ConfigConstants;
|
||||
import com.central.common.lb.chooser.IRuleChooser;
|
||||
import com.central.common.lb.chooser.RoundRuleChooser;
|
||||
import com.central.common.lb.loadbalancer.VersionLoadBalancer;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.loadbalancer.core.ReactorServiceInstanceLoadBalancer;
|
||||
@@ -15,8 +15,6 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* 版本控制的路由选择类配置
|
||||
@@ -36,7 +34,7 @@ public class VersionLoadBalancerConfig{
|
||||
IRuleChooser chooser = new RoundRuleChooser();
|
||||
if (environment.containsProperty(ConfigConstants.CONFIG_LOADBALANCE_ISOLATION_CHOOSER)) {
|
||||
String chooserRuleClassString = environment.getProperty(ConfigConstants.CONFIG_LOADBALANCE_ISOLATION_CHOOSER);
|
||||
if(StrUtil.isNotBlank(chooserRuleClassString)){
|
||||
if(StringUtils.isNotBlank(chooserRuleClassString)){
|
||||
try {
|
||||
Class<?> ruleClass = ClassUtils.forName(chooserRuleClassString, context.getClassLoader());
|
||||
chooser = (IRuleChooser) ruleClass.newInstance();
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.central.common.lb.config;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
import com.central.common.constant.CommonConstant;
|
||||
import com.central.common.constant.ConfigConstants;
|
||||
import org.springframework.beans.BeansException;
|
||||
@@ -18,7 +18,7 @@ public class VersionRegisterBeanPostProcessor implements BeanPostProcessor {
|
||||
private String version;
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
if(bean instanceof NacosDiscoveryProperties && StrUtil.isNotBlank(version)){
|
||||
if(bean instanceof NacosDiscoveryProperties && StringUtils.isNotBlank(version)){
|
||||
NacosDiscoveryProperties nacosDiscoveryProperties = (NacosDiscoveryProperties) bean;
|
||||
nacosDiscoveryProperties.getMetadata().putIfAbsent(CommonConstant.METADATA_VERSION, version);
|
||||
}
|
||||
|
||||
+8
-15
@@ -1,27 +1,20 @@
|
||||
package com.central.common.lb.loadbalancer;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.central.common.constant.CommonConstant;
|
||||
import com.central.common.context.LbIsolationContextHolder;
|
||||
import com.central.common.lb.chooser.IRuleChooser;
|
||||
import com.central.common.lb.utils.QueryUtils;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.client.loadbalancer.*;
|
||||
import org.springframework.cloud.loadbalancer.core.ReactorServiceInstanceLoadBalancer;
|
||||
import org.springframework.cloud.loadbalancer.core.RoundRobinLoadBalancer;
|
||||
import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier;
|
||||
import org.springframework.cloud.loadbalancer.support.SimpleObjectProvider;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -59,7 +52,7 @@ public class VersionLoadBalancer implements ReactorServiceInstanceLoadBalancer {
|
||||
|
||||
private String getVersionFromRequestData(RequestData requestData){
|
||||
Map<String, String> queryMap = QueryUtils.getQueryMap(requestData.getUrl());
|
||||
if(MapUtils.isNotEmpty(queryMap)&& queryMap.containsKey(CommonConstant.Z_L_T_VERSION)&& StrUtil.isNotBlank(queryMap.get(CommonConstant.Z_L_T_VERSION))){
|
||||
if(MapUtils.isNotEmpty(queryMap)&& queryMap.containsKey(CommonConstant.Z_L_T_VERSION)&& StringUtils.isNotBlank(queryMap.get(CommonConstant.Z_L_T_VERSION))){
|
||||
return queryMap.get(CommonConstant.Z_L_T_VERSION);
|
||||
}else if(requestData.getHeaders().containsKey(CommonConstant.Z_L_T_VERSION)){
|
||||
return requestData.getHeaders().get(CommonConstant.Z_L_T_VERSION).get(0);
|
||||
@@ -76,8 +69,8 @@ public class VersionLoadBalancer implements ReactorServiceInstanceLoadBalancer {
|
||||
*/
|
||||
private Response<ServiceInstance> getInstanceResponse(List<ServiceInstance>instances, String version){
|
||||
List<ServiceInstance> filteredServiceIstanceList = instances;
|
||||
if(StrUtil.isNotBlank(version)){
|
||||
if(CollUtil.isNotEmpty(instances)){
|
||||
if(StringUtils.isNotBlank(version)){
|
||||
if(CollectionUtils.isNotEmpty(instances)){
|
||||
filteredServiceIstanceList = instances.stream()
|
||||
.filter(item->item.getMetadata().containsKey(CommonConstant.METADATA_VERSION)&&
|
||||
version.equals(item.getMetadata().get(CommonConstant.METADATA_VERSION)))
|
||||
@@ -85,15 +78,15 @@ public class VersionLoadBalancer implements ReactorServiceInstanceLoadBalancer {
|
||||
}
|
||||
}
|
||||
// 如果没有找到对应的版本实例时,选择版本号为空的或这版本为default的实例
|
||||
if(CollUtil.isEmpty(filteredServiceIstanceList)){
|
||||
if(CollectionUtils.isEmpty(filteredServiceIstanceList)){
|
||||
filteredServiceIstanceList = instances.stream()
|
||||
.filter(item->!item.getMetadata().containsKey(CommonConstant.METADATA_VERSION)||
|
||||
StrUtil.isBlank(item.getMetadata().get(CommonConstant.METADATA_VERSION))
|
||||
StringUtils.isBlank(item.getMetadata().get(CommonConstant.METADATA_VERSION))
|
||||
|| "default".equals(item.getMetadata().get(CommonConstant.METADATA_VERSION)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// 经过两轮过滤后如果能找到的话就选择,不然返回空
|
||||
if(CollUtil.isNotEmpty(filteredServiceIstanceList)){
|
||||
if(CollectionUtils.isNotEmpty(filteredServiceIstanceList)){
|
||||
ServiceInstance serviceInstance = this.ruleChooser.choose(filteredServiceIstanceList);
|
||||
if(!Objects.isNull(serviceInstance)){
|
||||
log.debug("使用serviceId为:{}服务, 选择version为:{}, 地址:{}:{},", serviceId, version
|
||||
|
||||
+3
-4
@@ -1,7 +1,6 @@
|
||||
package com.central.common.lb.utils;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Arrays;
|
||||
@@ -22,9 +21,9 @@ public class QueryUtils {
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, String> getQueryMap(String queryString){
|
||||
if(StrUtil.isNotBlank(queryString)){
|
||||
if(StringUtils.isNotBlank(queryString)){
|
||||
return Arrays.stream(queryString.split("&")).map(item -> item.split("="))
|
||||
.collect(Collectors.toMap(key -> key[0], value -> value.length > 1 && StrUtil.isNotBlank(value[1]) ? value[1] : ""));
|
||||
.collect(Collectors.toMap(key -> key[0], value -> value.length > 1 && StringUtils.isNotBlank(value[1]) ? value[1] : ""));
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-commons</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>central-platform</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
########################## 统一变量配置 ##########################
|
||||
##### 数据库配置
|
||||
zlt.datasource.ip=192.168.28.130
|
||||
zlt.datasource.ip=127.0.0.1
|
||||
zlt.datasource.username=root
|
||||
zlt.datasource.password=1q2w3e4r
|
||||
zlt.datasource.password=123456
|
||||
|
||||
##### redis配置
|
||||
spring.redis.host=192.168.28.130
|
||||
spring.redis.host=127.0.0.1
|
||||
spring.redis.port=6379
|
||||
spring.redis.timeout=5000
|
||||
|
||||
@@ -34,4 +34,7 @@ zlt.trace.enable=true
|
||||
zlt.ribbon.isolation.enabled=false
|
||||
|
||||
##### mybatis-plus打印完整sql(只适用于开发环境)
|
||||
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
# 开启版本路由
|
||||
#zlt.loadbalance.isolation.enabled=true
|
||||
@@ -6,8 +6,8 @@ zlt.datasource.password=1q2w3e4r
|
||||
|
||||
##### redis配置
|
||||
spring.redis.sentinel.master=mymaster
|
||||
spring.redis.sentinel.nodes=192.168.28.130:26380,192.168.28.131:26381
|
||||
spring.redis.password=1q2w3e4r
|
||||
spring.redis.sentinel.nodes=172.17.0.1
|
||||
spring.redis.password=
|
||||
|
||||
##### elasticsearch配置
|
||||
zlt.elasticsearch.uris=192.168.28.130:9200
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
spring.profiles.active=dev
|
||||
|
||||
##### nacos(注册中心和配置中心)地址
|
||||
spring.cloud.nacos.server-addr=192.168.28.130:8848
|
||||
#spring.cloud.nacos.username=nacos
|
||||
#spring.cloud.nacos.password=nacos
|
||||
spring.cloud.nacos.server-addr=127.0.0.1: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=*
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>dubbo-demo</artifactId>
|
||||
|
||||
|
||||
+5
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>central-platform</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>zlt-demo</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
@@ -22,5 +22,9 @@
|
||||
<module>sso-demo</module>
|
||||
<!-- dubbo集成demo -->
|
||||
<module>dubbo-demo</module>
|
||||
<!-- webSocket集成demo -->
|
||||
<module>websocket-demo</module>
|
||||
<!-- 资源服务器demo -->
|
||||
<module>resources-server-demo</module>
|
||||
</modules>
|
||||
</project>
|
||||
@@ -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
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-demo</artifactId>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>resources-server-demo</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-common-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-auth-client-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-redis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.zlt;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author zlt
|
||||
* @date 2022/6/25
|
||||
* <p>
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
@Configuration
|
||||
@EnableResourceServer
|
||||
public class MyResourceConfig extends DefaultResourceServerConf {
|
||||
}
|
||||
@@ -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
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
@Configuration
|
||||
public class WebMvcConfig extends DefaultWebMvcConfig {
|
||||
}
|
||||
@@ -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
|
||||
* <p>
|
||||
* 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";
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>rocketmq-demo</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>rocketmq-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>rocketmq-consume</artifactId>
|
||||
<description>rocketMQ消费者demo</description>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>rocketmq-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>rocketmq-produce</artifactId>
|
||||
<description>rocketMQ生产者demo</description>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>rocketmq-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>rocketmq-transactional</artifactId>
|
||||
<description>rocketMQ事务消息demo</description>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>seata-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>account-service</artifactId>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>seata-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>business-service</artifactId>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>seata-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>order-service</artifactId>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>seata-demo</artifactId>
|
||||
<description>seata分布式事务demo</description>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>seata-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>seata-common-starter</artifactId>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>seata-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>storage-service</artifactId>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>sharding-jdbc-demo</artifactId>
|
||||
<description>sharding-jdbc分库分表demo</description>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>sso-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>oidc-sso</artifactId>
|
||||
<description>OIDC协议单点登录demo</description>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>sso-demo</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>sso-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>ss-sso</artifactId>
|
||||
<description>springSecurity单点登录demo</description>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>sso-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>web-sso</artifactId>
|
||||
<description>前后端分离单点登录demo</description>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>txlcn-demo</artifactId>
|
||||
<description>txlcn分布式事务demo</description>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>txlcn-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>txlcn-demo-common</artifactId>
|
||||
<name>demo-common</name>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>txlcn-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>txlcn-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>txlcn-demo-spring-service-b</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>txlcn-demo</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>txlcn-demo-spring-service-c</artifactId>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
## 代码说明
|
||||
- [SpringBoot的WebSocket接口如何实现鉴权?](https://www.kancloud.cn/zlt2000/microservices-platform/2278851)
|
||||
|
||||
|
||||
## 启动以下服务
|
||||
|
||||
1. zlt-uaa:统一认证中心
|
||||
2. user-center:用户服务
|
||||
3. sc-gateway:api网关
|
||||
4. websocket-demo
|
||||
|
||||
> 环境配置与启动参考文档:https://www.kancloud.cn/zlt2000/microservices-platform/919418
|
||||
|
||||
|
||||
## 获取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
|
||||
|
||||
|
||||
## 测试步骤
|
||||
使用 `Postman` 进行测试(最新版本支持 webSocket 接口)
|
||||
|
||||
点击 `New` 按钮,选择 `WebSocket Request` ;
|
||||
|
||||
在 `URL` 中输入 `ws://localhost:8092/websocket/test`
|
||||
|
||||
在 `Headers` 中添加:`Authorization:Bearer xxx`
|
||||
|
||||
或者
|
||||
|
||||
在 `参数` 中添加:`ws://localhost:8092/websocket/test?access_token=xxx`
|
||||
|
||||
> xxx 需替换为正确的 access_token
|
||||
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-demo</artifactId>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>websocket-demo</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-auth-client-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-redis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.zlt;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author zlt
|
||||
* @date 2022/5/8
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class WebSocketApp {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WebSocketApp.class, args);
|
||||
}
|
||||
}
|
||||
@@ -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/5/9
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
@Configuration
|
||||
@EnableResourceServer
|
||||
public class MyResourceConfig extends DefaultResourceServerConf {
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.zlt.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
|
||||
/**
|
||||
* WebSocket配置
|
||||
*
|
||||
* @author zlt
|
||||
* @version 1.0
|
||||
* @date 2022/5/8
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
@Configuration
|
||||
public class WebSocketConfig {
|
||||
@Bean
|
||||
public ServerEndpointExporter serverEndpointExporter() {
|
||||
return new ServerEndpointExporter();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.zlt.controller;
|
||||
|
||||
import com.central.oauth2.common.config.WcAuthConfigurator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.websocket.OnOpen;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author zlt
|
||||
* @date 2022/5/8
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@ServerEndpoint(value = "/websocket/test", configurator = WcAuthConfigurator.class)
|
||||
public class TestWebSocketController {
|
||||
@OnOpen
|
||||
public void onOpen(Session session) throws IOException {
|
||||
session.getBasicRemote().sendText("TestWebSocketController-ok");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
server:
|
||||
port: 8092
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: zlt-websocket
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
zlt:
|
||||
security:
|
||||
ignore:
|
||||
httpUrls: >
|
||||
/websocket/**
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>central-platform</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>zlt-gateway</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-gateway</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>sc-gateway</artifactId>
|
||||
<description>spring cloud gateway网关</description>
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.central.gateway.auth;
|
||||
|
||||
import com.central.oauth2.common.properties.SecurityProperties;
|
||||
import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* 自定义 ServerWebExchangeMatcher
|
||||
* 解决只要请求携带access_token,排除鉴权的url依然会被拦截
|
||||
*
|
||||
* @author zlt
|
||||
* @version 1.0
|
||||
* @date 2022/6/10
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
public class CustomServerWebExchangeMatchers implements ServerWebExchangeMatcher {
|
||||
private final SecurityProperties securityProperties;
|
||||
|
||||
private final AntPathMatcher antPathMatcher = new AntPathMatcher();
|
||||
|
||||
public CustomServerWebExchangeMatchers(SecurityProperties securityProperties) {
|
||||
this.securityProperties = securityProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<MatchResult> matches(ServerWebExchange exchange) {
|
||||
for (String url : securityProperties.getIgnore().getUrls()) {
|
||||
if (antPathMatcher.match(url, exchange.getRequest().getURI().getPath())) {
|
||||
return MatchResult.notMatch();
|
||||
}
|
||||
}
|
||||
return MatchResult.match();
|
||||
}
|
||||
}
|
||||
+1
@@ -48,6 +48,7 @@ public class ResourceServerConfiguration {
|
||||
oauth2Filter.setServerAuthenticationConverter(tokenAuthenticationConverter);
|
||||
oauth2Filter.setAuthenticationFailureHandler(new ServerAuthenticationEntryPointFailureHandler(entryPoint));
|
||||
oauth2Filter.setAuthenticationSuccessHandler(new Oauth2AuthSuccessHandler());
|
||||
oauth2Filter.setRequiresAuthenticationMatcher(new CustomServerWebExchangeMatchers(securityProperties));
|
||||
http.addFilterAt(oauth2Filter, SecurityWebFiltersOrder.AUTHENTICATION);
|
||||
|
||||
ServerHttpSecurity.AuthorizeExchangeSpec authorizeExchange = http.authorizeExchange();
|
||||
|
||||
+6
-6
@@ -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<ViewResolver> viewResolvers;
|
||||
|
||||
private final ServerCodecConfigurer serverCodecConfigurer;
|
||||
|
||||
public CustomErrorWebFluxAutoConfiguration(ServerProperties serverProperties,
|
||||
ResourceProperties resourceProperties,
|
||||
WebProperties webProperties,
|
||||
ObjectProvider<List<ViewResolver>> 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);
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-job</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>job-admin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-job</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>job-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-job</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>job-executor-samples</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>central-platform</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>zlt-job</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-monitor</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>log-center</artifactId>
|
||||
<dependencies>
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>central-platform</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>zlt-monitor</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-monitor</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>sc-admin</artifactId>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>central-platform</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>zlt-transaction</artifactId>
|
||||
<description>事务</description>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-transaction</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>txlcn-tm</artifactId>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>central-platform</artifactId>
|
||||
<version>5.2.0</version>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<artifactId>zlt-uaa</artifactId>
|
||||
<description>认证中心</description>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
**/node
|
||||
**/node_modules
|
||||
# roadhog-api-doc ignore
|
||||
/src/utils/request-temp.js
|
||||
_roadhog-api-doc
|
||||
|
||||
# production
|
||||
**/dist
|
||||
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
npm-debug.log*
|
||||
yarn-error.log
|
||||
|
||||
/coverage
|
||||
.idea
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
pnpm-lock.yaml
|
||||
*bak
|
||||
|
||||
|
||||
# visual studio code
|
||||
.vscode
|
||||
.history
|
||||
*.log
|
||||
functions/*
|
||||
.temp/**
|
||||
|
||||
# umi
|
||||
.umi
|
||||
.umi-production
|
||||
|
||||
# screenshot
|
||||
screenshot
|
||||
.firebase
|
||||
.eslintcache
|
||||
|
||||
# maven
|
||||
target
|
||||
build
|
||||
@@ -0,0 +1,117 @@
|
||||
# Central-Platform UI
|
||||
|
||||
本模块是基于`企业级微服务框架`后端 API 所开发的前端项目。
|
||||
|
||||
采用[Ant Design Pro](https://pro.ant.design/)框架,基于[UmiJS v3.x](https://v3.umijs.org/)和[ProComponents](https://procomponents.ant.design/);
|
||||
图表采用[Ant Design Charts](https://charts.ant.design/)。
|
||||
|
||||
## 一、目录说明
|
||||
考虑到react的复杂性,保留了layui版本的前端。
|
||||
```lua
|
||||
│ ├─layui-web -- layui前端
|
||||
│ │ ├─src
|
||||
│ │ │ ├─main
|
||||
│ │ │ │ ├─java -- java启动类
|
||||
│ │ │ │ ├─resources -- 前端源码
|
||||
│ │ │ │ │ ├─static -- 前端源码
|
||||
│ ├─react-web -- react前端
|
||||
│ │ ├─src
|
||||
│ │ │ ├─main
|
||||
│ │ │ │ ├─frontend -- 前端源码(Ant Design Pro)
|
||||
│ │ │ │ ├─java -- java启动类(集成frontend-maven-plugin)
|
||||
```
|
||||
|
||||
|
||||
## 二、运行方式
|
||||
### 2.1. layui-web
|
||||
**以下 2 种运行方式,选一种运行即可。**
|
||||
|
||||
#### 2.1.1. 方式一:直接运行
|
||||
运行类 `com.central.web.BackWebApplication`
|
||||
> 基于 SpringBoot 内嵌的 web 容器
|
||||
|
||||
#### 2.1.2. 方式二:静态服务器运行
|
||||
把 `layui-web\src\main\resources\static` 下的内容复制到类似 `Nginx` 之类的静态服务器运行。
|
||||
|
||||
#### 2.1.3. 后端接口地址修改
|
||||
修改 `layui-web\src\main\resources\static\module\apiUrl.js` 中的地址。
|
||||
|
||||
|
||||
### 2.2. react-web
|
||||
**以下 3 种运行方式,选一种运行即可。**
|
||||
|
||||
- 需要先安装 `nodejs` 官网地址:https://nodejs.org/en/download/
|
||||
|
||||
|
||||
- 然后安装 **node_modules**:
|
||||
|
||||
在 `react-web\src\main\frontend` 目录下执行以下命令:
|
||||
|
||||
```bash
|
||||
//设置使用淘宝的镜像源
|
||||
npm config set registry https://registry.npm.taobao.org/
|
||||
|
||||
// 安装
|
||||
npm install
|
||||
```
|
||||
|
||||
|
||||
#### 2.2.1. 方式一:本地运行
|
||||
##### 2.2.1.1. 运行
|
||||
运行 `frontend\start.bat` 文件或者执行 `npm start` 命令。
|
||||
|
||||
运行成功后,浏览器访问:http://localhost:8066
|
||||
|
||||
##### 2.2.1.2. 后端接口地址修改
|
||||
修改 `react-web\src\main\frontend\config\proxy.ts` 中的地址。
|
||||
|
||||
|
||||
#### 2.2.2. 方式二:静态服务器运行
|
||||
##### 2.2.2.1. 源码编译
|
||||
运行 `frontend\build.bat` 文件或者执行 `npm run build` 命令进行编译。
|
||||
|
||||
编译成功后,把 `react-web\src\main\frontend\dist` 下的内容复制到类似 `Nginx` 之类的静态服务器运行。
|
||||
|
||||
##### 2.2.2.2. 后端接口地址修改
|
||||
通过反向代理,例如 `Nginx` 的配置如下:
|
||||
```json
|
||||
location ~ ^/api-* {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Real-Port $remote_port;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://127.0.0.1:9900;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
expires 7d;
|
||||
}
|
||||
```
|
||||
|
||||
> 配置了两条路由,页面请求的各个 `api-xxx` 地址重定向到指定的接口地址;其他的则访问静态文件。
|
||||
|
||||
|
||||
|
||||
#### 2.2.3. 方式三:使用Java运行
|
||||
模块已集成Maven插件`frontend-maven-plugin`用于编译前端代码
|
||||
>由于需要安装前端环境并编译前端代码,**首次运行需要时间较长**。
|
||||
|
||||
在 `react-web` 目录下执行 maven 命令 `mvn package` 打包。
|
||||
|
||||
在target目录下生成zlt-web-x.x.x.jar(springboot jar)。
|
||||
```bash
|
||||
java -jar zlt-web-5.4.0.jar
|
||||
```
|
||||
|
||||
或者直接在IDE中运行 `react-web\src\main\java\ui\ReactUiBootApplication.java`
|
||||
> 运行前必需先使用 maven 对 react-web 工程进行编译或打包。
|
||||
|
||||
|
||||
## 四、More
|
||||
开发参考
|
||||
* [Ant Design Pro](https://pro.ant.design/) 开箱即用的中台前端/设计解决方案
|
||||
* [UmiJS v3.x](https://v3.umijs.org/) 可扩展的企业级前端应用框架
|
||||
* [Ant Design](https://ant.design/index-cn) 基于 Ant Design 设计体系的 React UI 组件库
|
||||
* [ProComponents](https://procomponents.ant.design/) 基于 Ant Design 设计规范,提供更高程度的抽象,提供更上层的设计规范
|
||||
* [Ant Design Charts](https://charts.ant.design/) 简单好用的 React 图表库
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user