diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml
index e4d010fb5d..fdad6e4650 100644
--- a/yudao-dependencies/pom.xml
+++ b/yudao-dependencies/pom.xml
@@ -78,7 +78,7 @@
4.6.4
2.2.1
3.1.853
- 1.0.5
+ 1.0.8
1.6.1
2.12.2
4.5.0
@@ -150,11 +150,6 @@
yudao-spring-boot-starter-biz-data-permission
${revision}
-
- cn.iocoder.cloud
- yudao-spring-boot-starter-biz-social
- ${revision}
-
cn.iocoder.cloud
yudao-spring-boot-starter-biz-error-code
diff --git a/yudao-framework/pom.xml b/yudao-framework/pom.xml
index 577ff56fdb..95e09880b9 100644
--- a/yudao-framework/pom.xml
+++ b/yudao-framework/pom.xml
@@ -35,7 +35,6 @@
yudao-spring-boot-starter-biz-pay
yudao-spring-boot-starter-biz-weixin
- yudao-spring-boot-starter-biz-social
yudao-spring-boot-starter-biz-tenant
yudao-spring-boot-starter-biz-data-permission
yudao-spring-boot-starter-biz-error-code
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-social/pom.xml b/yudao-framework/yudao-spring-boot-starter-biz-social/pom.xml
deleted file mode 100644
index eb7d12f346..0000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-social/pom.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
- cn.iocoder.cloud
- yudao-framework
- ${revision}
-
- jar
- 4.0.0
-
- yudao-spring-boot-starter-biz-social
- ${project.artifactId}
-
-
-
- cn.iocoder.cloud
- yudao-common
-
-
-
- org.springframework.boot
- spring-boot-starter-aop
-
-
-
- cn.iocoder.cloud
- yudao-spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-configuration-processor
- true
-
-
-
- com.xingyuv
- spring-boot-starter-justauth
-
-
- cn.iocoder.cloud
- yudao-spring-boot-starter-redis
-
-
-
-
-
-
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/config/YudaoSocialAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/config/YudaoSocialAutoConfiguration.java
deleted file mode 100644
index 57accd20d9..0000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/config/YudaoSocialAutoConfiguration.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package cn.iocoder.yudao.framework.social.config;
-
-import cn.iocoder.yudao.framework.social.core.YudaoAuthRequestFactory;
-import com.xingyuv.http.HttpUtil;
-import com.xingyuv.http.support.hutool.HutoolImpl;
-import com.xingyuv.jushauth.cache.AuthStateCache;
-import com.xingyuv.justauth.autoconfigure.JustAuthProperties;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.autoconfigure.AutoConfiguration;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Primary;
-
-/**
- * 社交自动装配类
- *
- * @author timfruit
- * @date 2021-10-30
- */
-@Slf4j
-@AutoConfiguration
-@EnableConfigurationProperties(JustAuthProperties.class)
-public class YudaoSocialAutoConfiguration {
-
- @Bean
- @Primary
- @ConditionalOnProperty(prefix = "justauth", value = "enabled", havingValue = "true", matchIfMissing = true)
- public YudaoAuthRequestFactory yudaoAuthRequestFactory(JustAuthProperties properties, AuthStateCache authStateCache) {
- // 需要修改 HttpUtil 使用的实现,避免类报错
- HttpUtil.setHttp(new HutoolImpl());
- // 创建 YudaoAuthRequestFactory
- return new YudaoAuthRequestFactory(properties, authStateCache);
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/YudaoAuthRequestFactory.java b/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/YudaoAuthRequestFactory.java
deleted file mode 100644
index 97f29ad63c..0000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/YudaoAuthRequestFactory.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package cn.iocoder.yudao.framework.social.core;
-
-import cn.hutool.core.util.EnumUtil;
-import cn.hutool.core.util.ReflectUtil;
-import cn.iocoder.yudao.framework.social.core.enums.AuthExtendSource;
-import cn.iocoder.yudao.framework.social.core.request.AuthWeChatMiniAppRequest;
-import cn.iocoder.yudao.framework.social.core.request.AuthWeChatMpRequest;
-import com.xingyuv.jushauth.cache.AuthStateCache;
-import com.xingyuv.jushauth.config.AuthConfig;
-import com.xingyuv.jushauth.config.AuthSource;
-import com.xingyuv.jushauth.request.AuthRequest;
-import com.xingyuv.justauth.AuthRequestFactory;
-import com.xingyuv.justauth.autoconfigure.JustAuthProperties;
-
-import java.lang.reflect.Method;
-
-import static com.xingyuv.jushauth.config.AuthDefaultSource.WECHAT_MP;
-
-/**
- * 第三方授权拓展 request 工厂类
- * 为使得拓展配置 {@link AuthConfig} 和默认配置齐平,所以自定义本工厂类
- *
- * @author timfruit
- * @date 2021-10-31
- */
-public class YudaoAuthRequestFactory extends AuthRequestFactory {
-
- protected JustAuthProperties properties;
- protected AuthStateCache authStateCache;
-
- /**
- * 由于父类 configureHttpConfig 方法是 private 修饰,所以获取后,进行反射调用
- */
- private final Method configureHttpConfigMethod = ReflectUtil.getMethod(AuthRequestFactory.class,
- "configureHttpConfig", String.class, AuthConfig.class, JustAuthProperties.JustAuthHttpConfig.class);
-
- public YudaoAuthRequestFactory(JustAuthProperties properties, AuthStateCache authStateCache) {
- super(properties, authStateCache);
- this.properties = properties;
- this.authStateCache = authStateCache;
- }
-
- /**
- * 返回 AuthRequest 对象
- *
- * @param source {@link AuthSource}
- * @return {@link AuthRequest}
- */
- @Override
- public AuthRequest get(String source) {
- // 先尝试获取自定义扩展的
- AuthRequest authRequest = getExtendRequest(source);
- // 找不到,使用默认拓展
- if (authRequest == null) {
- authRequest = super.get(source);
- }
- return authRequest;
- }
-
- protected AuthRequest getExtendRequest(String source) {
- // TODO 芋艿:临时兼容 justauth 迁移的类型不对问题;
- if (WECHAT_MP.name().equalsIgnoreCase(source)) {
- AuthConfig config = properties.getType().get(WECHAT_MP.name());
- return new AuthWeChatMpRequest(config, authStateCache);
- }
-
- AuthExtendSource authExtendSource;
- try {
- authExtendSource = EnumUtil.fromString(AuthExtendSource.class, source.toUpperCase());
- } catch (IllegalArgumentException e) {
- // 无自定义匹配
- return null;
- }
-
- // 拓展配置和默认配置齐平,properties 放在一起
- AuthConfig config = properties.getType().get(authExtendSource.name());
- // 找不到对应关系,直接返回空
- if (config == null) {
- return null;
- }
- // 反射调用,配置 http config
- ReflectUtil.invoke(this, configureHttpConfigMethod, authExtendSource.name(), config, properties.getHttpConfig());
-
- // 获得拓展的 Request
- // noinspection SwitchStatementWithTooFewBranches
- switch (authExtendSource) {
- case WECHAT_MINI_APP:
- return new AuthWeChatMiniAppRequest(config, authStateCache);
- default:
- return null;
- }
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/enums/AuthExtendSource.java b/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/enums/AuthExtendSource.java
deleted file mode 100644
index fe4e53c4d7..0000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/enums/AuthExtendSource.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package cn.iocoder.yudao.framework.social.core.enums;
-
-import com.xingyuv.jushauth.config.AuthSource;
-import com.xingyuv.jushauth.request.AuthDefaultRequest;
-
-/**
- * 拓展 JustAuth 各 api 需要的 url, 用枚举类分平台类型管理
- *
- * 默认配置 {@link com.xingyuv.jushauth.config.AuthDefaultSource}
- *
- * @author timfruit
- */
-public enum AuthExtendSource implements AuthSource {
-
- /**
- * 微信小程序授权登录
- */
- WECHAT_MINI_APP {
-
- @Override
- public String authorize() {
- // 参见 https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html 文档
- throw new UnsupportedOperationException("不支持获取授权 url,请使用小程序内置函数 wx.login() 登录获取 code");
- }
-
- @Override
- public String accessToken() {
- // 参见 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html 文档
- // 获取 openid, unionId , session_key 等字段
- return "https://api.weixin.qq.com/sns/jscode2session";
- }
-
- @Override
- public String userInfo() {
- // 参见 https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html 文档
- throw new UnsupportedOperationException("不支持获取用户信息 url,请使用小程序内置函数 wx.getUserProfile() 获取用户信息");
- }
-
- @Override
- public Class extends AuthDefaultRequest> getTargetClass() {
- return null;
- }
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/request/AuthWeChatMiniAppRequest.java b/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/request/AuthWeChatMiniAppRequest.java
deleted file mode 100644
index 964eb31cdc..0000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/request/AuthWeChatMiniAppRequest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package cn.iocoder.yudao.framework.social.core.request;
-
-import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
-import cn.iocoder.yudao.framework.social.core.enums.AuthExtendSource;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.xingyuv.jushauth.cache.AuthStateCache;
-import com.xingyuv.jushauth.config.AuthConfig;
-import com.xingyuv.jushauth.exception.AuthException;
-import com.xingyuv.jushauth.model.AuthCallback;
-import com.xingyuv.jushauth.model.AuthToken;
-import com.xingyuv.jushauth.model.AuthUser;
-import com.xingyuv.jushauth.request.AuthDefaultRequest;
-import com.xingyuv.jushauth.utils.HttpUtils;
-import com.xingyuv.jushauth.utils.UrlBuilder;
-import lombok.Data;
-
-/**
- * 微信小程序登陆 Request 请求
- *
- * 由于 JustAuth 定位是面向 Web 为主的三方登录,所以微信小程序只能自己封装
- *
- * @author timfruit
- * @date 2021-10-29
- */
-public class AuthWeChatMiniAppRequest extends AuthDefaultRequest {
-
- public AuthWeChatMiniAppRequest(AuthConfig config, AuthStateCache authStateCache) {
- super(config, AuthExtendSource.WECHAT_MINI_APP, authStateCache);
- }
-
- @Override
- protected AuthToken getAccessToken(AuthCallback authCallback) {
- // 参见 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html 文档
- // 使用 code 获取对应的 openId、unionId 等字段
- String response = new HttpUtils(config.getHttpConfig()).get(accessTokenUrl(authCallback.getCode())).getBody();
- JSCode2SessionResponse accessTokenObject = JsonUtils.parseObject(response, JSCode2SessionResponse.class);
- assert accessTokenObject != null;
- checkResponse(accessTokenObject);
- // 拼装结果
- return AuthToken.builder()
- .openId(accessTokenObject.getOpenid())
- .unionId(accessTokenObject.getUnionId())
- .build();
- }
-
- @Override
- protected AuthUser getUserInfo(AuthToken authToken) {
- // 参见 https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html 文档
- // 如果需要用户信息,需要在小程序调用函数后传给后端
- return AuthUser.builder()
- .username("")
- .nickname("")
- .avatar("")
- .uuid(authToken.getOpenId())
- .token(authToken)
- .source(source.toString())
- .build();
- }
-
- /**
- * 检查响应内容是否正确
- *
- * @param response 请求响应内容
- */
- private void checkResponse(JSCode2SessionResponse response) {
- if (response.getErrorCode() != 0) {
- throw new AuthException(response.getErrorCode(), response.getErrorMsg());
- }
- }
-
- @Override
- protected String accessTokenUrl(String code) {
- return UrlBuilder.fromBaseUrl(source.accessToken())
- .queryParam("appid", config.getClientId())
- .queryParam("secret", config.getClientSecret())
- .queryParam("js_code", code)
- .queryParam("grant_type", "authorization_code")
- .build();
- }
-
- @Data
- @SuppressWarnings("SpellCheckingInspection")
- private static class JSCode2SessionResponse {
-
- @JsonProperty("errcode")
- private int errorCode;
- @JsonProperty("errmsg")
- private String errorMsg;
- @JsonProperty("session_key")
- private String sessionKey;
- private String openid;
- @JsonProperty("unionid")
- private String unionId;
-
- }
-
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/request/AuthWeChatMpRequest.java b/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/request/AuthWeChatMpRequest.java
deleted file mode 100644
index 13b77cd357..0000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/request/AuthWeChatMpRequest.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package cn.iocoder.yudao.framework.social.core.request;
-
-import com.alibaba.fastjson.JSONObject;
-import com.xingyuv.jushauth.cache.AuthStateCache;
-import com.xingyuv.jushauth.config.AuthConfig;
-import com.xingyuv.jushauth.config.AuthDefaultSource;
-import com.xingyuv.jushauth.enums.AuthResponseStatus;
-import com.xingyuv.jushauth.enums.AuthUserGender;
-import com.xingyuv.jushauth.enums.scope.AuthWechatMpScope;
-import com.xingyuv.jushauth.exception.AuthException;
-import com.xingyuv.jushauth.model.AuthCallback;
-import com.xingyuv.jushauth.model.AuthResponse;
-import com.xingyuv.jushauth.model.AuthToken;
-import com.xingyuv.jushauth.model.AuthUser;
-import com.xingyuv.jushauth.request.AuthDefaultRequest;
-import com.xingyuv.jushauth.utils.AuthScopeUtils;
-import com.xingyuv.jushauth.utils.GlobalAuthUtils;
-import com.xingyuv.jushauth.utils.HttpUtils;
-import com.xingyuv.jushauth.utils.UrlBuilder;
-
-/**
- * 微信公众平台登录
- *
- * @author yangkai.shen (https://xkcoding.com)
- * @since 1.1.0
- */
-public class AuthWeChatMpRequest extends AuthDefaultRequest {
- public AuthWeChatMpRequest(AuthConfig config) {
- super(config, AuthDefaultSource.WECHAT_MP);
- }
-
- public AuthWeChatMpRequest(AuthConfig config, AuthStateCache authStateCache) {
- super(config, AuthDefaultSource.WECHAT_MP, authStateCache);
- }
-
- /**
- * 微信的特殊性,此时返回的信息同时包含 openid 和 access_token
- *
- * @param authCallback 回调返回的参数
- * @return 所有信息
- */
- @Override
- protected AuthToken getAccessToken(AuthCallback authCallback) {
- return this.getToken(accessTokenUrl(authCallback.getCode()));
- }
-
- @Override
- protected AuthUser getUserInfo(AuthToken authToken) {
- String openId = authToken.getOpenId();
-
- String response = doGetUserInfo(authToken);
- JSONObject object = JSONObject.parseObject(response);
-
- this.checkResponse(object);
-
- String location = String.format("%s-%s-%s", object.getString("country"), object.getString("province"), object.getString("city"));
-
- if (object.containsKey("unionid")) {
- authToken.setUnionId(object.getString("unionid"));
- }
-
- return AuthUser.builder()
- .rawUserInfo(object)
- .username(object.getString("nickname"))
- .nickname(object.getString("nickname"))
- .avatar(object.getString("headimgurl"))
- .location(location)
- .uuid(openId)
- .gender(AuthUserGender.getWechatRealGender(object.getString("sex")))
- .token(authToken)
- .source(source.toString())
- .build();
- }
-
- @Override
- public AuthResponse refresh(AuthToken oldToken) {
- return AuthResponse.builder()
- .code(AuthResponseStatus.SUCCESS.getCode())
- .data(this.getToken(refreshTokenUrl(oldToken.getRefreshToken())))
- .build();
- }
-
- /**
- * 检查响应内容是否正确
- *
- * @param object 请求响应内容
- */
- private void checkResponse(JSONObject object) {
- if (object.containsKey("errcode")) {
- throw new AuthException(object.getIntValue("errcode"), object.getString("errmsg"));
- }
- }
-
- /**
- * 获取token,适用于获取access_token和刷新token
- *
- * @param accessTokenUrl 实际请求token的地址
- * @return token对象
- */
- private AuthToken getToken(String accessTokenUrl) {
- String response = new HttpUtils(config.getHttpConfig()).get(accessTokenUrl).getBody();
- JSONObject accessTokenObject = JSONObject.parseObject(response);
-
- this.checkResponse(accessTokenObject);
-
- return AuthToken.builder()
- .accessToken(accessTokenObject.getString("access_token"))
- .refreshToken(accessTokenObject.getString("refresh_token"))
- .expireIn(accessTokenObject.getIntValue("expires_in"))
- .openId(accessTokenObject.getString("openid"))
- .scope(accessTokenObject.getString("scope"))
- .build();
- }
-
- /**
- * 返回带{@code state}参数的授权url,授权回调时会带上这个{@code state}
- *
- * @param state state 验证授权流程的参数,可以防止csrf
- * @return 返回授权地址
- * @since 1.9.3
- */
- @Override
- public String authorize(String state) {
- return UrlBuilder.fromBaseUrl(source.authorize())
- .queryParam("appid", config.getClientId())
- .queryParam("redirect_uri", GlobalAuthUtils.urlEncode(config.getRedirectUri()))
- .queryParam("response_type", "code")
- .queryParam("scope", this.getScopes(",", false, AuthScopeUtils.getDefaultScopes(AuthWechatMpScope.values())))
- .queryParam("state", getRealState(state).concat("#wechat_redirect"))
- .build();
- }
-
- /**
- * 返回获取accessToken的url
- *
- * @param code 授权码
- * @return 返回获取accessToken的url
- */
- @Override
- protected String accessTokenUrl(String code) {
- return UrlBuilder.fromBaseUrl(source.accessToken())
- .queryParam("appid", config.getClientId())
- .queryParam("secret", config.getClientSecret())
- .queryParam("code", code)
- .queryParam("grant_type", "authorization_code")
- .build();
- }
-
- /**
- * 返回获取userInfo的url
- *
- * @param authToken 用户授权后的token
- * @return 返回获取userInfo的url
- */
- @Override
- protected String userInfoUrl(AuthToken authToken) {
- return UrlBuilder.fromBaseUrl(source.userInfo())
- .queryParam("access_token", authToken.getAccessToken())
- .queryParam("openid", authToken.getOpenId())
- .queryParam("lang", "zh_CN")
- .build();
- }
-
- /**
- * 返回获取userInfo的url
- *
- * @param refreshToken getAccessToken方法返回的refreshToken
- * @return 返回获取userInfo的url
- */
- @Override
- protected String refreshTokenUrl(String refreshToken) {
- return UrlBuilder.fromBaseUrl(source.refresh())
- .queryParam("appid", config.getClientId())
- .queryParam("grant_type", "refresh_token")
- .queryParam("refresh_token", refreshToken)
- .build();
- }
-}
diff --git a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
deleted file mode 100644
index c7ca9cf4e1..0000000000
--- a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++ /dev/null
@@ -1 +0,0 @@
-cn.iocoder.yudao.framework.social.config.YudaoSocialAutoConfiguration
diff --git a/yudao-module-system/yudao-module-system-biz/pom.xml b/yudao-module-system/yudao-module-system-biz/pom.xml
index a5370a1f4a..f1d2844ffa 100644
--- a/yudao-module-system/yudao-module-system-biz/pom.xml
+++ b/yudao-module-system/yudao-module-system-biz/pom.xml
@@ -62,10 +62,6 @@
cn.iocoder.cloud
yudao-spring-boot-starter-biz-data-permission
-
- cn.iocoder.cloud
- yudao-spring-boot-starter-biz-social
-
cn.iocoder.cloud
yudao-spring-boot-starter-biz-tenant
@@ -165,7 +161,13 @@
yudao-spring-boot-starter-monitor
+
+
+ com.xingyuv
+ spring-boot-starter-justauth
+
+
${project.artifactId}
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java
index 6c8381663f..29184bee7c 100644
--- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java
@@ -12,7 +12,6 @@
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.cache.CacheUtils;
import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
-import cn.iocoder.yudao.framework.social.core.YudaoAuthRequestFactory;
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.client.SocialClientCreateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.client.SocialClientPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.socail.vo.client.SocialClientUpdateReqVO;
@@ -31,6 +30,7 @@
import com.xingyuv.jushauth.model.AuthUser;
import com.xingyuv.jushauth.request.AuthRequest;
import com.xingyuv.jushauth.utils.AuthStateUtils;
+import com.xingyuv.justauth.AuthRequestFactory;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
@@ -59,8 +59,8 @@
@Slf4j
public class SocialClientServiceImpl implements SocialClientService {
- @Resource // 由于自定义了 YudaoAuthRequestFactory 无法覆盖默认的 AuthRequestFactory,所以只能注入它
- private YudaoAuthRequestFactory yudaoAuthRequestFactory;
+ @Resource
+ private AuthRequestFactory authRequestFactory;
@Resource
private WxMpService wxMpService;
@@ -145,7 +145,7 @@ public AuthUser getAuthUser(Integer socialType, Integer userType, String code, S
*/
private AuthRequest buildAuthRequest(Integer socialType, Integer userType) {
// 1. 先查找默认的配置项,从 application-*.yaml 中读取
- AuthRequest request = yudaoAuthRequestFactory.get(SocialTypeEnum.valueOfType(socialType).getSource());
+ AuthRequest request = authRequestFactory.get(SocialTypeEnum.valueOfType(socialType).getSource());
Assert.notNull(request, String.format("社交平台(%d) 不存在", socialType));
// 2. 查询 DB 的配置项,如果存在则进行覆盖
SocialClientDO client = socialClientMapper.selectBySocialTypeAndUserType(socialType, userType);
diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImplTest.java
index 5b09a0f2b5..8a4f3df5e7 100644
--- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImplTest.java
+++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImplTest.java
@@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.system.service.social;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
-import cn.iocoder.yudao.framework.social.core.YudaoAuthRequestFactory;
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserBindReqDTO;
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO;
@@ -15,6 +14,7 @@
import com.xingyuv.jushauth.model.AuthResponse;
import com.xingyuv.jushauth.model.AuthUser;
import com.xingyuv.jushauth.request.AuthRequest;
+import com.xingyuv.justauth.AuthRequestFactory;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
@@ -46,7 +46,7 @@ public class SocialUserServiceImplTest extends BaseDbUnitTest {
private SocialUserBindMapper socialUserBindMapper;
@MockBean
- private YudaoAuthRequestFactory authRequestFactory;
+ private AuthRequestFactory authRequestFactory;
// TODO 芋艿:后续统一修复
// @Test