private

m0_53562103發表於2020-12-14

private(招shang扣741500500) UserDetails buildUserDetails(SysUser sysUser) {
Set authSet = new HashSet<>();
List roles = sysUser.getRoles();
if(!CollectionUtils.isEmpty(roles)){
roles.forEach(item -> authSet.add(CloudConstant.ROLE_PREFIX + item));
authSet.addAll(sysUser.getPermissions());
}

List authorityList = AuthorityUtils.createAuthorityList(authSet.toArray(new String[0]));

return new SecurityUser(
sysUser.getId(),
sysUser.getMobile(),
sysUser.getUsername(),
sysUser.getPassword(),

相關文章