|
@@ -68,11 +68,11 @@ public class JzgAuthenticationProvider implements AuthenticationProvider {
|
|
|
if (!encryptedPassword.equals(byId.getPassword())) {
|
|
if (!encryptedPassword.equals(byId.getPassword())) {
|
|
|
throw new SystemException("用户名或密码错误");
|
|
throw new SystemException("用户名或密码错误");
|
|
|
}
|
|
}
|
|
|
- //获取角色组
|
|
|
|
|
|
|
+ //获取用户角色权限标识
|
|
|
List<SysRolePerms> userPerms = sysUserRoleService.getUserPerms(byId.getId(), system);
|
|
List<SysRolePerms> userPerms = sysUserRoleService.getUserPerms(byId.getId(), system);
|
|
|
|
|
|
|
|
List<JzgGrantedAuthority> authorities = userPerms.stream()
|
|
List<JzgGrantedAuthority> authorities = userPerms.stream()
|
|
|
- .map(perms -> new JzgGrantedAuthority(system,perms.getPermsId(),perms.getPerms()))
|
|
|
|
|
|
|
+ .map(perms -> new JzgGrantedAuthority(perms.getSysCode(),perms.getPermsId(),perms.getPerms()))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
if (details instanceof java.util.Map) {
|
|
if (details instanceof java.util.Map) {
|
|
@@ -84,6 +84,10 @@ public class JzgAuthenticationProvider implements AuthenticationProvider {
|
|
|
details = detailMap;
|
|
details = detailMap;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if(!authorities.stream().anyMatch(x->x.getSystem().equals(system)) && !username.equals("admin")){
|
|
|
|
|
+ throw new SystemException("没有权限访问系统");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
Object finalDetails = details;
|
|
Object finalDetails = details;
|
|
|
return new UsernamePasswordAuthenticationToken(username, rawPassword, authorities) {{
|
|
return new UsernamePasswordAuthenticationToken(username, rawPassword, authorities) {{
|
|
|
setDetails(finalDetails);
|
|
setDetails(finalDetails);
|