返回租户编号
This commit is contained in:
@@ -27,4 +27,6 @@ public class AuthLoginRespVO {
|
|||||||
@Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private LocalDateTime expiresTime;
|
private LocalDateTime expiresTime;
|
||||||
|
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class AuthPermissionInfoRespVO {
|
|||||||
|
|
||||||
@Schema(description = "用户邮箱", example = "yudao@iocoder.cn")
|
@Schema(description = "用户邮箱", example = "yudao@iocoder.cn")
|
||||||
private String email;
|
private String email;
|
||||||
|
private Long tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 登录用户的菜单信息 Response VO")
|
@Schema(description = "管理后台 - 登录用户的菜单信息 Response VO")
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ public class UserSaveReqVO {
|
|||||||
|
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
// ========== 仅【创建】时,需要传递的字段 ==========
|
// ========== 仅【创建】时,需要传递的字段 ==========
|
||||||
|
|
||||||
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
|
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.system.dal.dataobject.oauth2;
|
package cn.iocoder.yudao.module.system.dal.dataobject.oauth2;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
@@ -26,7 +27,7 @@ import java.util.Map;
|
|||||||
@KeySequence("system_oauth2_access_token_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
@KeySequence("system_oauth2_access_token_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class OAuth2AccessTokenDO extends TenantBaseDO {
|
public class OAuth2AccessTokenDO extends BaseDO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编号,数据库递增
|
* 编号,数据库递增
|
||||||
@@ -71,5 +72,8 @@ public class OAuth2AccessTokenDO extends TenantBaseDO {
|
|||||||
* 过期时间
|
* 过期时间
|
||||||
*/
|
*/
|
||||||
private LocalDateTime expiresTime;
|
private LocalDateTime expiresTime;
|
||||||
|
/**
|
||||||
|
* 多租户编号
|
||||||
|
*/
|
||||||
|
private Long tenantId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理后台的认证 Service 接口
|
* 管理后台的认证 Service 接口
|
||||||
*
|
* <p>
|
||||||
* 提供用户的登录、登出的能力
|
* 提供用户的登录、登出的能力
|
||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
@@ -36,7 +36,7 @@ public interface AdminAuthService {
|
|||||||
/**
|
/**
|
||||||
* 基于 token 退出登录
|
* 基于 token 退出登录
|
||||||
*
|
*
|
||||||
* @param token token
|
* @param token token
|
||||||
* @param logType 登出类型
|
* @param logType 登出类型
|
||||||
*/
|
*/
|
||||||
void logout(String token, Integer logType);
|
void logout(String token, Integer logType);
|
||||||
@@ -87,7 +87,7 @@ public interface AdminAuthService {
|
|||||||
*/
|
*/
|
||||||
void resetPassword(AuthResetPasswordReqVO reqVO);
|
void resetPassword(AuthResetPasswordReqVO reqVO);
|
||||||
|
|
||||||
WxLoginRespVO getSession( WxLoginReqVO reqVO);
|
WxLoginRespVO getSession(WxLoginReqVO reqVO);
|
||||||
|
|
||||||
String getAccessToken();
|
String getAccessToken();
|
||||||
|
|
||||||
|
|||||||
@@ -230,6 +230,8 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
// 创建访问令牌
|
// 创建访问令牌
|
||||||
OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken(userId, getUserType().getValue(),
|
OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken(userId, getUserType().getValue(),
|
||||||
OAuth2ClientConstants.CLIENT_ID_DEFAULT, null);
|
OAuth2ClientConstants.CLIENT_ID_DEFAULT, null);
|
||||||
|
AdminUserDO user = userService.getUser(userId);
|
||||||
|
accessTokenDO.setTenantId(user.getTenantId());
|
||||||
// 构建返回结果
|
// 构建返回结果
|
||||||
return AuthConvert.INSTANCE.convert(accessTokenDO);
|
return AuthConvert.INSTANCE.convert(accessTokenDO);
|
||||||
}
|
}
|
||||||
@@ -377,6 +379,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
adminUserDO.setStatus(CommonStatusEnum.DISABLE.getStatus());
|
adminUserDO.setStatus(CommonStatusEnum.DISABLE.getStatus());
|
||||||
adminUserDO.setPassword("123456");
|
adminUserDO.setPassword("123456");
|
||||||
adminUserDO.setIsSynchronize(1);
|
adminUserDO.setIsSynchronize(1);
|
||||||
|
adminUserDO.setTenantId(1L);
|
||||||
userService.createUser(adminUserDO);
|
userService.createUser(adminUserDO);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService {
|
|||||||
.setUserId(userId).setUserType(userType)
|
.setUserId(userId).setUserType(userType)
|
||||||
.setClientId(clientDO.getClientId()).setScopes(scopes)
|
.setClientId(clientDO.getClientId()).setScopes(scopes)
|
||||||
.setExpiresTime(LocalDateTime.now().plusSeconds(clientDO.getRefreshTokenValiditySeconds()));
|
.setExpiresTime(LocalDateTime.now().plusSeconds(clientDO.getRefreshTokenValiditySeconds()));
|
||||||
|
refreshToken.setTenantId(TenantContextHolder.getTenantId());
|
||||||
oauth2RefreshTokenMapper.insert(refreshToken);
|
oauth2RefreshTokenMapper.insert(refreshToken);
|
||||||
return refreshToken;
|
return refreshToken;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ yudao:
|
|||||||
- /admin-api/system/auth/get-session
|
- /admin-api/system/auth/get-session
|
||||||
- /admin-api/system/auth/get-phone-number
|
- /admin-api/system/auth/get-phone-number
|
||||||
- /admin-api/system/auth/api/user-add
|
- /admin-api/system/auth/api/user-add
|
||||||
- /admin-api/system/api/user-info
|
- /admin-api/system/auth/api/user-info
|
||||||
ignore-visit-urls:
|
ignore-visit-urls:
|
||||||
- /admin-api/system/user/profile/**
|
- /admin-api/system/user/profile/**
|
||||||
- /admin-api/system/auth/**
|
- /admin-api/system/auth/**
|
||||||
|
|||||||
Reference in New Issue
Block a user