Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibizlab-boot-starters
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibizlab-boot-starters
提交
6fa0008b
提交
6fa0008b
编写于
9月 21, 2022
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
uaa接入cloud完成
上级
4546f370
变更
16
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
195 行增加
和
39 行删除
+195
-39
pom.xml
ibizlab-boot-starter-data/pom.xml
+5
-0
EntityBase.java
...data/src/main/java/cn/ibizlab/util/domain/EntityBase.java
+1
-1
IEntity.java
...er-data/src/main/java/cn/ibizlab/util/domain/IEntity.java
+9
-0
BeanCache.java
...-data/src/main/java/cn/ibizlab/util/helper/BeanCache.java
+1
-1
CloudUserService.java
...c/main/java/cn/ibizlab/util/service/CloudUserService.java
+28
-12
IBZConfigService.java
...c/main/java/cn/ibizlab/util/service/IBZConfigService.java
+8
-4
IBZUSERServiceImpl.java
...main/java/cn/ibizlab/util/service/IBZUSERServiceImpl.java
+2
-2
pom.xml
ibizlab-boot-starter-parent/pom.xml
+16
-7
UAACustomAuthority.java
...ain/java/cn/ibizlab/util/security/UAACustomAuthority.java
+39
-0
UAADEAuthority.java
...rc/main/java/cn/ibizlab/util/security/UAADEAuthority.java
+56
-4
UAAGrantedAuthority.java
...in/java/cn/ibizlab/util/security/UAAGrantedAuthority.java
+3
-1
UAAMenuAuthority.java
.../main/java/cn/ibizlab/util/security/UAAMenuAuthority.java
+7
-1
UAARoleAuthority.java
.../main/java/cn/ibizlab/util/security/UAARoleAuthority.java
+7
-1
UAAUniResAuthority.java
...ain/java/cn/ibizlab/util/security/UAAUniResAuthority.java
+9
-1
IBZUAAUserService.java
.../main/java/cn/ibizlab/util/service/IBZUAAUserService.java
+2
-2
SimpleUserService.java
.../main/java/cn/ibizlab/util/service/SimpleUserService.java
+2
-2
未找到文件。
ibizlab-boot-starter-data/pom.xml
浏览文件 @
6fa0008b
...
...
@@ -103,6 +103,11 @@
</exclusions>
</dependency>
<dependency>
<groupId>
org.reflections
</groupId>
<artifactId>
reflections
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
ibizlab-boot-starter-data/src/main/java/cn/ibizlab/util/domain/EntityBase.java
浏览文件 @
6fa0008b
...
...
@@ -14,7 +14,7 @@ import org.springframework.util.ObjectUtils;
import
java.io.Serializable
;
import
java.util.*
;
public
class
EntityBase
implements
Serializable
{
public
class
EntityBase
implements
IEntity
,
Serializable
{
@JsonIgnore
@JSONField
(
serialize
=
false
)
...
...
ibizlab-boot-starter-data/src/main/java/cn/ibizlab/util/domain/IEntity.java
0 → 100644
浏览文件 @
6fa0008b
package
cn
.
ibizlab
.
util
.
domain
;
public
interface
IEntity
{
Object
get
(
String
field
);
void
set
(
String
field
,
Object
value
);
}
ibizlab-boot-starter-data/src/main/java/cn/ibizlab/util/helper/BeanCache.java
浏览文件 @
6fa0008b
...
...
@@ -97,7 +97,7 @@ public class BeanCache {
}
public
static
<
T
>
BeanSchema
from
(
Class
<
T
>
clazz
){
String
className
=
clazz
.
getName
();
String
className
=
clazz
.
get
Simple
Name
();
if
(
className
.
indexOf
(
"_$"
)>
0
)
{
className
=
className
.
substring
(
0
,
className
.
lastIndexOf
(
"_$"
));
}
...
...
ibizlab-boot-starter-data/src/main/java/cn/ibizlab/util/service/CloudUserService.java
浏览文件 @
6fa0008b
...
...
@@ -16,6 +16,8 @@ import org.springframework.cache.annotation.CacheEvict;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.DigestUtils
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -28,6 +30,7 @@ import java.io.IOException;
import
java.net.URLDecoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Slf4j
@Service
(
"CloudUserService"
)
...
...
@@ -63,7 +66,7 @@ public class CloudUserService extends IBZUAAUserService {
private
TypeReference
<
Collection
<
UAAGrantedAuthority
>>
UAAGrantedAuthorityListType
=
new
TypeReference
<
Collection
<
UAAGrantedAuthority
>>(){};
@Override
@Cacheable
(
value
=
"ibzuaa_users"
,
key
=
"#root.target.systemId+':'+#p0"
)
@Cacheable
(
value
=
"ibzuaa_users"
,
key
=
"#root.target.systemId+':
getByUsername:
'+#p0"
)
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
Object
obj
=
redisTemplate
.
opsForValue
().
get
(
"ibiz-cloud-uaa-user-"
+
username
);
if
(
obj
==
null
)
{
...
...
@@ -93,7 +96,7 @@ public class CloudUserService extends IBZUAAUserService {
srforgid
=
null
;
}
Collection
<
UAAGrantedAuthority
>
authorities
=
null
;
Collection
authorities
=
null
;
if
(
StringUtils
.
hasLength
(
srfsystemid
)
&&
StringUtils
.
hasLength
(
srfdcid
)
&&
StringUtils
.
hasLength
(
srfdcsystemid
)
&&
StringUtils
.
hasLength
(
srfuserid
))
{
...
...
@@ -166,12 +169,9 @@ public class CloudUserService extends IBZUAAUserService {
authorities
=
this
.
getGrantedAuthorities
(
strDCSystemId
,
dcEmployee
.
getUsername
(),
authToken
);
if
(!
ObjectUtils
.
isEmpty
(
authorities
))
{
if
(
dcEmployee
.
getSuperuser
()
==
1
){
UAARoleAuthority
admin
=
new
UAARoleAuthority
();
admin
.
setRoleTag
(
"SUPERADMIN"
);
authorities
.
add
(
admin
);
authorities
.
add
(
"ROLE_SUPERADMIN"
);
}
dcEmployee
.
setAuthorities
((
Collection
)
authorities
);
JSONObject
permission
=
new
JSONObject
();
Map
permission
=
new
HashMap
();
permission
.
put
(
"authorities"
,
authorities
);
dcEmployee
.
setPermissionList
(
permission
);
}
...
...
@@ -188,13 +188,13 @@ public class CloudUserService extends IBZUAAUserService {
}
protected
Collection
<
UAAGrantedAuthority
>
getGrantedAuthorities
(
String
strDCSystemId
,
String
strUAAUserName
,
String
strToken
){
protected
Collection
getGrantedAuthorities
(
String
strDCSystemId
,
String
strUAAUserName
,
String
strToken
){
String
strCacheCat
=
String
.
format
(
"ibiz-cloud-uaa-cat-%1$s--%2$s"
,
strUAAUserName
,
DigestUtils
.
md5DigestAsHex
(
strToken
.
getBytes
(
StandardCharsets
.
UTF_8
)));;
String
strCacheTag
=
String
.
format
(
"authorities-%1$s"
,
strDCSystemId
);
Object
obj
=
this
.
redisTemplate
.
opsForHash
().
get
(
strCacheCat
,
strCacheTag
);
if
(!
ObjectUtils
.
isEmpty
(
obj
))
{
try
{
Map
<
String
,
UAAGrantedAuthority
>
rt
=
new
LinkedHashMap
<>();
Map
<
String
,
Object
>
rt
=
new
LinkedHashMap
<>();
Collection
<
UAAGrantedAuthority
>
tmp
=
objectMapper
.
readValue
(
objectMapper
.
writeValueAsString
(
obj
),
this
.
UAAGrantedAuthorityListType
);
if
(!
ObjectUtils
.
isEmpty
(
tmp
))
{
...
...
@@ -205,14 +205,30 @@ public class CloudUserService extends IBZUAAUserService {
deAuth
.
setEntityCode
(
BeanCache
.
get
(
deAuth
.
getEntity
()).
getCodeName
());
if
(
ObjectUtils
.
isEmpty
(
deAuth
.
getEntityCode
()))
return
;
deAuth
.
getAuthorities
().
forEach
(
auth
->{
if
(
auth
.
endsWith
(
"-custom"
))
{
UAACustomAuthority
customAuthority
=
new
UAACustomAuthority
();
customAuthority
.
setSystemid
(
deAuth
.
getSystemid
());
customAuthority
.
setEntity
(
deAuth
.
getEntity
());
customAuthority
.
setEntityCode
(
deAuth
.
getEntityCode
());
customAuthority
.
setBscope
(
deAuth
.
getBscope
());
customAuthority
.
setAuthority
(
DigestUtils
.
md5DigestAsHex
((
auth
+
deAuth
.
getBscope
()).
getBytes
()));
rt
.
put
(
customAuthority
.
getAuthority
(),
customAuthority
);
}
else
{
rt
.
put
(
auth
,
auth
);
}
});
}
else
{
rt
.
put
(
item
.
getAuthority
(),
item
);
rt
.
put
(
item
.
getAuthority
(),
item
.
getAuthority
()
);
}
});
return
rt
.
values
();
return
rt
.
values
()
.
stream
().
collect
(
Collectors
.
toList
())
;
}
}
catch
(
IOException
e
)
{
...
...
@@ -246,7 +262,7 @@ public class CloudUserService extends IBZUAAUserService {
}
@Override
@CacheEvict
(
value
=
"ibzuaa_users"
,
key
=
"
#root.target.systemId+'
:'+#p0"
)
@CacheEvict
(
value
=
"ibzuaa_users"
,
key
=
"
'glob:*getByUsername
:'+#p0"
)
public
void
resetByUsername
(
String
username
)
{
}
}
ibizlab-boot-starter-data/src/main/java/cn/ibizlab/util/service/IBZConfigService.java
浏览文件 @
6fa0008b
...
...
@@ -2,6 +2,7 @@ package cn.ibizlab.util.service;
import
cn.ibizlab.util.domain.EntityBase
;
import
cn.ibizlab.util.domain.IBZConfig
;
import
cn.ibizlab.util.domain.IEntity
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
cn.ibizlab.util.helper.BeanCache
;
import
cn.ibizlab.util.helper.DataObject
;
...
...
@@ -12,6 +13,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.reflections.Reflections
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
...
...
@@ -21,6 +23,7 @@ import org.springframework.util.StringUtils;
import
javax.annotation.PostConstruct
;
import
java.util.ServiceLoader
;
import
java.util.Set
;
@Slf4j
@Service
...
...
@@ -28,10 +31,11 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
@PostConstruct
public
void
init
()
{
ServiceLoader
<
EntityBase
>
loader
=
ServiceLoader
.
load
(
EntityBase
.
class
);
for
(
EntityBase
entityBase
:
loader
){
BeanCache
.
register
(
entityBase
.
getClass
());
}
Reflections
reflections
=
new
Reflections
();
Set
<
Class
<?
extends
EntityBase
>>
subClazzs
=
reflections
.
getSubTypesOf
(
EntityBase
.
class
);
subClazzs
.
forEach
(
entity
->{
BeanCache
.
register
(
entity
);
});
}
@Value
(
"${ibiz.systemid:ibznotify}"
)
...
...
ibizlab-boot-starter-data/src/main/java/cn/ibizlab/util/service/IBZUSERServiceImpl.java
浏览文件 @
6fa0008b
...
...
@@ -49,7 +49,7 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
@Override
@Cacheable
(
value
=
"ibzuaa_users"
,
key
=
"#root.target.systemId+':'+#p0"
)
@Cacheable
(
value
=
"ibzuaa_users"
,
key
=
"#root.target.systemId+':
getByUsername:
'+#p0"
)
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
if
(
StringUtils
.
isEmpty
(
username
))
{
throw
new
UsernameNotFoundException
(
"用户名为空"
);
...
...
@@ -103,7 +103,7 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
}
@CacheEvict
(
value
=
"
sys_users"
,
key
=
"#root.target.systemId+'
:'+#p0"
)
@CacheEvict
(
value
=
"
ibzuaa_users"
,
key
=
"'glob:*getByUsername
:'+#p0"
)
public
void
resetByUsername
(
String
username
)
{
}
...
...
ibizlab-boot-starter-parent/pom.xml
浏览文件 @
6fa0008b
...
...
@@ -66,7 +66,9 @@
<flowable-modeler.version>
6.4.2
</flowable-modeler.version>
<!-- JBPM+Drools -->
<drools-version>
7.23.0.Final
</drools-version>
<drools.version>
7.23.0.Final
</drools.version>
<reflections.version>
0.10.2
</reflections.version>
<maven-jar-plugin.version>
3.1.1
</maven-jar-plugin.version>
...
...
@@ -248,34 +250,34 @@
<dependency>
<groupId>
org.jbpm
</groupId>
<artifactId>
jbpm-flow-builder
</artifactId>
<version>
${drools
-
version}
</version>
<version>
${drools
.
version}
</version>
</dependency>
<dependency>
<groupId>
org.jbpm
</groupId>
<artifactId>
jbpm-bpmn2
</artifactId>
<version>
${drools
-
version}
</version>
<version>
${drools
.
version}
</version>
</dependency>
<!-- Drools -->
<dependency>
<groupId>
org.drools
</groupId>
<artifactId>
drools-compiler
</artifactId>
<version>
${drools
-
version}
</version>
<version>
${drools
.
version}
</version>
</dependency>
<dependency>
<groupId>
org.drools
</groupId>
<artifactId>
drools-core
</artifactId>
<version>
${drools
-
version}
</version>
<version>
${drools
.
version}
</version>
</dependency>
<dependency>
<groupId>
org.kie
</groupId>
<artifactId>
kie-spring
</artifactId>
<version>
${drools
-
version}
</version>
<version>
${drools
.
version}
</version>
</dependency>
<dependency>
<groupId>
org.kie
</groupId>
<artifactId>
kie-api
</artifactId>
<version>
${drools
-
version}
</version>
<version>
${drools
.
version}
</version>
</dependency>
<dependency>
...
...
@@ -289,6 +291,13 @@
<version>
${flowable-modeler.version}
</version>
</dependency>
<dependency>
<groupId>
org.reflections
</groupId>
<artifactId>
reflections
</artifactId>
<version>
${reflections.version}
</version>
</dependency>
</dependencies>
</dependencyManagement>
...
...
ibizlab-boot-starter/src/main/java/cn/ibizlab/util/security/UAACustomAuthority.java
0 → 100644
浏览文件 @
6fa0008b
package
cn
.
ibizlab
.
util
.
security
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
org.springframework.util.ObjectUtils
;
import
java.util.*
;
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
UAACustomAuthority
extends
UAAGrantedAuthority
{
private
String
entity
;
private
String
entityCode
;
private
String
bscope
;
private
String
authority
;
public
UAACustomAuthority
(){
this
.
setType
(
"CUSTOM"
);
}
@Override
public
String
getAuthority
()
{
return
this
.
authority
;
}
public
void
setAuthority
(
String
authority
)
{
this
.
authority
=
authority
;
}
}
ibizlab-boot-starter/src/main/java/cn/ibizlab/util/security/UAADEAuthority.java
浏览文件 @
6fa0008b
package
cn
.
ibizlab
.
util
.
security
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
org.springframework.util.ObjectUtils
;
import
java.util.*
;
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
UAADEAuthority
extends
UAAGrantedAuthority
{
...
...
@@ -31,11 +35,11 @@ public class UAADEAuthority extends UAAGrantedAuthority {
@Override
public
String
getAuthority
()
{
return
this
.
getName
()
;
return
this
.
authority
;
}
public
void
setAuthority
(
String
name
)
{
public
void
setAuthority
(
String
authority
)
{
this
.
authority
=
authority
;
}
public
Set
<
String
>
getAuthorities
()
...
...
@@ -45,11 +49,59 @@ public class UAADEAuthority extends UAAGrantedAuthority {
return
sets
;
if
(
ObjectUtils
.
isEmpty
(
systemid
))
return
sets
;
Set
<
String
>
scopes
=
new
LinkedHashSet
<>();
if
(
1
==
isAllData
)
scopes
.
add
(
"all"
);
else
if
(
orgdr
!=
null
&&(
1
&
orgdr
)>
0
)
scopes
.
add
(
"curorg"
);
else
if
(
orgdr
!=
null
&&(
2
&
orgdr
)>
0
)
scopes
.
add
(
"porg"
);
else
if
(
orgdr
!=
null
&&(
4
&
orgdr
)>
0
)
scopes
.
add
(
"sorg"
);
else
if
(
deptdr
!=
null
&&(
1
&
deptdr
)>
0
)
scopes
.
add
(
"curorgdept"
);
else
if
(
deptdr
!=
null
&&(
2
&
deptdr
)>
0
)
scopes
.
add
(
"porgdept"
);
else
if
(
deptdr
!=
null
&&(
4
&
deptdr
)>
0
)
scopes
.
add
(
"sorgdept"
);
else
if
(
getName
()!=
null
&&
getName
().
startsWith
(
"当前用户"
))
scopes
.
add
(
"createman"
);
else
if
(
dataset
||(!
ObjectUtils
.
isEmpty
(
bscope
)))
scopes
.
add
(
"custom"
);
Set
<
String
>
privs
=
new
LinkedHashSet
<>();
deAction
.
forEach
(
item
->{
String
scope
=
""
;
// if(item.containsKey("READ"))
if
(
item
.
containsKey
(
"READ"
))
privs
.
add
(
"Get"
);
else
if
(
item
.
containsKey
(
"CREATE"
))
{
privs
.
add
(
"Create"
);
privs
.
add
(
"Save"
);
}
else
if
(
item
.
containsKey
(
"Update"
))
{
privs
.
add
(
"Create"
);
privs
.
add
(
"Save"
);
}
else
if
(
item
.
containsKey
(
"DELETE"
))
privs
.
add
(
"Remove"
);
else
{
privs
.
addAll
(
item
.
keySet
());
}
});
scopes
.
forEach
(
scope
->{
privs
.
forEach
(
priv
->{
sets
.
add
(
String
.
format
(
"%s-%s-%s-%s"
,
systemid
,
entityCode
,
priv
,
scope
));
});
});
return
sets
;
}
}
ibizlab-boot-starter/src/main/java/cn/ibizlab/util/security/UAAGrantedAuthority.java
浏览文件 @
6fa0008b
...
...
@@ -14,11 +14,13 @@ import org.springframework.security.core.GrantedAuthority;
@JsonSubTypes
.
Type
(
value
=
UAADEAuthority
.
class
,
name
=
UAAGrantedAuthority
.
TYPE_OPPRIV
),
@JsonSubTypes
.
Type
(
value
=
UAAMenuAuthority
.
class
,
name
=
UAAGrantedAuthority
.
TYPE_APPMENU
),
@JsonSubTypes
.
Type
(
value
=
UAAUniResAuthority
.
class
,
name
=
UAAGrantedAuthority
.
TYPE_UNIRES
),
@JsonSubTypes
.
Type
(
value
=
UAARoleAuthority
.
class
,
name
=
UAAGrantedAuthority
.
TYPE_ROLE
)
@JsonSubTypes
.
Type
(
value
=
UAARoleAuthority
.
class
,
name
=
UAAGrantedAuthority
.
TYPE_ROLE
),
@JsonSubTypes
.
Type
(
value
=
UAACustomAuthority
.
class
,
name
=
UAAGrantedAuthority
.
TYPE_CUSTOM
)
})
public
class
UAAGrantedAuthority
implements
GrantedAuthority
{
public
final
static
String
TYPE_CUSTOM
=
"CUSTOM"
;
public
final
static
String
TYPE_OPPRIV
=
"OPPRIV"
;
...
...
ibizlab-boot-starter/src/main/java/cn/ibizlab/util/security/UAAMenuAuthority.java
浏览文件 @
6fa0008b
package
cn
.
ibizlab
.
util
.
security
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
UAAMenuAuthority
extends
UAAGrantedAuthority
{
private
String
menuTag
;
...
...
@@ -13,7 +19,7 @@ public class UAAMenuAuthority extends UAAGrantedAuthority {
@Override
public
String
getAuthority
()
{
return
"APPMENU_"
+
menuTag
;
return
menuTag
==
null
||
menuTag
.
startsWith
(
"APPMENU_"
)?
menuTag:
(
"APPMENU_"
+
menuTag
)
;
}
public
void
setAuthority
(
String
menuTag
)
{
...
...
ibizlab-boot-starter/src/main/java/cn/ibizlab/util/security/UAARoleAuthority.java
浏览文件 @
6fa0008b
package
cn
.
ibizlab
.
util
.
security
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
UAARoleAuthority
extends
UAAGrantedAuthority
{
private
String
roleTag
;
...
...
@@ -13,7 +19,7 @@ public class UAARoleAuthority extends UAAGrantedAuthority {
@Override
public
String
getAuthority
()
{
return
"ROLE_"
+
roleTag
;
return
roleTag
==
null
||
roleTag
.
startsWith
(
"ROLE_"
)?
roleTag:
(
"ROLE_"
+
roleTag
)
;
}
public
void
setAuthority
(
String
roleTag
)
{
...
...
ibizlab-boot-starter/src/main/java/cn/ibizlab/util/security/UAAUniResAuthority.java
浏览文件 @
6fa0008b
package
cn
.
ibizlab
.
util
.
security
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
UAAUniResAuthority
extends
UAAGrantedAuthority
{
private
String
unionResTag
;
...
...
@@ -13,7 +21,7 @@ public class UAAUniResAuthority extends UAAGrantedAuthority {
@Override
public
String
getAuthority
()
{
return
"UNIRES_"
+
unionResTag
;
return
unionResTag
==
null
||
unionResTag
.
startsWith
(
"UNIRES_"
)?
unionResTag:
(
"UNIRES_"
+
unionResTag
)
;
}
public
void
setAuthority
(
String
unionResTag
)
{
...
...
ibizlab-boot-starter/src/main/java/cn/ibizlab/util/service/IBZUAAUserService.java
浏览文件 @
6fa0008b
...
...
@@ -41,7 +41,7 @@ public class IBZUAAUserService implements AuthenticationUserService{
}
@Override
@Cacheable
(
value
=
"ibzuaa_users"
,
key
=
"
'
getByUsername:'+#p0"
)
@Cacheable
(
value
=
"ibzuaa_users"
,
key
=
"
#root.target.systemId+':
getByUsername:'+#p0"
)
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
AuthenticationUser
user
=
uaaFeignClient
.
loginByUsername
(
username
);
if
(
user
==
null
)
{
...
...
@@ -72,7 +72,7 @@ public class IBZUAAUserService implements AuthenticationUserService{
}
@Override
@CacheEvict
(
value
=
"ibzuaa_users"
,
key
=
"'getByUsername:'+#p0"
)
@CacheEvict
(
value
=
"ibzuaa_users"
,
key
=
"'g
lob:*g
etByUsername:'+#p0"
)
public
void
resetByUsername
(
String
username
)
{
}
}
ibizlab-boot-starter/src/main/java/cn/ibizlab/util/service/SimpleUserService.java
浏览文件 @
6fa0008b
...
...
@@ -38,7 +38,7 @@ public class SimpleUserService implements AuthenticationUserService {
return
systemId
;
}
@Override
@Cacheable
(
value
=
"ibzuaa_users"
,
key
=
"#root.target.systemId+':'+#p0"
)
@Cacheable
(
value
=
"ibzuaa_users"
,
key
=
"#root.target.systemId+':
getByUsername:
'+#p0"
)
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
AuthenticationUser
user
=
new
AuthenticationUser
();
String
[]
data
=
username
.
split
(
"[|]"
);
...
...
@@ -82,7 +82,7 @@ public class SimpleUserService implements AuthenticationUserService {
@Override
@CacheEvict
(
value
=
"
simple_users"
,
key
=
"#root.target.systemId+'
:'+#p0"
)
@CacheEvict
(
value
=
"
ibzuaa_users"
,
key
=
"'glob:*getByUsername
:'+#p0"
)
public
void
resetByUsername
(
String
username
)
{
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录