Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zlt2000
microservices-platform
提交
b23fff55
microservices-platform
项目概览
zlt2000
/
microservices-platform
8 个月 前同步成功
通知
16
Star
4
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
microservices-platform
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
b23fff55
编写于
7月 10, 2022
作者:
zlt2000
提交者:
Gitee
7月 10, 2022
浏览文件
操作
浏览文件
下载
差异文件
!26 合并dev
Merge pull request !26 from zlt2000/dev
上级
073d7db6
4eed9279
变更
77
隐藏空白更改
内联
并排
Showing
77 changed file
with
467 addition
and
103 deletion
+467
-103
README.md
README.md
+2
-2
pom.xml
pom.xml
+2
-2
zlt-business/code-generator/pom.xml
zlt-business/code-generator/pom.xml
+1
-1
zlt-business/file-center/pom.xml
zlt-business/file-center/pom.xml
+1
-1
zlt-business/pom.xml
zlt-business/pom.xml
+1
-1
zlt-business/search-center/pom.xml
zlt-business/search-center/pom.xml
+1
-1
zlt-business/search-center/search-client/pom.xml
zlt-business/search-center/search-client/pom.xml
+1
-1
zlt-business/search-center/search-server/pom.xml
zlt-business/search-center/search-server/pom.xml
+1
-1
zlt-business/user-center/pom.xml
zlt-business/user-center/pom.xml
+1
-1
zlt-commons/pom.xml
zlt-commons/pom.xml
+1
-1
zlt-commons/zlt-auth-client-spring-boot-starter/pom.xml
zlt-commons/zlt-auth-client-spring-boot-starter/pom.xml
+1
-1
zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java
...c/main/java/com/central/oauth2/common/util/AuthUtils.java
+36
-6
zlt-commons/zlt-common-core/pom.xml
zlt-commons/zlt-common-core/pom.xml
+1
-1
zlt-commons/zlt-common-core/src/main/java/com/central/common/constant/CommonConstant.java
...main/java/com/central/common/constant/CommonConstant.java
+1
-1
zlt-commons/zlt-common-core/src/main/java/com/central/common/context/LoginUserContextHolder.java
...va/com/central/common/context/LoginUserContextHolder.java
+29
-0
zlt-commons/zlt-common-core/src/main/java/com/central/common/resolver/TokenArgumentResolver.java
...va/com/central/common/resolver/TokenArgumentResolver.java
+6
-23
zlt-commons/zlt-common-core/src/main/java/com/central/common/utils/LoginUserUtils.java
...rc/main/java/com/central/common/utils/LoginUserUtils.java
+69
-0
zlt-commons/zlt-common-spring-boot-starter/pom.xml
zlt-commons/zlt-common-spring-boot-starter/pom.xml
+1
-1
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/filter/LoginUserFilter.java
.../main/java/com/central/common/filter/LoginUserFilter.java
+40
-0
zlt-commons/zlt-common-spring-boot-starter/src/main/resources/META-INF/spring.factories
...boot-starter/src/main/resources/META-INF/spring.factories
+2
-1
zlt-commons/zlt-db-spring-boot-starter/pom.xml
zlt-commons/zlt-db-spring-boot-starter/pom.xml
+1
-1
zlt-commons/zlt-elasticsearch-spring-boot-starter/pom.xml
zlt-commons/zlt-elasticsearch-spring-boot-starter/pom.xml
+1
-1
zlt-commons/zlt-loadbalancer-spring-boot-starter/pom.xml
zlt-commons/zlt-loadbalancer-spring-boot-starter/pom.xml
+1
-1
zlt-commons/zlt-log-spring-boot-starter/pom.xml
zlt-commons/zlt-log-spring-boot-starter/pom.xml
+1
-1
zlt-commons/zlt-oss-spring-boot-starter/pom.xml
zlt-commons/zlt-oss-spring-boot-starter/pom.xml
+1
-1
zlt-commons/zlt-redis-spring-boot-starter/pom.xml
zlt-commons/zlt-redis-spring-boot-starter/pom.xml
+1
-1
zlt-commons/zlt-sentinel-spring-boot-starter/pom.xml
zlt-commons/zlt-sentinel-spring-boot-starter/pom.xml
+1
-1
zlt-commons/zlt-swagger2-spring-boot-starter/pom.xml
zlt-commons/zlt-swagger2-spring-boot-starter/pom.xml
+1
-1
zlt-commons/zlt-zookeeper-spring-boot-starter/pom.xml
zlt-commons/zlt-zookeeper-spring-boot-starter/pom.xml
+1
-1
zlt-config/pom.xml
zlt-config/pom.xml
+1
-1
zlt-config/src/main/resources/bootstrap.properties
zlt-config/src/main/resources/bootstrap.properties
+2
-2
zlt-demo/dubbo-demo/pom.xml
zlt-demo/dubbo-demo/pom.xml
+1
-1
zlt-demo/pom.xml
zlt-demo/pom.xml
+3
-1
zlt-demo/resources-server-demo/README.md
zlt-demo/resources-server-demo/README.md
+45
-0
zlt-demo/resources-server-demo/pom.xml
zlt-demo/resources-server-demo/pom.xml
+55
-0
zlt-demo/resources-server-demo/src/main/java/org/zlt/ResourcesServerApp.java
...server-demo/src/main/java/org/zlt/ResourcesServerApp.java
+18
-0
zlt-demo/resources-server-demo/src/main/java/org/zlt/config/MyResourceConfig.java
...r-demo/src/main/java/org/zlt/config/MyResourceConfig.java
+20
-0
zlt-demo/resources-server-demo/src/main/java/org/zlt/config/WebMvcConfig.java
...erver-demo/src/main/java/org/zlt/config/WebMvcConfig.java
+18
-0
zlt-demo/resources-server-demo/src/main/java/org/zlt/controller/TestController.java
...demo/src/main/java/org/zlt/controller/TestController.java
+40
-0
zlt-demo/resources-server-demo/src/main/resources/bootstrap.yml
...mo/resources-server-demo/src/main/resources/bootstrap.yml
+14
-0
zlt-demo/rocketmq-demo/pom.xml
zlt-demo/rocketmq-demo/pom.xml
+1
-1
zlt-demo/rocketmq-demo/rocketmq-consume/pom.xml
zlt-demo/rocketmq-demo/rocketmq-consume/pom.xml
+1
-1
zlt-demo/rocketmq-demo/rocketmq-produce/pom.xml
zlt-demo/rocketmq-demo/rocketmq-produce/pom.xml
+1
-1
zlt-demo/rocketmq-demo/rocketmq-transactional/pom.xml
zlt-demo/rocketmq-demo/rocketmq-transactional/pom.xml
+1
-1
zlt-demo/seata-demo/account-service/pom.xml
zlt-demo/seata-demo/account-service/pom.xml
+1
-1
zlt-demo/seata-demo/business-service/pom.xml
zlt-demo/seata-demo/business-service/pom.xml
+1
-1
zlt-demo/seata-demo/order-service/pom.xml
zlt-demo/seata-demo/order-service/pom.xml
+1
-1
zlt-demo/seata-demo/pom.xml
zlt-demo/seata-demo/pom.xml
+1
-1
zlt-demo/seata-demo/seata-common-starter/pom.xml
zlt-demo/seata-demo/seata-common-starter/pom.xml
+1
-1
zlt-demo/seata-demo/storage-service/pom.xml
zlt-demo/seata-demo/storage-service/pom.xml
+1
-1
zlt-demo/sharding-jdbc-demo/pom.xml
zlt-demo/sharding-jdbc-demo/pom.xml
+1
-1
zlt-demo/sso-demo/oidc-sso/pom.xml
zlt-demo/sso-demo/oidc-sso/pom.xml
+1
-1
zlt-demo/sso-demo/pom.xml
zlt-demo/sso-demo/pom.xml
+1
-1
zlt-demo/sso-demo/ss-sso/pom.xml
zlt-demo/sso-demo/ss-sso/pom.xml
+1
-1
zlt-demo/sso-demo/web-sso/pom.xml
zlt-demo/sso-demo/web-sso/pom.xml
+1
-1
zlt-demo/txlcn-demo/pom.xml
zlt-demo/txlcn-demo/pom.xml
+1
-1
zlt-demo/txlcn-demo/txlcn-demo-common/pom.xml
zlt-demo/txlcn-demo/txlcn-demo-common/pom.xml
+1
-1
zlt-demo/txlcn-demo/txlcn-demo-spring-service-a/pom.xml
zlt-demo/txlcn-demo/txlcn-demo-spring-service-a/pom.xml
+1
-1
zlt-demo/txlcn-demo/txlcn-demo-spring-service-b/pom.xml
zlt-demo/txlcn-demo/txlcn-demo-spring-service-b/pom.xml
+1
-1
zlt-demo/txlcn-demo/txlcn-demo-spring-service-c/pom.xml
zlt-demo/txlcn-demo/txlcn-demo-spring-service-c/pom.xml
+1
-1
zlt-demo/websocket-demo/pom.xml
zlt-demo/websocket-demo/pom.xml
+1
-1
zlt-gateway/pom.xml
zlt-gateway/pom.xml
+1
-1
zlt-gateway/sc-gateway/pom.xml
zlt-gateway/sc-gateway/pom.xml
+1
-1
zlt-gateway/sc-gateway/src/main/java/com/central/gateway/error/CustomErrorWebFluxAutoConfiguration.java
...al/gateway/error/CustomErrorWebFluxAutoConfiguration.java
+6
-6
zlt-gateway/sc-gateway/src/main/java/com/central/gateway/error/JsonErrorWebExceptionHandler.java
...m/central/gateway/error/JsonErrorWebExceptionHandler.java
+2
-2
zlt-job/job-admin/pom.xml
zlt-job/job-admin/pom.xml
+1
-1
zlt-job/job-core/pom.xml
zlt-job/job-core/pom.xml
+1
-1
zlt-job/job-executor-samples/pom.xml
zlt-job/job-executor-samples/pom.xml
+1
-1
zlt-job/pom.xml
zlt-job/pom.xml
+1
-1
zlt-monitor/log-center/pom.xml
zlt-monitor/log-center/pom.xml
+1
-1
zlt-monitor/pom.xml
zlt-monitor/pom.xml
+1
-1
zlt-monitor/sc-admin/pom.xml
zlt-monitor/sc-admin/pom.xml
+1
-1
zlt-transaction/pom.xml
zlt-transaction/pom.xml
+1
-1
zlt-transaction/txlcn-tm/pom.xml
zlt-transaction/txlcn-tm/pom.xml
+1
-1
zlt-uaa/pom.xml
zlt-uaa/pom.xml
+1
-1
zlt-web/back-web/pom.xml
zlt-web/back-web/pom.xml
+1
-1
zlt-web/pom.xml
zlt-web/pom.xml
+1
-1
未找到文件。
README.md
浏览文件 @
b23fff55
# zlt-microservices-platform
<p
align=
"center"
>
<img
src=
"https://img.shields.io/badge/Version-5.
3
.0-critical"
alt=
"Downloads"
/>
<img
src=
"https://img.shields.io/badge/Spring%20Boot-2.5.1
3
-blue"
alt=
"Downloads"
/>
<img
src=
"https://img.shields.io/badge/Version-5.
4
.0-critical"
alt=
"Downloads"
/>
<img
src=
"https://img.shields.io/badge/Spring%20Boot-2.5.1
4
-blue"
alt=
"Downloads"
/>
<img
src=
"https://img.shields.io/badge/Spring%20Cloud-2020.0.5-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"
/>
...
...
pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.zlt
</groupId>
<artifactId>
central-platform
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
<packaging>
pom
</packaging>
<properties>
...
...
@@ -14,7 +14,7 @@
<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.1
3
</spring-boot-dependencies.version>
<spring-boot-dependencies.version>
2.5.1
4
</spring-boot-dependencies.version>
<spring-cloud-dependencies.version>
2020.0.5
</spring-cloud-dependencies.version>
<commons-collections4.version>
4.4
</commons-collections4.version>
<swagger.butler.version>
2.0.1
</swagger.butler.version>
...
...
zlt-business/code-generator/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-business
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
code-generator
</artifactId>
...
...
zlt-business/file-center/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-business
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
file-center
</artifactId>
<description>
文件中心
</description>
...
...
zlt-business/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
central-platform
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
zlt-business
</artifactId>
<description>
业务中心
</description>
...
...
zlt-business/search-center/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-business
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
search-center
</artifactId>
<description>
搜索中心
</description>
...
...
zlt-business/search-center/search-client/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
search-center
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
search-client
</artifactId>
<description>
搜索中心客户端
</description>
...
...
zlt-business/search-center/search-server/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
search-center
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
search-server
</artifactId>
<description>
搜索中心服务端
</description>
...
...
zlt-business/user-center/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-business
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
user-center
</artifactId>
<description>
用户中心
</description>
...
...
zlt-commons/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
central-platform
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
zlt-commons
</artifactId>
<description>
通用组件
</description>
...
...
zlt-commons/zlt-auth-client-spring-boot-starter/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-commons
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
...
...
zlt-commons/zlt-auth-client-spring-boot-starter/src/main/java/com/central/oauth2/common/util/AuthUtils.java
浏览文件 @
b23fff55
...
...
@@ -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
* <p>
* 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
;
}
/**
* 获取登陆的帐户类型
*/
...
...
zlt-commons/zlt-common-core/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-commons
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
zlt-common-core
</artifactId>
<description>
公共通用组件
</description>
...
...
zlt-commons/zlt-common-core/src/main/java/com/central/common/constant/CommonConstant.java
浏览文件 @
b23fff55
...
...
@@ -10,7 +10,7 @@ public interface CommonConstant {
/**
* 项目版本号(banner使用)
*/
String
PROJECT_VERSION
=
"5.
3
.0"
;
String
PROJECT_VERSION
=
"5.
4
.0"
;
/**
* token请求头名称
...
...
zlt-commons/zlt-common-core/src/main/java/com/central/common/context/LoginUserContextHolder.java
0 → 100644
浏览文件 @
b23fff55
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
();
}
}
\ No newline at end of file
zlt-commons/zlt-common-core/src/main/java/com/central/common/resolver/TokenArgumentResolver.java
浏览文件 @
b23fff55
...
...
@@ -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
);
}
}
zlt-commons/zlt-common-core/src/main/java/com/central/common/utils/LoginUserUtils.java
0 → 100644
浏览文件 @
b23fff55
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
;
}
}
zlt-commons/zlt-common-spring-boot-starter/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-commons
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
zlt-common-spring-boot-starter
</artifactId>
<description>
公共通用组件
</description>
...
...
zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/filter/LoginUserFilter.java
0 → 100644
浏览文件 @
b23fff55
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
();
}
}
}
zlt-commons/zlt-common-spring-boot-starter/src/main/resources/META-INF/spring.factories
浏览文件 @
b23fff55
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
zlt-commons/zlt-db-spring-boot-starter/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-commons
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
...
...
zlt-commons/zlt-elasticsearch-spring-boot-starter/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-commons
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
...
...
zlt-commons/zlt-loadbalancer-spring-boot-starter/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-commons
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
...
...
zlt-commons/zlt-log-spring-boot-starter/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-commons
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
...
...
zlt-commons/zlt-oss-spring-boot-starter/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-commons
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
...
...
zlt-commons/zlt-redis-spring-boot-starter/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-commons
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
...
...
zlt-commons/zlt-sentinel-spring-boot-starter/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-commons
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
...
...
zlt-commons/zlt-swagger2-spring-boot-starter/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-commons
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
...
...
zlt-commons/zlt-zookeeper-spring-boot-starter/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-commons
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
...
...
zlt-config/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
central-platform
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
...
...
zlt-config/src/main/resources/bootstrap.properties
浏览文件 @
b23fff55
...
...
@@ -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
=
*
...
...
zlt-demo/dubbo-demo/pom.xml
浏览文件 @
b23fff55
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
dubbo-demo
</artifactId>
...
...
zlt-demo/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
central-platform
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
zlt-demo
</artifactId>
<packaging>
pom
</packaging>
...
...
@@ -24,5 +24,7 @@
<module>
dubbo-demo
</module>
<!-- webSocket集成demo -->
<module>
websocket-demo
</module>
<!-- 资源服务器demo -->
<module>
resources-server-demo
</module>
</modules>
</project>
\ No newline at end of file
zlt-demo/resources-server-demo/README.md
0 → 100644
浏览文件 @
b23fff55
## 一、说明
资源服务器 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
zlt-demo/resources-server-demo/pom.xml
0 → 100644
浏览文件 @
b23fff55
<?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.4.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>
\ No newline at end of file
zlt-demo/resources-server-demo/src/main/java/org/zlt/ResourcesServerApp.java
0 → 100644
浏览文件 @
b23fff55
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
);
}
}
zlt-demo/resources-server-demo/src/main/java/org/zlt/config/MyResourceConfig.java
0 → 100644
浏览文件 @
b23fff55
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
{
}
zlt-demo/resources-server-demo/src/main/java/org/zlt/config/WebMvcConfig.java
0 → 100644
浏览文件 @
b23fff55
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
{
}
zlt-demo/resources-server-demo/src/main/java/org/zlt/controller/TestController.java
0 → 100644
浏览文件 @
b23fff55
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"
;
}
}
zlt-demo/resources-server-demo/src/main/resources/bootstrap.yml
0 → 100644
浏览文件 @
b23fff55
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
zlt-demo/rocketmq-demo/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
rocketmq-demo
</artifactId>
<packaging>
pom
</packaging>
...
...
zlt-demo/rocketmq-demo/rocketmq-consume/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
rocketmq-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
rocketmq-consume
</artifactId>
<description>
rocketMQ消费者demo
</description>
...
...
zlt-demo/rocketmq-demo/rocketmq-produce/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
rocketmq-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
rocketmq-produce
</artifactId>
<description>
rocketMQ生产者demo
</description>
...
...
zlt-demo/rocketmq-demo/rocketmq-transactional/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
rocketmq-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
rocketmq-transactional
</artifactId>
<description>
rocketMQ事务消息demo
</description>
...
...
zlt-demo/seata-demo/account-service/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
seata-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
account-service
</artifactId>
...
...
zlt-demo/seata-demo/business-service/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
seata-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
business-service
</artifactId>
...
...
zlt-demo/seata-demo/order-service/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
seata-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
order-service
</artifactId>
...
...
zlt-demo/seata-demo/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
seata-demo
</artifactId>
<description>
seata分布式事务demo
</description>
...
...
zlt-demo/seata-demo/seata-common-starter/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
seata-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
seata-common-starter
</artifactId>
...
...
zlt-demo/seata-demo/storage-service/pom.xml
浏览文件 @
b23fff55
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
seata-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
storage-service
</artifactId>
...
...
zlt-demo/sharding-jdbc-demo/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
sharding-jdbc-demo
</artifactId>
<description>
sharding-jdbc分库分表demo
</description>
...
...
zlt-demo/sso-demo/oidc-sso/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
sso-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
oidc-sso
</artifactId>
<description>
OIDC协议单点登录demo
</description>
...
...
zlt-demo/sso-demo/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
sso-demo
</artifactId>
<packaging>
pom
</packaging>
...
...
zlt-demo/sso-demo/ss-sso/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
sso-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
ss-sso
</artifactId>
<description>
springSecurity单点登录demo
</description>
...
...
zlt-demo/sso-demo/web-sso/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
sso-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
web-sso
</artifactId>
<description>
前后端分离单点登录demo
</description>
...
...
zlt-demo/txlcn-demo/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
txlcn-demo
</artifactId>
<description>
txlcn分布式事务demo
</description>
...
...
zlt-demo/txlcn-demo/txlcn-demo-common/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
txlcn-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
txlcn-demo-common
</artifactId>
<name>
demo-common
</name>
...
...
zlt-demo/txlcn-demo/txlcn-demo-spring-service-a/pom.xml
浏览文件 @
b23fff55
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
txlcn-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
zlt-demo/txlcn-demo/txlcn-demo-spring-service-b/pom.xml
浏览文件 @
b23fff55
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
txlcn-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
txlcn-demo-spring-service-b
</artifactId>
...
...
zlt-demo/txlcn-demo/txlcn-demo-spring-service-c/pom.xml
浏览文件 @
b23fff55
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
txlcn-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
txlcn-demo-spring-service-c
</artifactId>
...
...
zlt-demo/websocket-demo/pom.xml
浏览文件 @
b23fff55
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-demo
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
websocket-demo
</artifactId>
...
...
zlt-gateway/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
central-platform
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
zlt-gateway
</artifactId>
<packaging>
pom
</packaging>
...
...
zlt-gateway/sc-gateway/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-gateway
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
sc-gateway
</artifactId>
<description>
spring cloud gateway网关
</description>
...
...
zlt-gateway/sc-gateway/src/main/java/com/central/gateway/error/CustomErrorWebFluxAutoConfiguration.java
浏览文件 @
b23fff55
...
...
@@ -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
,
Resource
Properties
.
class
})
@EnableConfigurationProperties
({
ServerProperties
.
class
,
Web
Properties
.
class
})
public
class
CustomErrorWebFluxAutoConfiguration
{
private
final
ServerProperties
serverProperties
;
private
final
ApplicationContext
applicationContext
;
private
final
ResourceProperties
resource
Properties
;
private
final
WebProperties
web
Properties
;
private
final
List
<
ViewResolver
>
viewResolvers
;
private
final
ServerCodecConfigurer
serverCodecConfigurer
;
public
CustomErrorWebFluxAutoConfiguration
(
ServerProperties
serverProperties
,
ResourceProperties
resource
Properties
,
WebProperties
web
Properties
,
ObjectProvider
<
List
<
ViewResolver
>>
viewResolversProvider
,
ServerCodecConfigurer
serverCodecConfigurer
,
ApplicationContext
applicationContext
)
{
this
.
serverProperties
=
serverProperties
;
this
.
applicationContext
=
applicationContext
;
this
.
resourceProperties
=
resource
Properties
;
this
.
webProperties
=
web
Properties
;
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
);
...
...
zlt-gateway/sc-gateway/src/main/java/com/central/gateway/error/JsonErrorWebExceptionHandler.java
浏览文件 @
b23fff55
package
com.central.gateway.error
;
import
org.springframework.boot.autoconfigure.web.ErrorProperties
;
import
org.springframework.boot.autoconfigure.web.
Resource
Properties
;
import
org.springframework.boot.autoconfigure.web.
Web
Properties
;
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
,
ResourceProperti
es
resourceProperties
,
public
JsonErrorWebExceptionHandler
(
ErrorAttributes
errorAttributes
,
WebProperties
.
Resourc
es
resourceProperties
,
ErrorProperties
errorProperties
,
ApplicationContext
applicationContext
)
{
super
(
errorAttributes
,
resourceProperties
,
errorProperties
,
applicationContext
);
}
...
...
zlt-job/job-admin/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-job
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
job-admin
</artifactId>
<packaging>
jar
</packaging>
...
...
zlt-job/job-core/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-job
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
job-core
</artifactId>
<packaging>
jar
</packaging>
...
...
zlt-job/job-executor-samples/pom.xml
浏览文件 @
b23fff55
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-job
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
job-executor-samples
</artifactId>
<packaging>
jar
</packaging>
...
...
zlt-job/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
central-platform
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
zlt-job
</artifactId>
<packaging>
pom
</packaging>
...
...
zlt-monitor/log-center/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-monitor
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
log-center
</artifactId>
<dependencies>
...
...
zlt-monitor/pom.xml
浏览文件 @
b23fff55
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
central-platform
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
zlt-monitor
</artifactId>
<packaging>
pom
</packaging>
...
...
zlt-monitor/sc-admin/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-monitor
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
sc-admin
</artifactId>
...
...
zlt-transaction/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
central-platform
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
zlt-transaction
</artifactId>
<description>
事务
</description>
...
...
zlt-transaction/txlcn-tm/pom.xml
浏览文件 @
b23fff55
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-transaction
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
txlcn-tm
</artifactId>
...
...
zlt-uaa/pom.xml
浏览文件 @
b23fff55
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
central-platform
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
zlt-uaa
</artifactId>
<description>
认证中心
</description>
...
...
zlt-web/back-web/pom.xml
浏览文件 @
b23fff55
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
zlt-web
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
back-web
</artifactId>
<description>
后台管理前端
</description>
...
...
zlt-web/pom.xml
浏览文件 @
b23fff55
...
...
@@ -6,7 +6,7 @@
<parent>
<groupId>
com.zlt
</groupId>
<artifactId>
central-platform
</artifactId>
<version>
5.
3
.0
</version>
<version>
5.
4
.0
</version>
</parent>
<artifactId>
zlt-web
</artifactId>
<description>
前端
</description>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录