diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/SysAuthController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/SysAuthController.java index c557b789a..aef8cc40a 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/SysAuthController.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/SysAuthController.java @@ -50,7 +50,7 @@ public class SysAuthController { @Resource private SysPermissionService permissionService; @Resource - private SysSocialCoreService socialService; + private SysSocialCoreService socialCoreService; @PostMapping("/login") @ApiOperation("使用账号密码登录") @@ -102,7 +102,7 @@ public class SysAuthController { }) public CommonResult socialAuthRedirect(@RequestParam("type") Integer type, @RequestParam("redirectUri") String redirectUri) { - return CommonResult.success(socialService.getAuthorizeUrl(type, redirectUri)); + return CommonResult.success(socialCoreService.getAuthorizeUrl(type, redirectUri)); } @PostMapping("/social-login") @@ -133,7 +133,7 @@ public class SysAuthController { @DeleteMapping("/social-unbind") @ApiOperation("取消社交绑定") public CommonResult socialUnbind(@RequestBody SysAuthSocialUnbindReqVO reqVO) { - socialService.unbindSocialUser(getLoginUserId(), reqVO.getType(), reqVO.getUnionId(), UserTypeEnum.ADMIN); + socialCoreService.unbindSocialUser(getLoginUserId(), reqVO.getType(), reqVO.getUnionId(), UserTypeEnum.ADMIN); return CommonResult.success(true); } 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 index 998c70a12..17c36b683 100644 --- 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 @@ -1,7 +1,6 @@ package cn.iocoder.yudao.framework.social.core; import cn.hutool.core.util.EnumUtil; -import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.social.core.enums.AuthExtendSource; import cn.iocoder.yudao.framework.social.core.request.AuthWeChatMiniProgramRequest; import com.xkcoding.http.config.HttpConfig; @@ -18,12 +17,14 @@ import java.net.Proxy; import java.util.Map; /** - * 第三方授权拓展request工厂类 + * 第三方授权拓展 request 工厂类 + * TODO @timfruit 可以说明下,为啥有了 AuthRequestFactory 类,咱还需要自定义 * * @author timfruit * @date 2021-10-31 */ public class YudaoAuthRequestFactory extends AuthRequestFactory { + protected JustAuthProperties properties; protected AuthStateCache authStateCache; @@ -34,7 +35,7 @@ public class YudaoAuthRequestFactory extends AuthRequestFactory { } /** - * 返回AuthRequest对象 + * 返回 AuthRequest 对象 * * @param source {@link AuthSource} * @return {@link AuthRequest} @@ -86,6 +87,7 @@ public class YudaoAuthRequestFactory extends AuthRequestFactory { * @param authConfig {@link AuthConfig} */ protected void configureHttpConfig(String authSource, AuthConfig authConfig, JustAuthProperties.JustAuthHttpConfig httpConfig) { + // TODO @timfruit:可以改成反射调用父类的方法。可能有一定的损耗,但是可以忽略不计的 if (null == httpConfig) { return; } 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 index bd19b8d06..fd6bb9cb9 100644 --- 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 @@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.social.core.enums; import me.zhyd.oauth.config.AuthSource; +// TODO @timfruit:类注释 public enum AuthExtendSource implements AuthSource { /** @@ -28,6 +29,4 @@ public enum AuthExtendSource implements AuthSource { } } - ; - } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/model/AuthExtendToken.java b/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/model/AuthExtendToken.java index 3397a4976..2c0f4f403 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/model/AuthExtendToken.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/model/AuthExtendToken.java @@ -4,7 +4,7 @@ import lombok.*; import me.zhyd.oauth.model.AuthToken; /** - * 授权所需的token 拓展类 + * 授权所需的 token 拓展类 * * @author timfruit * @date 2021-10-29 @@ -16,7 +16,7 @@ import me.zhyd.oauth.model.AuthToken; public class AuthExtendToken extends AuthToken { /** - * 微信小程序 会话密钥 + * 微信小程序 - 会话密钥 */ private String miniSessionKey; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/request/AuthWeChatMiniProgramRequest.java b/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/request/AuthWeChatMiniProgramRequest.java index a875c3b6e..ae9a8e1ec 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/request/AuthWeChatMiniProgramRequest.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/core/request/AuthWeChatMiniProgramRequest.java @@ -86,6 +86,7 @@ public class AuthWeChatMiniProgramRequest extends AuthDefaultRequest { .build(); } + // TODO @timfruit:我们要采用驼峰的命名方式。不匹配的,可以通过 jackson 的自定义注解映射 @Data private static class CodeSessionResponse { private int errcode; diff --git a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/auth/impl/SysAuthServiceImpl.java b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/auth/impl/SysAuthServiceImpl.java index e4b938861..6ce205107 100644 --- a/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/auth/impl/SysAuthServiceImpl.java +++ b/yudao-user-server/src/main/java/cn/iocoder/yudao/userserver/modules/system/service/auth/impl/SysAuthServiceImpl.java @@ -65,7 +65,7 @@ public class SysAuthServiceImpl implements SysAuthService { private SysUserSessionCoreService userSessionCoreService; @Resource private SysSocialCoreService socialService; - private static final UserTypeEnum USER_TYPE_ENUM = UserTypeEnum.MEMBER; + private static final UserTypeEnum USER_TYPE_ENUM = UserTypeEnum.MEMBER; // TODO @timfruit 挪到类的最前面。一般是 静态变量,到成员变量的顺序。 @Override public UserDetails loadUserByUsername(String mobile) throws UsernameNotFoundException {