完善三方登录
This commit is contained in:
parent
12ae5bf128
commit
8552e86d8a
|
@ -24,14 +24,17 @@ public class SocialClientBaseVO {
|
||||||
@NotNull(message = "用户类型不能为空")
|
@NotNull(message = "用户类型不能为空")
|
||||||
private Integer userType;
|
private Integer userType;
|
||||||
|
|
||||||
@Schema(description = "客户端编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "145442115")
|
@Schema(description = "客户端编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "wwd411c69a39ad2e54")
|
||||||
@NotNull(message = "客户端编号不能为空")
|
@NotNull(message = "客户端编号不能为空")
|
||||||
private String clientId;
|
private String clientId;
|
||||||
|
|
||||||
@Schema(description = "客户端密钥", requiredMode = Schema.RequiredMode.REQUIRED, example = "215151515154446")
|
@Schema(description = "客户端密钥", requiredMode = Schema.RequiredMode.REQUIRED, example = "1wTb7hYxnpT2TUbIeHGXGo7T0odav1ic10mLdyyATOw")
|
||||||
@NotNull(message = "客户端密钥不能为空")
|
@NotNull(message = "客户端密钥不能为空")
|
||||||
private String clientSecret;
|
private String clientSecret;
|
||||||
|
|
||||||
|
@Schema(description = "授权方的网页应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000045")
|
||||||
|
private String agentId;
|
||||||
|
|
||||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
@NotNull(message = "状态不能为空")
|
@NotNull(message = "状态不能为空")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUser
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserUpdateReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.user.SocialUserUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -18,6 +19,7 @@ public interface SocialUserConvert {
|
||||||
|
|
||||||
SocialUserConvert INSTANCE = Mappers.getMapper(SocialUserConvert.class);
|
SocialUserConvert INSTANCE = Mappers.getMapper(SocialUserConvert.class);
|
||||||
|
|
||||||
|
@Mapping(target = "socialType", source = "reqVO.type")
|
||||||
SocialUserBindReqDTO convert(Long userId, Integer userType, SocialUserBindReqVO reqVO);
|
SocialUserBindReqDTO convert(Long userId, Integer userType, SocialUserBindReqVO reqVO);
|
||||||
|
|
||||||
SocialUserUnbindReqDTO convert(Long userId, Integer userType, SocialUserUnbindReqVO reqVO);
|
SocialUserUnbindReqDTO convert(Long userId, Integer userType, SocialUserUnbindReqVO reqVO);
|
||||||
|
|
|
@ -64,5 +64,9 @@ public class SocialClientDO extends TenantBaseDO {
|
||||||
* 客户端 Secret
|
* 客户端 Secret
|
||||||
*/
|
*/
|
||||||
private String clientSecret;
|
private String clientSecret;
|
||||||
|
/**
|
||||||
|
* 授权方的网页应用 ID
|
||||||
|
*/
|
||||||
|
private String agentId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,9 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||||
// 2.2 修改对应的 clientId + clientSecret 密钥
|
// 2.2 修改对应的 clientId + clientSecret 密钥
|
||||||
newAuthConfig.setClientId(client.getClientId());
|
newAuthConfig.setClientId(client.getClientId());
|
||||||
newAuthConfig.setClientSecret(client.getClientSecret());
|
newAuthConfig.setClientSecret(client.getClientSecret());
|
||||||
|
if (client.getAgentId() != null) { // 如果有 agentId 则修改 agentId
|
||||||
|
newAuthConfig.setAgentId(client.getAgentId());
|
||||||
|
}
|
||||||
// 2.3 设置会 request 里,进行后续使用
|
// 2.3 设置会 request 里,进行后续使用
|
||||||
ReflectUtil.setFieldValue(request, "config", newAuthConfig);
|
ReflectUtil.setFieldValue(request, "config", newAuthConfig);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue