单点登录添加用户姓名信息

This commit is contained in:
wenc000 2019-07-31 21:49:52 +08:00
parent 5954efd25e
commit 66f896bc04
2 changed files with 13 additions and 0 deletions

View File

@ -57,6 +57,7 @@ public class UserAuthConverter implements UserAuthenticationConverter {
UserInfoBO userInfoBO = new UserInfoBO();
userInfoBO.setUserId(userBO.getUserId());
userInfoBO.setUserUsername(userBO.getUsername());
userInfoBO.setUserName(userBO.getUserName());
principal = userInfoBO;
} else {
// 包含用户信息则直接抽取其中的用户信息
@ -65,6 +66,7 @@ public class UserAuthConverter implements UserAuthenticationConverter {
UserInfoBO userInfoBO = new UserInfoBO();
userInfoBO.setUserId(userInfo.get("userId").toString());
userInfoBO.setUserUsername(userInfo.get("username").toString());
userInfoBO.setUserName(userInfo.get("userName").toString());
principal = userInfoBO;
}
}

View File

@ -16,6 +16,7 @@ import java.util.List;
public class UserBO extends User {
private String userId;
private String userName;
private List<RoleBO> roles;
private List<GroupBO> groups;
private List<DepartmentBO> departments;
@ -40,6 +41,14 @@ public class UserBO extends User {
this.userId = userId;
}
public String getUserName() {
return userName == null ? "" : userName.trim();
}
public void setUserName(String userName) {
this.userName = userName;
}
public List<RoleBO> getRoles() {
return roles;
}
@ -69,6 +78,8 @@ public class UserBO extends User {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"userId\":")
.append("\"").append(userId).append("\"");
sb.append(",\"userName\":")
.append("\"").append(userName).append("\"");
sb.append(",\"roles\":")
.append(roles);
sb.append(",\"groups\":")