Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
d930359b
提交
d930359b
编写于
3月 23, 2021
作者:
misaka
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SaaS 标准构型4 登陆模式
上级
93edd4e1
变更
6
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
59 行增加
和
10 行删除
+59
-10
IBZUAAFallback.java.ftl
...in/java/%SYS_PKGPATH%/util/client/IBZUAAFallback.java.ftl
+7
-0
IBZUAAFeignClient.java.ftl
...java/%SYS_PKGPATH%/util/client/IBZUAAFeignClient.java.ftl
+5
-0
AuthenticationUser.java.ftl
...a/%SYS_PKGPATH%/util/security/AuthenticationUser.java.ftl
+8
-0
AuthorizationTokenFilter.java.ftl
..._PKGPATH%/util/security/AuthorizationTokenFilter.java.ftl
+9
-2
AuthenticationUserService.java.ftl
..._PKGPATH%/util/service/AuthenticationUserService.java.ftl
+19
-2
IBZUAAUserService.java.ftl
...ava/%SYS_PKGPATH%/util/service/IBZUAAUserService.java.ftl
+11
-6
未找到文件。
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/client/IBZUAAFallback.java.ftl
浏览文件 @
d930359b
...
...
@@ -33,10 +33,17 @@ public class IBZUAAFallback implements IBZUAAFeignClient {
return
null
;
}
<#
if
sys
.
getSaaSMode
()==
4
>
@
Override
public
AuthenticationUser
loginByUsername
(
String
system
,
String
orgId
,
String
username
)
{
return
null
;
}
<#
else
>
@
Override
public
AuthenticationUser
loginByUsername
(
String
username
)
{
return
null
;
}
</#
if
>
<#
if
oauth2Enable
>
@
Override
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/client/IBZUAAFeignClient.java.ftl
浏览文件 @
d930359b
...
...
@@ -51,8 +51,13 @@ public interface IBZUAAFeignClient
Object
getToken
(@
RequestBody
MultiValueMap
<
String
,
String
>
map
);
</#
if
>
<#
if
sys
.
getSaaSMode
()==
4
>
@
PostMapping
(
value
=
"/uaa/loginbyusername"
)
AuthenticationUser
loginByUsername
(@
RequestHeader
(
name
=
"srfsystem"
)
String
system
,@
RequestHeader
(
name
=
"srforgid"
)
String
orgid
,@
RequestBody
String
username
);
<#
else
>
@
PostMapping
(
value
=
"/uaa/loginbyusername"
)
AuthenticationUser
loginByUsername
(@
RequestBody
String
username
);
</#
if
>
@
Cacheable
(
value
=
"ibzuaa_publickey"
)
@
GetMapping
(
value
=
"/uaa/publickey"
)
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/security/AuthenticationUser.java.ftl
浏览文件 @
d930359b
...
...
@@ -52,6 +52,14 @@ public class AuthenticationUser implements UserDetails
*/
private
String
domain
;
/**
*
租户
*/
private
String
srfdcid
;
/**
*
动态实例标识
*/
private
String
srfdynainstid
;
/**
*
部门标识
*/
private
String
mdeptid
;
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/security/AuthorizationTokenFilter.java.ftl
浏览文件 @
d930359b
...
...
@@ -45,7 +45,7 @@ public class AuthorizationTokenFilter extends OncePerRequestFilter {
@
Value
(${
r
'"${ibiz.jwt.expiration:7200000}"'
})
private
Long
expiration
;
</#
if
>
private
final
UserDetails
Service
userDetailsService
;
private
final
AuthenticationUser
Service
userDetailsService
;
private
final
AuthTokenUtil
authTokenUtil
;
private
final
String
tokenHeader
;
private
Set
<
String
>
excludesPattern
=
new
HashSet
<
String
>();
...
...
@@ -78,8 +78,15 @@ public class AuthorizationTokenFilter extends OncePerRequestFilter {
}
if
(
username
!= null && SecurityContextHolder.getContext().getAuthentication() == null) {
<#
if
sys
.
getSaaSMode
()==
4
>
final
String
requestOrgId
=
request
.
getHeader
(
"srforgid"
);
if
(
StringUtils
.
isBlank
(
requestOrgId
)){
throw
new
RuntimeException
(
"无效系统标识"
);
}
UserDetails
userDetails
=
this
.
userDetailsService
.
loadUserByUsername
(
"${sys.getCodeName()}"
,
requestOrgId
,
username
);
<#
else
>
UserDetails
userDetails
=
this
.
userDetailsService
.
loadUserByUsername
(
username
);
</#
if
>
if
(
authTokenUtil
.
validateToken
(
authToken
,
userDetails
))
{
UsernamePasswordAuthenticationToken
authentication
=
new
UsernamePasswordAuthenticationToken
(
userDetails
,
null
,
userDetails
.
getAuthorities
());
authentication
.
setDetails
(
new
WebAuthenticationDetailsSource
().
buildDetails
(
request
));
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/AuthenticationUserService.java.ftl
浏览文件 @
d930359b
...
...
@@ -24,11 +24,28 @@ public interface AuthenticationUserService extends UserDetailsService {
@
Override
@
Cacheable
(
value
=
"${cachename}"
,
key
=
"'getByUsername:'+#p0"
)
AuthenticationUser
loadUserByUsername
(
String
username
);
default
AuthenticationUser
loadUserByUsername
(
String
username
){
return
null
;
}
<#
if
sys
.
getSaaSMode
()==
4
>
@
Cacheable
(
value
=
"ibzuaa_users"
,
key
=
"#p0+':'+#p1+':getByUsername:'+#p2"
)
default
AuthenticationUser
loadUserByUsername
(
String
srfsystem
,
String
srforgid
,
String
username
){
return
null
;
}
</#
if
>
@
Cacheable
(
value
=
"${cachename}"
,
key
=
"'getByUsername:'+#p0"
)
AuthenticationUser
loadUserByLogin
(
String
username
,
String
password
);
@
CacheEvict
(
value
=
"${cachename}"
,
key
=
"'getByUsername:'+#p0"
)
void
resetByUsername
(
String
username
);
default
void
resetByUsername
(
String
username
){}
<#
if
sys
.
getSaaSMode
()==
4
>
@
Cacheable
(
value
=
"ibzuaa_users"
,
key
=
"#p0+':'+#p1+':getByUsername:'+#p2"
)
default
void
resetByUsername
(
String
srfsystem
,
String
srforgid
,
String
username
){
}
</#
if
>
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/IBZUAAUserService.java.ftl
浏览文件 @
d930359b
...
...
@@ -27,6 +27,16 @@ public class IBZUAAUserService implements AuthenticationUserService{
@
Autowired
private
IBZUAAFeignClient
uaaFeignClient
;
<#
if
sys
.
getSaaSMode
()==
4
>
@
Override
public
AuthenticationUser
loadUserByUsername
(
String
system
,
String
orgId
,
String
username
)
{
AuthenticationUser
user
=
uaaFeignClient
.
loginByUsername
(
system
,
orgId
,
username
);
if
(
user
==
null
)
{
throw
new
BadRequestAlertException
(
"登录失败"
,
"IBZUAAUser"
,
username
);
}
return
user
;
}
<#
else
>
@
Override
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
AuthenticationUser
user
=
uaaFeignClient
.
loginByUsername
(
username
);
...
...
@@ -35,6 +45,7 @@ public class IBZUAAUserService implements AuthenticationUserService{
}
return
user
;
}
</#
if
>
@
Override
public
AuthenticationUser
loadUserByLogin
(
String
username
,
String
password
)
{
...
...
@@ -57,10 +68,4 @@ public class IBZUAAUserService implements AuthenticationUserService{
return
user
;
}
@
Override
public
void
resetByUsername
(
String
username
)
{
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录