Commit 7ad3b6ad2b1745ec3f6b1a01bcd2a6cf6b307442
1 parent
8ea46b8f
chore: use com.xingyuv.justauth
Showing
8 changed files
with
42 additions
and
36 deletions
yudao-dependencies/pom.xml
| ... | ... | @@ -68,7 +68,7 @@ |
| 68 | 68 | <aliyun-java-sdk-core.version>4.6.3</aliyun-java-sdk-core.version> |
| 69 | 69 | <aliyun-java-sdk-dysmsapi.version>2.2.1</aliyun-java-sdk-dysmsapi.version> |
| 70 | 70 | <tencentcloud-sdk-java.version>3.1.758</tencentcloud-sdk-java.version> |
| 71 | - <justauth.version>1.4.0</justauth.version> | |
| 71 | + <justauth.version>1.0.0</justauth.version> | |
| 72 | 72 | <jimureport.version>1.5.8</jimureport.version> |
| 73 | 73 | <xercesImpl.version>2.12.2</xercesImpl.version> |
| 74 | 74 | <wx-java-mp.version>4.5.0</wx-java-mp.version> |
| ... | ... | @@ -589,8 +589,8 @@ |
| 589 | 589 | <!-- SMS SDK end --> |
| 590 | 590 | |
| 591 | 591 | <dependency> |
| 592 | - <groupId>com.xkcoding.justauth</groupId> | |
| 593 | - <artifactId>justauth-spring-boot-starter</artifactId> <!-- 社交登陆(例如说,个人微信、企业微信等等) --> | |
| 592 | + <groupId>com.xingyuv</groupId> | |
| 593 | + <artifactId>spring-boot-starter-justauth</artifactId> <!-- 社交登陆(例如说,个人微信、企业微信等等) --> | |
| 594 | 594 | <version>${justauth.version}</version> |
| 595 | 595 | </dependency> |
| 596 | 596 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-social/pom.xml
| ... | ... | @@ -36,8 +36,8 @@ |
| 36 | 36 | </dependency> |
| 37 | 37 | <!-- 三方云服务相关 --> |
| 38 | 38 | <dependency> |
| 39 | - <groupId>com.xkcoding.justauth</groupId> | |
| 40 | - <artifactId>justauth-spring-boot-starter</artifactId> | |
| 39 | + <groupId>com.xingyuv</groupId> | |
| 40 | + <artifactId>spring-boot-starter-justauth</artifactId> | |
| 41 | 41 | <exclusions> |
| 42 | 42 | <exclusion> |
| 43 | 43 | <groupId>cn.hutool</groupId> | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/config/YudaoSocialAutoConfiguration.java
| 1 | 1 | package cn.iocoder.yudao.framework.social.config; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.social.core.YudaoAuthRequestFactory; |
| 4 | +import com.xingyuv.jushauth.cache.AuthStateCache; | |
| 5 | +import com.xingyuv.justauth.autoconfigure.JustAuthProperties; | |
| 4 | 6 | import com.xkcoding.http.HttpUtil; |
| 5 | 7 | import com.xkcoding.http.support.hutool.HutoolImpl; |
| 6 | -import com.xkcoding.justauth.autoconfigure.JustAuthProperties; | |
| 7 | 8 | import lombok.extern.slf4j.Slf4j; |
| 8 | -import me.zhyd.oauth.cache.AuthStateCache; | |
| 9 | 9 | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| 10 | 10 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| 11 | 11 | import org.springframework.boot.context.properties.EnableConfigurationProperties; | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/YudaoAuthRequestFactory.java
| ... | ... | @@ -4,12 +4,12 @@ import cn.hutool.core.util.EnumUtil; |
| 4 | 4 | import cn.hutool.core.util.ReflectUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.social.core.enums.AuthExtendSource; |
| 6 | 6 | import cn.iocoder.yudao.framework.social.core.request.AuthWeChatMiniAppRequest; |
| 7 | -import com.xkcoding.justauth.AuthRequestFactory; | |
| 8 | -import com.xkcoding.justauth.autoconfigure.JustAuthProperties; | |
| 9 | -import me.zhyd.oauth.cache.AuthStateCache; | |
| 10 | -import me.zhyd.oauth.config.AuthConfig; | |
| 11 | -import me.zhyd.oauth.config.AuthSource; | |
| 12 | -import me.zhyd.oauth.request.AuthRequest; | |
| 7 | +import com.xingyuv.jushauth.cache.AuthStateCache; | |
| 8 | +import com.xingyuv.jushauth.config.AuthConfig; | |
| 9 | +import com.xingyuv.jushauth.config.AuthSource; | |
| 10 | +import com.xingyuv.jushauth.request.AuthRequest; | |
| 11 | +import com.xingyuv.justauth.AuthRequestFactory; | |
| 12 | +import com.xingyuv.justauth.autoconfigure.JustAuthProperties; | |
| 13 | 13 | |
| 14 | 14 | import java.lang.reflect.Method; |
| 15 | 15 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/enums/AuthExtendSource.java
| 1 | 1 | package cn.iocoder.yudao.framework.social.core.enums; |
| 2 | 2 | |
| 3 | -import me.zhyd.oauth.config.AuthSource; | |
| 3 | +import com.xingyuv.jushauth.config.AuthSource; | |
| 4 | +import com.xingyuv.jushauth.request.AuthDefaultRequest; | |
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * 拓展 JustAuth 各 api 需要的 url, 用枚举类分平台类型管理 |
| 7 | 8 | * |
| 8 | - * 默认配置 {@link me.zhyd.oauth.config.AuthDefaultSource} | |
| 9 | + * 默认配置 {@link com.xingyuv.jushauth.config.AuthDefaultSource} | |
| 9 | 10 | * |
| 10 | 11 | * @author timfruit |
| 11 | 12 | */ |
| ... | ... | @@ -34,6 +35,11 @@ public enum AuthExtendSource implements AuthSource { |
| 34 | 35 | // 参见 https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html 文档 |
| 35 | 36 | throw new UnsupportedOperationException("不支持获取用户信息 url,请使用小程序内置函数 wx.getUserProfile() 获取用户信息"); |
| 36 | 37 | } |
| 38 | + | |
| 39 | + @Override | |
| 40 | + public Class<? extends AuthDefaultRequest> getTargetClass() { | |
| 41 | + return null; | |
| 42 | + } | |
| 37 | 43 | } |
| 38 | 44 | |
| 39 | 45 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/request/AuthWeChatMiniAppRequest.java
| ... | ... | @@ -3,16 +3,16 @@ package cn.iocoder.yudao.framework.social.core.request; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 4 | 4 | import cn.iocoder.yudao.framework.social.core.enums.AuthExtendSource; |
| 5 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; |
| 6 | +import com.xingyuv.jushauth.cache.AuthStateCache; | |
| 7 | +import com.xingyuv.jushauth.config.AuthConfig; | |
| 8 | +import com.xingyuv.jushauth.exception.AuthException; | |
| 9 | +import com.xingyuv.jushauth.model.AuthCallback; | |
| 10 | +import com.xingyuv.jushauth.model.AuthToken; | |
| 11 | +import com.xingyuv.jushauth.model.AuthUser; | |
| 12 | +import com.xingyuv.jushauth.request.AuthDefaultRequest; | |
| 13 | +import com.xingyuv.jushauth.utils.HttpUtils; | |
| 14 | +import com.xingyuv.jushauth.utils.UrlBuilder; | |
| 6 | 15 | import lombok.Data; |
| 7 | -import me.zhyd.oauth.cache.AuthStateCache; | |
| 8 | -import me.zhyd.oauth.config.AuthConfig; | |
| 9 | -import me.zhyd.oauth.exception.AuthException; | |
| 10 | -import me.zhyd.oauth.model.AuthCallback; | |
| 11 | -import me.zhyd.oauth.model.AuthToken; | |
| 12 | -import me.zhyd.oauth.model.AuthUser; | |
| 13 | -import me.zhyd.oauth.request.AuthDefaultRequest; | |
| 14 | -import me.zhyd.oauth.utils.HttpUtils; | |
| 15 | -import me.zhyd.oauth.utils.UrlBuilder; | |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * 微信小程序登陆 Request 请求 |
| ... | ... | @@ -32,7 +32,7 @@ public class AuthWeChatMiniAppRequest extends AuthDefaultRequest { |
| 32 | 32 | protected AuthToken getAccessToken(AuthCallback authCallback) { |
| 33 | 33 | // 参见 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html 文档 |
| 34 | 34 | // 使用 code 获取对应的 openId、unionId 等字段 |
| 35 | - String response = new HttpUtils(config.getHttpConfig()).get(accessTokenUrl(authCallback.getCode())); | |
| 35 | + String response = new HttpUtils(config.getHttpConfig()).get(accessTokenUrl(authCallback.getCode())).getBody(); | |
| 36 | 36 | JSCode2SessionResponse accessTokenObject = JsonUtils.parseObject(response, JSCode2SessionResponse.class); |
| 37 | 37 | assert accessTokenObject != null; |
| 38 | 38 | checkResponse(accessTokenObject); | ... | ... |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java
| ... | ... | @@ -10,12 +10,12 @@ import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO; |
| 10 | 10 | import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserBindMapper; |
| 11 | 11 | import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserMapper; |
| 12 | 12 | import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; |
| 13 | +import com.xingyuv.jushauth.model.AuthCallback; | |
| 14 | +import com.xingyuv.jushauth.model.AuthResponse; | |
| 15 | +import com.xingyuv.jushauth.model.AuthUser; | |
| 16 | +import com.xingyuv.jushauth.request.AuthRequest; | |
| 17 | +import com.xingyuv.jushauth.utils.AuthStateUtils; | |
| 13 | 18 | import lombok.extern.slf4j.Slf4j; |
| 14 | -import me.zhyd.oauth.model.AuthCallback; | |
| 15 | -import me.zhyd.oauth.model.AuthResponse; | |
| 16 | -import me.zhyd.oauth.model.AuthUser; | |
| 17 | -import me.zhyd.oauth.request.AuthRequest; | |
| 18 | -import me.zhyd.oauth.utils.AuthStateUtils; | |
| 19 | 19 | import org.springframework.stereotype.Service; |
| 20 | 20 | import org.springframework.transaction.annotation.Transactional; |
| 21 | 21 | import org.springframework.validation.annotation.Validated; | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImplTest.java
| ... | ... | @@ -9,12 +9,12 @@ import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO; |
| 9 | 9 | import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserBindMapper; |
| 10 | 10 | import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserMapper; |
| 11 | 11 | import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; |
| 12 | -import me.zhyd.oauth.enums.AuthResponseStatus; | |
| 13 | -import me.zhyd.oauth.model.AuthCallback; | |
| 14 | -import me.zhyd.oauth.model.AuthResponse; | |
| 15 | -import me.zhyd.oauth.model.AuthUser; | |
| 16 | -import me.zhyd.oauth.request.AuthRequest; | |
| 17 | -import me.zhyd.oauth.utils.AuthStateUtils; | |
| 12 | +import com.xingyuv.jushauth.enums.AuthResponseStatus; | |
| 13 | +import com.xingyuv.jushauth.model.AuthCallback; | |
| 14 | +import com.xingyuv.jushauth.model.AuthResponse; | |
| 15 | +import com.xingyuv.jushauth.model.AuthUser; | |
| 16 | +import com.xingyuv.jushauth.request.AuthRequest; | |
| 17 | +import com.xingyuv.jushauth.utils.AuthStateUtils; | |
| 18 | 18 | import org.junit.jupiter.api.Test; |
| 19 | 19 | import org.mockito.MockedStatic; |
| 20 | 20 | import org.springframework.boot.test.mock.mockito.MockBean; | ... | ... |