diff --git a/cloud-common/src/main/java/com/cm/common/converter/UserAuthConverter.java b/cloud-common/src/main/java/com/cm/common/converter/UserAuthConverter.java index bbe4f35..68de225 100644 --- a/cloud-common/src/main/java/com/cm/common/converter/UserAuthConverter.java +++ b/cloud-common/src/main/java/com/cm/common/converter/UserAuthConverter.java @@ -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; } } diff --git a/cloud-common/src/main/java/com/cm/common/pojo/bos/UserBO.java b/cloud-common/src/main/java/com/cm/common/pojo/bos/UserBO.java index 2ceeb83..519beb8 100644 --- a/cloud-common/src/main/java/com/cm/common/pojo/bos/UserBO.java +++ b/cloud-common/src/main/java/com/cm/common/pojo/bos/UserBO.java @@ -16,6 +16,7 @@ import java.util.List; public class UserBO extends User { private String userId; + private String userName; private List roles; private List groups; private List 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 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\":")