Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zhangjian1949
microservices-platform
提交
fabb0580
microservices-platform
项目概览
zhangjian1949
/
microservices-platform
与 Fork 源项目一致
Fork自
zlt2000 / microservices-platform
通知
6
Star
0
Fork
0
代码
文件
提交
分支
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 搜索 >>
提交
fabb0580
编写于
7月 14, 2019
作者:
zlt2000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加授权类型字段
上级
e56880bb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
4 deletion
+14
-4
zlt-uaa/src/main/java/com/central/oauth/model/TokenVo.java
zlt-uaa/src/main/java/com/central/oauth/model/TokenVo.java
+4
-0
zlt-uaa/src/main/java/com/central/oauth/service/impl/RedisTokensServiceImpl.java
...om/central/oauth/service/impl/RedisTokensServiceImpl.java
+9
-4
zlt-web/back-web/src/main/resources/static/pages/system/tokens.html
...ck-web/src/main/resources/static/pages/system/tokens.html
+1
-0
未找到文件。
zlt-uaa/src/main/java/com/central/oauth/model/TokenVo.java
浏览文件 @
fabb0580
...
...
@@ -29,4 +29,8 @@ public class TokenVo implements Serializable {
* 所属应用
*/
private
String
clientId
;
/**
* 授权类型
*/
private
String
grantType
;
}
zlt-uaa/src/main/java/com/central/oauth/service/impl/RedisTokensServiceImpl.java
浏览文件 @
fabb0580
...
...
@@ -12,6 +12,7 @@ import org.apache.commons.collections4.MapUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.oauth2.common.DefaultOAuth2AccessToken
;
import
org.springframework.security.oauth2.provider.OAuth2Authentication
;
import
org.springframework.security.oauth2.provider.OAuth2Request
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
...
...
@@ -44,17 +45,21 @@ public class RedisTokensServiceImpl implements ITokensService {
if
(
tokenObjs
!=
null
)
{
for
(
Object
obj
:
tokenObjs
)
{
DefaultOAuth2AccessToken
accessToken
=
(
DefaultOAuth2AccessToken
)
obj
;
//获取用户信息
Object
authObj
=
redisRepository
.
get
(
SecurityConstants
.
REDIS_TOKEN_AUTH
+
accessToken
.
getValue
());
OAuth2Authentication
authentication
=
(
OAuth2Authentication
)
authObj
;
//构造token对象
TokenVo
tokenVo
=
new
TokenVo
();
tokenVo
.
setClientId
(
clientId
);
tokenVo
.
setTokenValue
(
accessToken
.
getValue
());
tokenVo
.
setExpiration
(
accessToken
.
getExpiration
());
//获取用户信息
Object
authObj
=
redisRepository
.
get
(
SecurityConstants
.
REDIS_TOKEN_AUTH
+
accessToken
.
getValue
());
OAuth2Authentication
authentication
=
(
OAuth2Authentication
)
authObj
;
if
(
authentication
!=
null
)
{
OAuth2Request
request
=
authentication
.
getOAuth2Request
();
tokenVo
.
setUsername
(
authentication
.
getName
());
tokenVo
.
setClientId
(
request
.
getClientId
());
tokenVo
.
setGrantType
(
request
.
getGrantType
());
}
result
.
add
(
tokenVo
);
}
}
...
...
zlt-web/back-web/src/main/resources/static/pages/system/tokens.html
浏览文件 @
fabb0580
...
...
@@ -46,6 +46,7 @@
},
title
:
'
到期时间
'
},
{
field
:
'
username
'
,
width
:
180
,
sort
:
true
,
title
:
'
用户名
'
},
{
field
:
'
grantType
'
,
width
:
180
,
sort
:
true
,
title
:
'
授权类型
'
},
{
field
:
'
clientId
'
,
width
:
180
,
sort
:
true
,
title
:
'
所属应用
'
},
{
align
:
'
center
'
,
width
:
100
,
toolbar
:
'
#tokens-table-bar
'
,
title
:
'
操作
'
}
]]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录