【7.3.2】【auth】payload增加一个租户编码

pull/41/head
fengshuonan 2022-11-09 20:21:45 +08:00
parent 9d8df32228
commit 458744e381
4 changed files with 10 additions and 4 deletions

View File

@ -380,7 +380,7 @@ public class AuthServiceImpl implements AuthServiceApi {
LoginUser loginUser = userValidateInfo.getLoginUser(); LoginUser loginUser = userValidateInfo.getLoginUser();
// 9. 生成用户的token // 9. 生成用户的token
DefaultJwtPayload defaultJwtPayload = new DefaultJwtPayload(loginUser.getUserId(), loginUser.getAccount(), loginRequest.getRememberMe(), caToken); DefaultJwtPayload defaultJwtPayload = new DefaultJwtPayload(loginUser.getUserId(), loginUser.getAccount(), loginRequest.getRememberMe(), caToken, loginRequest.getTenantCode());
String jwtToken = JwtContext.me().generateTokenDefaultPayload(defaultJwtPayload); String jwtToken = JwtContext.me().generateTokenDefaultPayload(defaultJwtPayload);
loginUser.setToken(jwtToken); loginUser.setToken(jwtToken);

View File

@ -70,6 +70,11 @@ public class DefaultJwtPayload {
*/ */
private String caToken; private String caToken;
/**
*
*/
private String tenantCode;
/** /**
* *
*/ */
@ -78,12 +83,13 @@ public class DefaultJwtPayload {
public DefaultJwtPayload() { public DefaultJwtPayload() {
} }
public DefaultJwtPayload(Long userId, String account, boolean rememberMe, String caToken) { public DefaultJwtPayload(Long userId, String account, boolean rememberMe, String caToken, String tenantCode) {
this.userId = userId; this.userId = userId;
this.account = account; this.account = account;
this.uuid = IdUtil.fastUUID(); this.uuid = IdUtil.fastUUID();
this.rememberMe = rememberMe; this.rememberMe = rememberMe;
this.caToken = caToken; this.caToken = caToken;
this.tenantCode = tenantCode;
} }
} }

View File

@ -201,7 +201,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
LoginUser loginUser = CustomerFactory.createLoginUser(customer, fileOperatorApi); LoginUser loginUser = CustomerFactory.createLoginUser(customer, fileOperatorApi);
// 生成用户的token // 生成用户的token
DefaultJwtPayload defaultJwtPayload = new DefaultJwtPayload(loginUser.getUserId(), loginUser.getAccount(), loginRequest.getRememberMe(), null); DefaultJwtPayload defaultJwtPayload = new DefaultJwtPayload(loginUser.getUserId(), loginUser.getAccount(), loginRequest.getRememberMe(), null, null);
String jwtToken = JwtContext.me().generateTokenDefaultPayload(defaultJwtPayload); String jwtToken = JwtContext.me().generateTokenDefaultPayload(defaultJwtPayload);
loginUser.setToken(jwtToken); loginUser.setToken(jwtToken);

View File

@ -656,7 +656,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
LoginUser loginUser = userValidateInfo.getLoginUser(); LoginUser loginUser = userValidateInfo.getLoginUser();
// 生成用户的token // 生成用户的token
DefaultJwtPayload defaultJwtPayload = new DefaultJwtPayload(loginUser.getUserId(), loginUser.getAccount(), false, null); DefaultJwtPayload defaultJwtPayload = new DefaultJwtPayload(loginUser.getUserId(), loginUser.getAccount(), false, null, null);
String jwtToken = JwtContext.me().generateTokenDefaultPayload(defaultJwtPayload); String jwtToken = JwtContext.me().generateTokenDefaultPayload(defaultJwtPayload);
loginUser.setToken(jwtToken); loginUser.setToken(jwtToken);