Browse Source

生成的token增加realName

chenw 7 years ago
parent
commit
d346e1fb08

+ 78 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/AccountRoleDTO.java

@@ -0,0 +1,78 @@
+package com.usoftchina.saas.account.dto;
+
+import java.io.Serializable;
+
+public class AccountRoleDTO implements Serializable {
+
+    private Long accountId;
+    private String username;
+    private String realname;
+    private String email;
+    private String mobile;
+    private String roleNames;
+    private String roleIds;
+
+    public String getRoleNames() {
+        return roleNames;
+    }
+
+    public void setRoleNames(String roleNames) {
+        this.roleNames = roleNames;
+    }
+
+    public String getRoleIds() {
+        return roleIds;
+    }
+
+    public void setRoleIds(String roleIds) {
+        this.roleIds = roleIds;
+    }
+
+    public Long getId() {
+        return accountId;
+    }
+
+    public void setId(Long accountId) {
+        this.accountId = accountId;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getRealname() {
+        return realname;
+    }
+
+    public void setRealname(String realname) {
+        this.realname = realname;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    public void setAccountId(Long accountId) {
+        this.accountId = accountId;
+    }
+}

+ 3 - 1
base-servers/auth/auth-common/src/main/java/com/usoftchina/saas/auth/common/jwt/JwtHelper.java

@@ -41,6 +41,7 @@ public class JwtHelper {
                             .claim("userId", jwtInfo.getUserId())
                             .claim("companyId", jwtInfo.getCompanyId())
                             .claim("userName", jwtInfo.getUserName())
+                            .claim("realName", jwtInfo.getRealName())
                             .setExpiration(DateTime.now().plusSeconds(expire).toDate())
                             // 设置算法(必须)
                             .signWith(SignatureAlgorithm.RS256, RsaUtils.getPrivateKey(priKeyPath))
@@ -97,7 +98,8 @@ public class JwtHelper {
                 ObjectUtils.getStringValue(body.get("appId")),
                 ObjectUtils.getLongValue(body.get("companyId")),
                 ObjectUtils.getLongValue(body.get("userId")),
-                ObjectUtils.getStringValue(body.get("userName"))
+                ObjectUtils.getStringValue(body.get("userName")),
+                ObjectUtils.getStringValue(body.get("realName"))
         );
     }
 }