Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
acc30e87
提交
acc30e87
编写于
5月 06, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
uaa整改
上级
3ccec3a6
变更
7
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
39 行增加
和
59 行删除
+39
-59
IBZUAAFallback.java.ftl
...in/java/%SYS_PKGPATH%/util/client/IBZUAAFallback.java.ftl
+4
-0
IBZUAAFeignClient.java.ftl
...java/%SYS_PKGPATH%/util/client/IBZUAAFeignClient.java.ftl
+3
-0
AuthenticationController.java.ftl
...%SYS_PKGPATH%/util/rest/AuthenticationController.java.ftl
+1
-1
AuthenticationUserService.java.ftl
..._PKGPATH%/util/service/AuthenticationUserService.java.ftl
+9
-6
IBZUAAUserService.java.ftl
...ava/%SYS_PKGPATH%/util/service/IBZUAAUserService.java.ftl
+18
-25
IBZUSERServiceImpl.java.ftl
...va/%SYS_PKGPATH%/util/service/IBZUSERServiceImpl.java.ftl
+0
-6
SimpleUserService.java.ftl
...ava/%SYS_PKGPATH%/util/service/SimpleUserService.java.ftl
+4
-21
未找到文件。
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/client/IBZUAAFallback.java.ftl
浏览文件 @
acc30e87
...
...
@@ -21,4 +21,8 @@ public class IBZUAAFallback implements IBZUAAFeignClient {
return
null
;
}
@
Override
public
AuthenticationUser
loginByUsername
(
String
username
)
{
return
null
;
}
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/client/IBZUAAFeignClient.java.ftl
浏览文件 @
acc30e87
...
...
@@ -29,4 +29,7 @@ public interface IBZUAAFeignClient
@
PostMapping
(
value
=
"/uaa/login"
)
AuthenticationUser
login
(@
RequestBody
AuthorizationLogin
authorizationLogin
);
@
PostMapping
(
value
=
"/uaa/loginbyusername"
)
AuthenticationUser
loginByUsername
(@
RequestBody
String
username
);
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/rest/AuthenticationController.java.ftl
浏览文件 @
acc30e87
...
...
@@ -39,7 +39,7 @@ public class AuthenticationController
@
PostMapping
(
value
=
${
r
'"${ibiz.auth.path:v7/login}"'
})
public
ResponseEntity
<
AuthenticationInfo
>
login
(@
Validated
@
RequestBody
AuthorizationLogin
authorizationLogin
){
userDetailsService
.
resetByUsername
(
authorizationLogin
.
getUsername
());
final
AuthenticationUser
authuserdetail
=
userDetailsService
.
loadUserByLogin
(
authorizationLogin
.
get
Domain
(),
authorizationLogin
.
getLogin
name
(),
authorizationLogin
.
getPassword
());
final
AuthenticationUser
authuserdetail
=
userDetailsService
.
loadUserByLogin
(
authorizationLogin
.
get
User
name
(),
authorizationLogin
.
getPassword
());
//
生成令牌
final
String
token
=
jwtTokenUtil
.
generateToken
(
authuserdetail
);
//
返回
token
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/AuthenticationUserService.java.ftl
浏览文件 @
acc30e87
...
...
@@ -16,16 +16,19 @@ import org.springframework.stereotype.Service;
public
interface
AuthenticationUserService
extends
UserDetailsService
{
<#
if
sys
.
getPSSystemSetting
()??
&&
sys
.
getPSSystemSetting
().
getDataAccCtrlArch
()??
&&
sys
.
getPSSystemSetting
().
getDataAccCtrlArch
()==
1
>
<#
assign
cachename
=
"ibzuaa_users"
>
<#
else
>
<#
assign
cachename
=
pub
.
getCodeName
()?
lower_case
+
"_users"
>
</#
if
>
@
Override
@
Cacheable
(
value
=
"
ibzdict_users
"
,
key
=
"'getByUsername:'+#p0"
)
@
Cacheable
(
value
=
"
${cachename}
"
,
key
=
"'getByUsername:'+#p0"
)
AuthenticationUser
loadUserByUsername
(
String
username
);
@
Cacheable
(
value
=
"
ibzdict_users
"
,
key
=
"'getByUsername:'+#p0"
)
@
Cacheable
(
value
=
"
${cachename}
"
,
key
=
"'getByUsername:'+#p0"
)
AuthenticationUser
loadUserByLogin
(
String
username
,
String
password
);
@
Cacheable
(
value
=
"ibzdict_users"
,
key
=
"'getByUsername:'+#p1"
)
AuthenticationUser
loadUserByLogin
(
String
domain
,
String
username
,
String
password
);
@
CacheEvict
(
value
=
"ibzdict_users"
,
key
=
"'getByUsername:'+#p0"
)
@
CacheEvict
(
value
=
"${cachename}"
,
key
=
"'getByUsername:'+#p0"
)
void
resetByUsername
(
String
username
);
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/IBZUAAUserService.java.ftl
浏览文件 @
acc30e87
...
...
@@ -5,6 +5,7 @@ package ${pub.getPKGCodeName()}.util.service;
import
com
.
alibaba
.
fastjson
.
JSONObject
;
import
${
pub
.
getPKGCodeName
()}.
util
.
client
.
IBZOUFeignClient
;
import
${
pub
.
getPKGCodeName
()}.
util
.
errors
.
BadRequestAlertException
;
import
${
pub
.
getPKGCodeName
()}.
util
.
client
.
IBZUAAFeignClient
;
import
${
pub
.
getPKGCodeName
()}.
util
.
security
.
AuthenticationUser
;
import
${
pub
.
getPKGCodeName
()}.
util
.
security
.
AuthorizationLogin
;
...
...
@@ -18,7 +19,6 @@ import org.springframework.util.StringUtils;
/**
*
实体
[
IBZUSER
]
服务对象接口实现
*/
//@
Primary
@
Service
(
"IBZUAAUserService"
)
public
class
IBZUAAUserService
implements
AuthenticationUserService
{
...
...
@@ -28,39 +28,32 @@ public class IBZUAAUserService implements AuthenticationUserService{
@
Override
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
AuthenticationUser
user
=
uaaFeignClient
.
loginByUsername
(
username
);
if
(
user
==
null
)
throw
new
BadRequestAlertException
(
"登录失败"
,
"IBZUAAUser"
,
username
);
return
user
;
}
@
Override
public
AuthenticationUser
loadUserByLogin
(
String
username
,
String
password
)
{
String
[]
data
=
username
.
split
(
"[|]"
);
String
loginname
=
username
;
String
domains
=
""
;
String
password
=
""
;
if
(
data
.
length
==
3
)
{
if
(
data
.
length
==
2
)
{
loginname
=
data
[
0
].
trim
();
domains
=
data
[
1
].
trim
();
password
=
data
[
2
].
trim
();
}
else
if
(
data
.
length
==
2
)
{
loginname
=
data
[
0
].
trim
();
password
=
data
[
1
].
trim
();
}
AuthorizationLogin
user
=
new
AuthorizationLogin
();
user
.
setDomain
(
domains
);
user
.
setLoginname
(
loginname
);
user
.
setPassword
(
password
);
return
uaaFeignClient
.
login
(
user
);
AuthorizationLogin
logininfo
=
new
AuthorizationLogin
();
logininfo
.
setDomain
(
domains
);
logininfo
.
setLoginname
(
loginname
);
logininfo
.
setPassword
(
password
);
AuthenticationUser
user
=
uaaFeignClient
.
login
(
logininfo
);
if
(
user
==
null
)
throw
new
BadRequestAlertException
(
"登录失败"
,
"IBZUAAUser"
,
username
);
return
user
;
}
@
Override
public
AuthenticationUser
loadUserByLogin
(
String
username
,
String
password
)
{
AuthenticationUser
authuserdetail
=
loadUserByUsername
(
username
+
"|"
+
password
);
return
authuserdetail
;
}
@
Override
public
AuthenticationUser
loadUserByLogin
(
String
domain
,
String
username
,
String
password
)
{
if
(
!StringUtils.isEmpty(domain))
username
=
username
+
"|"
+
domain
;
return
loadUserByLogin
(
username
,
password
);
}
@
Override
public
void
resetByUsername
(
String
username
)
{
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/IBZUSERServiceImpl.java.ftl
浏览文件 @
acc30e87
...
...
@@ -65,12 +65,6 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
return
authuserdetail
;
}
@
Override
public
AuthenticationUser
loadUserByLogin
(
String
domain
,
String
username
,
String
password
)
{
if
(
!StringUtils.isEmpty(domain))
username
=
username
+
"|"
+
domain
;
return
loadUserByLogin
(
username
,
password
);
}
public
void
resetByUsername
(
String
username
)
{
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/SimpleUserService.java.ftl
浏览文件 @
acc30e87
...
...
@@ -27,12 +27,6 @@ import org.springframework.beans.factory.annotation.Value;
@
Service
(
"SimpleUserService"
)
public
class
SimpleUserService
implements
AuthenticationUserService
{
@
Value
(
"${r'${ibiz.enablePermissionValid:false}'}"
)
boolean
enablePermissionValid
;
//
是否开启权限校验
@
Value
(
"${r'$'}{ibiz.systemid:${sid}}"
)
private
String
systemid
;
@
Override
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
AuthenticationUser
user
=
new
AuthenticationUser
();
...
...
@@ -41,17 +35,12 @@ public class SimpleUserService implements AuthenticationUserService{
String
domains
=
""
;
String
password
=
""
;
if
(
data
.
length
==
3
)
{
if
(
data
.
length
==
2
)
{
loginname
=
data
[
0
].
trim
();
domains
=
data
[
1
].
trim
();
password
=
data
[
2
].
trim
();
}
else
if
(
data
.
length
==
2
)
{
loginname
=
data
[
0
].
trim
();
password
=
data
[
1
].
trim
();
}
user
.
setUserid
(
DigestUtils
.
md5DigestAsHex
(
username
.
getBytes
())
);
user
.
setUserid
(
username
);
user
.
setUsercode
(
loginname
);
user
.
setUsername
(
username
);
user
.
setLoginname
(
loginname
);
...
...
@@ -67,17 +56,11 @@ public class SimpleUserService implements AuthenticationUserService{
@
Override
public
AuthenticationUser
loadUserByLogin
(
String
username
,
String
password
)
{
password
=
DigestUtils
.
md5DigestAsHex
(
String
.
format
(
"%1$s||%2$s"
,
username
,
password
).
getBytes
());
AuthenticationUser
authuserdetail
=
loadUserByUsername
(
username
+
"|"
+
password
);
AuthenticationUser
authuserdetail
=
loadUserByUsername
(
username
);
return
authuserdetail
;
}
@
Override
public
AuthenticationUser
loadUserByLogin
(
String
domain
,
String
username
,
String
password
)
{
if
(
!StringUtils.isEmpty(domain))
username
=
username
+
"|"
+
domain
;
return
loadUserByLogin
(
username
,
password
);
}
@
Override
public
void
resetByUsername
(
String
username
)
{
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录