Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zlt2000
microservices-platform
提交
471297f0
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 搜索 >>
提交
471297f0
编写于
7月 26, 2021
作者:
zlt2000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
升级依赖版本
上级
8d7d8f3f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
12 deletion
+15
-12
README.md
README.md
+4
-3
pom.xml
pom.xml
+6
-6
zlt-gateway/sc-gateway/src/main/java/com/central/gateway/auth/Oauth2AuthSuccessHandler.java
...va/com/central/gateway/auth/Oauth2AuthSuccessHandler.java
+5
-3
未找到文件。
README.md
浏览文件 @
471297f0
# zlt-microservices-platform
<p
align=
"center"
>
<img
src=
"https://img.shields.io/badge/Spring%20Boot-2.3.1
1
.RELEASE-blue"
alt=
"Downloads"
/>
<img
src=
"https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR
9
-blue"
alt=
"Downloads"
/>
<img
src=
"https://img.shields.io/badge/Spring%20Cloud%20Alibaba-2.2.
5
.RELEASE-blue"
alt=
"Downloads"
/>
<img
src=
"https://img.shields.io/badge/Spring%20Boot-2.3.1
2
.RELEASE-blue"
alt=
"Downloads"
/>
<img
src=
"https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR
12
-blue"
alt=
"Downloads"
/>
<img
src=
"https://img.shields.io/badge/Spring%20Cloud%20Alibaba-2.2.
6
.RELEASE-blue"
alt=
"Downloads"
/>
<img
src=
"https://img.shields.io/badge/Elasticsearch-7.x-brightgreen"
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'
/>
...
...
@@ -14,6 +14,7 @@
</p>
## 如果您觉得有帮助,请点右上角 "Star" 支持一下谢谢
## 1. 总体架构图
...
...
pom.xml
浏览文件 @
471297f0
...
...
@@ -13,9 +13,9 @@
<maven.compiler.target>
1.8
</maven.compiler.target>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<java.version>
8
</java.version>
<spring-cloud-alibaba-dependencies.version>
2.2.
5
.RELEASE
</spring-cloud-alibaba-dependencies.version>
<spring-boot-dependencies.version>
2.3.1
1
.RELEASE
</spring-boot-dependencies.version>
<spring-cloud-dependencies.version>
Hoxton.SR
9
</spring-cloud-dependencies.version>
<spring-cloud-alibaba-dependencies.version>
2.2.
6
.RELEASE
</spring-cloud-alibaba-dependencies.version>
<spring-boot-dependencies.version>
2.3.1
2
.RELEASE
</spring-boot-dependencies.version>
<spring-cloud-dependencies.version>
Hoxton.SR
12
</spring-cloud-dependencies.version>
<commons-collections4.version>
4.4
</commons-collections4.version>
<swagger.version>
2.9.2
</swagger.version>
<swagger.ui.version>
1.8.7
</swagger.ui.version>
...
...
@@ -27,7 +27,7 @@
<sharding-sphere.version>
3.1.0
</sharding-sphere.version>
<security-oauth2.version>
2.3.8.RELEASE
</security-oauth2.version>
<security-jwt.version>
1.1.0.RELEASE
</security-jwt.version>
<redisson-starter.version>
3.1
4.1
</redisson-starter.version>
<redisson-starter.version>
3.1
6.0
</redisson-starter.version>
<easyCaptcha.version>
1.6.2
</easyCaptcha.version>
<hutool.version>
5.1.4
</hutool.version>
<mybatis-plus-boot-starter.version>
3.4.0
</mybatis-plus-boot-starter.version>
...
...
@@ -41,13 +41,13 @@
<txlcn.version>
5.0.2.RELEASE
</txlcn.version>
<fastdfs-client.version>
1.27.2
</fastdfs-client.version>
<userAgent.version>
1.21
</userAgent.version>
<transmittable.version>
2.12.
0
</transmittable.version>
<transmittable.version>
2.12.
1
</transmittable.version>
<banner.version>
1.0.2
</banner.version>
<commons-beanutils.version>
1.9.4
</commons-beanutils.version>
<spring-social-security.version>
1.1.6.RELEASE
</spring-social-security.version>
<commons-io.version>
2.7
</commons-io.version>
<servlet-api.version>
4.0.1
</servlet-api.version>
<spring-data-elasticsearch.version>
4.
1
.3
</spring-data-elasticsearch.version>
<spring-data-elasticsearch.version>
4.
2
.3
</spring-data-elasticsearch.version>
<elasticsearch.version>
7.11.2
</elasticsearch.version>
<knife4j.version>
2.0.5
</knife4j.version>
<hibernate-validator.version>
6.2.0.Final
</hibernate-validator.version>
...
...
zlt-gateway/sc-gateway/src/main/java/com/central/gateway/auth/Oauth2AuthSuccessHandler.java
浏览文件 @
471297f0
package
com.central.gateway.auth
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.central.common.constant.SecurityConstants
;
import
com.central.common.model.SysUser
;
import
com.central.oauth2.common.util.AuthUtils
;
...
...
@@ -26,7 +27,7 @@ import reactor.core.publisher.Mono;
public
class
Oauth2AuthSuccessHandler
implements
ServerAuthenticationSuccessHandler
{
@Override
public
Mono
<
Void
>
onAuthenticationSuccess
(
WebFilterExchange
webFilterExchange
,
Authentication
authentication
)
{
MultiValueMap
<
String
,
String
>
headerValues
=
new
LinkedMultiValueMap
(
4
);
MultiValueMap
<
String
,
String
>
headerValues
=
new
LinkedMultiValueMap
<>
(
4
);
Object
principal
=
authentication
.
getPrincipal
();
//客户端模式只返回一个clientId
if
(
principal
instanceof
SysUser
)
{
...
...
@@ -39,8 +40,9 @@ public class Oauth2AuthSuccessHandler implements ServerAuthenticationSuccessHand
headerValues
.
add
(
SecurityConstants
.
TENANT_HEADER
,
clientId
);
headerValues
.
add
(
SecurityConstants
.
ROLE_HEADER
,
CollectionUtil
.
join
(
authentication
.
getAuthorities
(),
","
));
String
accountType
=
AuthUtils
.
getAccountType
(
oauth2Authentication
.
getUserAuthentication
());
headerValues
.
add
(
SecurityConstants
.
ACCOUNT_TYPE_HEADER
,
accountType
);
if
(
StrUtil
.
isNotEmpty
(
accountType
))
{
headerValues
.
add
(
SecurityConstants
.
ACCOUNT_TYPE_HEADER
,
accountType
);
}
ServerWebExchange
exchange
=
webFilterExchange
.
getExchange
();
ServerHttpRequest
serverHttpRequest
=
exchange
.
getRequest
().
mutate
()
.
headers
(
h
->
h
.
addAll
(
headerValues
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录