From 06588f3ad4cdc711cd349fbca25e43960bcb8562 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期日, 02 七月 2023 16:13:14 +0800
Subject: [PATCH] update 优化 !pr382 修复一些问题 完事流程逻辑

---
 ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java                                         |   25 ++--
 ruoyi-admin/src/main/java/org/dromara/web/service/impl/SocialAuthStrategy.java                                   |   64 +++++++-----
 ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java                                           |   12 +-
 ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/AuthRedisStateCache.java          |    3 
 ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java                  |  130 +++++--------------------
 ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/config/properties/SocialProperties.java |   10 -
 6 files changed, 90 insertions(+), 154 deletions(-)

diff --git a/ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java b/ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java
index 2ed4ed4..abbfae5 100644
--- a/ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java
+++ b/ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java
@@ -103,22 +103,21 @@
     }
 
     /**
-     * 绗笁鏂圭櫥褰曞洖璋冧笟鍔″鐞�
-     *  缁戝畾鎺堟潈
-     * @param loginBody
+     * 绗笁鏂圭櫥褰曞洖璋冧笟鍔″鐞� 缁戝畾鎺堟潈
+     *
+     * @param loginBody 璇锋眰浣�
      * @return 缁撴灉
      */
-    @SuppressWarnings("unchecked")
     @PostMapping("/social/callback")
-    public R<LoginVo> socialLogin(@RequestBody LoginBody loginBody) {
-            // 鑾峰彇绗笁鏂圭櫥褰曚俊鎭�
-            AuthResponse<AuthUser> response = SocialUtils.loginAuth(loginBody, socialProperties);
-            AuthUser authUserData = response.getData();
-            // 鍒ゆ柇鎺堟潈鍝嶅簲鏄惁鎴愬姛
-            if (!response.ok()) {
-                return R.fail(response.getMsg());
-            }
-            return loginService.sociaRegister(authUserData);
+    public R<LoginVo> socialCallback(@RequestBody LoginBody loginBody) {
+        // 鑾峰彇绗笁鏂圭櫥褰曚俊鎭�
+        AuthResponse<AuthUser> response = SocialUtils.loginAuth(loginBody, socialProperties);
+        AuthUser authUserData = response.getData();
+        // 鍒ゆ柇鎺堟潈鍝嶅簲鏄惁鎴愬姛
+        if (!response.ok()) {
+            return R.fail(response.getMsg());
+        }
+        return loginService.sociaRegister(authUserData);
     }
 
 
diff --git a/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java b/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java
index 4da2bb0..5aa1f33 100644
--- a/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java
+++ b/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java
@@ -67,13 +67,13 @@
     private final SysUserMapper userMapper;
 
 
-
     /**
      * 缁戝畾绗笁鏂圭敤鎴�
+     *
      * @param authUserData 鎺堟潈鍝嶅簲瀹炰綋
      * @return 缁熶竴鍝嶅簲瀹炰綋
      */
-    public R<LoginVo> sociaRegister(AuthUser authUserData ){
+    public R<LoginVo> sociaRegister(AuthUser authUserData) {
         SysSocialBo bo = new SysSocialBo();
         bo.setUserId(LoginHelper.getUserId());
         bo.setAuthId(authUserData.getSource() + authUserData.getUuid());
@@ -123,9 +123,9 @@
 
     private SysUserVo loadUserByUsername(String tenantId, String username) {
         SysUser user = userMapper.selectOne(new LambdaQueryWrapper<SysUser>()
-                .select(SysUser::getUserName, SysUser::getStatus)
-                .eq(TenantHelper.isEnable(), SysUser::getTenantId, tenantId)
-                .eq(SysUser::getUserName, username));
+            .select(SysUser::getUserName, SysUser::getStatus)
+            .eq(TenantHelper.isEnable(), SysUser::getTenantId, tenantId)
+            .eq(SysUser::getUserName, username));
         if (ObjectUtil.isNull(user)) {
             log.info("鐧诲綍鐢ㄦ埛锛歿} 涓嶅瓨鍦�.", username);
             throw new UserException("user.not.exists", username);
@@ -225,7 +225,7 @@
             log.info("鐧诲綍绉熸埛锛歿} 宸茶鍋滅敤.", tenantId);
             throw new TenantException("tenant.blocked");
         } else if (ObjectUtil.isNotNull(tenant.getExpireTime())
-            && new Date().after(tenant.getExpireTime())) {
+                   && new Date().after(tenant.getExpireTime())) {
             log.info("鐧诲綍绉熸埛锛歿} 宸茶秴杩囨湁鏁堟湡.", tenantId);
             throw new TenantException("tenant.expired");
         }
diff --git a/ruoyi-admin/src/main/java/org/dromara/web/service/impl/socialAuthStrategy.java b/ruoyi-admin/src/main/java/org/dromara/web/service/impl/SocialAuthStrategy.java
similarity index 66%
rename from ruoyi-admin/src/main/java/org/dromara/web/service/impl/socialAuthStrategy.java
rename to ruoyi-admin/src/main/java/org/dromara/web/service/impl/SocialAuthStrategy.java
index c7599eb..f71bc9f 100644
--- a/ruoyi-admin/src/main/java/org/dromara/web/service/impl/socialAuthStrategy.java
+++ b/ruoyi-admin/src/main/java/org/dromara/web/service/impl/SocialAuthStrategy.java
@@ -11,17 +11,21 @@
 import me.zhyd.oauth.model.AuthUser;
 import org.dromara.common.core.constant.Constants;
 import org.dromara.common.core.domain.model.LoginBody;
-import org.dromara.common.core.domain.model.SocialLogin;
+import org.dromara.common.core.domain.model.LoginUser;
+import org.dromara.common.core.enums.UserStatus;
 import org.dromara.common.core.exception.ServiceException;
+import org.dromara.common.core.exception.user.UserException;
 import org.dromara.common.core.utils.MessageUtils;
 import org.dromara.common.core.utils.ValidatorUtils;
 import org.dromara.common.core.validate.auth.SocialGroup;
 import org.dromara.common.satoken.utils.LoginHelper;
 import org.dromara.common.social.config.properties.SocialProperties;
 import org.dromara.common.social.utils.SocialUtils;
+import org.dromara.common.tenant.helper.TenantHelper;
 import org.dromara.system.domain.SysClient;
 import org.dromara.system.domain.SysUser;
 import org.dromara.system.domain.vo.SysSocialVo;
+import org.dromara.system.domain.vo.SysUserVo;
 import org.dromara.system.mapper.SysUserMapper;
 import org.dromara.system.service.ISysSocialService;
 import org.dromara.web.domain.vo.LoginVo;
@@ -37,7 +41,7 @@
 @Slf4j
 @Service("social" + IAuthStrategy.BASE_NAME)
 @RequiredArgsConstructor
-public class socialAuthStrategy implements IAuthStrategy {
+public class SocialAuthStrategy implements IAuthStrategy {
 
     private final SocialProperties socialProperties;
     private final ISysSocialService sysSocialService;
@@ -52,13 +56,14 @@
 
     /**
      * 鐧诲綍-绗笁鏂规巿鏉冪櫥褰�
-     * @param clientId 瀹㈡埛绔痠d
+     *
+     * @param clientId  瀹㈡埛绔痠d
      * @param loginBody 鐧诲綍淇℃伅
-     * @param client 瀹㈡埛绔俊鎭�
+     * @param client    瀹㈡埛绔俊鎭�
      */
     @Override
     public LoginVo login(String clientId, LoginBody loginBody, SysClient client) {
-        AuthResponse<AuthUser> response = SocialUtils.loginAuth(loginBody,socialProperties);
+        AuthResponse<AuthUser> response = SocialUtils.loginAuth(loginBody, socialProperties);
         if (!response.ok()) {
             throw new ServiceException(response.getMsg());
         }
@@ -66,30 +71,19 @@
         SysSocialVo social = sysSocialService.selectByAuthId(authUserData.getSource() + authUserData.getUuid());
         if (!ObjectUtil.isNotNull(social)) {
             throw new ServiceException("浣犺繕娌℃湁缁戝畾绗笁鏂硅处鍙凤紝缁戝畾鍚庢墠鍙互鐧诲綍锛�");
-        }//楠岃瘉鎺堟潈琛ㄩ噷闈㈢殑绉熸埛id鏄惁鍖呭惈褰撳墠绉熸埛id
-        if (ObjectUtil.isNotNull(social) && StrUtil.isNotBlank(social.getTenantId())
-            && !social.getTenantId().contains(loginBody.getTenantId())) {
+        }
+        // 楠岃瘉鎺堟潈琛ㄩ噷闈㈢殑绉熸埛id鏄惁鍖呭惈褰撳墠绉熸埛id
+        String tenantId = social.getTenantId();
+        if (ObjectUtil.isNotNull(social) && StrUtil.isNotBlank(tenantId)
+            && !tenantId.contains(loginBody.getTenantId())) {
             throw new ServiceException("瀵逛笉璧凤紝浣犳病鏈夋潈闄愮櫥褰曞綋鍓嶇鎴凤紒");
         }
-        return loadinUser(social, client);
-    }
 
-    /**
-     * 鐧诲綍鐢ㄦ埛淇℃伅
-     *
-     * @param social
-     * @param client
-     * @return
-     */
-    private LoginVo loadinUser(SysSocialVo social, SysClient client) {
-        SysUser user = userMapper.selectOne(new LambdaQueryWrapper<SysUser>()
-            .eq(SysUser::getUserId, social.getUserId()));
-        SocialLogin loginUser = new SocialLogin();
-        loginUser.setUserId(user.getUserId());
-        loginUser.setTenantId(user.getTenantId());
-        loginUser.setUsername(user.getUserName());
-        loginUser.setUserType(user.getUserType());
-        // 鎵ц鐧诲綍
+        // 鏌ユ壘鐢ㄦ埛
+        SysUserVo user = loadUser(tenantId, social.getUserId());
+
+        // 姝ゅ鍙牴鎹櫥褰曠敤鎴风殑鏁版嵁涓嶅悓 鑷鍒涘缓 loginUser 灞炴�т笉澶熺敤缁ф壙鎵╁睍灏辫浜�
+        LoginUser loginUser = loginService.buildLoginUser(user);
         SaLoginModel model = new SaLoginModel();
         model.setDevice(client.getDeviceType());
         // 鑷畾涔夊垎閰� 涓嶅悓鐢ㄦ埛浣撶郴 涓嶅悓 token 鎺堟潈鏃堕棿 涓嶈缃粯璁よ蛋鍏ㄥ眬 yml 閰嶇疆
@@ -106,4 +100,22 @@
         return loginVo;
     }
 
+    private SysUserVo loadUser(String tenantId, Long userId) {
+        SysUser user = userMapper.selectOne(new LambdaQueryWrapper<SysUser>()
+            .select(SysUser::getUserName, SysUser::getStatus)
+            .eq(TenantHelper.isEnable(), SysUser::getTenantId, tenantId)
+            .eq(SysUser::getUserId, userId));
+        if (ObjectUtil.isNull(user)) {
+            log.info("鐧诲綍鐢ㄦ埛锛歿} 涓嶅瓨鍦�.", "");
+            throw new UserException("user.not.exists", "");
+        } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
+            log.info("鐧诲綍鐢ㄦ埛锛歿} 宸茶鍋滅敤.", "");
+            throw new UserException("user.blocked", "");
+        }
+        if (TenantHelper.isEnable()) {
+            return userMapper.selectTenantUserByUserName(user.getUserName(), tenantId);
+        }
+        return userMapper.selectUserByUserName(user.getUserName());
+    }
+
 }
diff --git a/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/config/properties/SocialProperties.java b/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/config/properties/SocialProperties.java
index 273fe7b..cb8337b 100644
--- a/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/config/properties/SocialProperties.java
+++ b/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/config/properties/SocialProperties.java
@@ -1,7 +1,6 @@
 package org.dromara.common.social.config.properties;
 
 import lombok.Data;
-import org.springframework.boot.autoconfigure.cache.CacheProperties;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.stereotype.Component;
 
@@ -20,7 +19,7 @@
     /**
      * 鏄惁鍚敤
      */
-    private boolean enabled;
+    private Boolean enabled;
 
     /**
      * 鎺堟潈绫诲瀷
@@ -30,11 +29,6 @@
     /**
      * 鎺堟潈杩囨湡鏃堕棿
      */
-    private long timeout;
-
-    /**
-     * 鎺堟潈缂撳瓨閰嶇疆
-     */
-    private CacheProperties cache = new CacheProperties();
+    private Long timeout;
 
 }
diff --git a/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/AuthRedisStateCache.java b/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/AuthRedisStateCache.java
index d2a4843..ae58348 100644
--- a/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/AuthRedisStateCache.java
+++ b/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/AuthRedisStateCache.java
@@ -7,6 +7,9 @@
 
 import java.time.Duration;
 
+/**
+ * 鎺堟潈鐘舵�佺紦瀛�
+ */
 @AllArgsConstructor
 public class AuthRedisStateCache implements AuthStateCache {
 
diff --git a/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java b/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java
index f24ea04..5ca2a5e 100644
--- a/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java
+++ b/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java
@@ -17,6 +17,8 @@
  * @author thiszhc
  */
 public class SocialUtils  {
+
+    @SuppressWarnings("unchecked")
     public static AuthResponse<AuthUser> loginAuth(LoginBody loginBody, SocialProperties socialProperties) throws AuthException {
         AuthRequest authRequest = getAuthRequest(loginBody.getSource(), socialProperties);
         AuthCallback callback = new AuthCallback();
@@ -25,7 +27,7 @@
         return authRequest.login(callback);
     }
 
-    public static AuthRequest getAuthRequest(String source,SocialProperties socialProperties) throws AuthException {
+    public static AuthRequest getAuthRequest(String source, SocialProperties socialProperties) throws AuthException {
         SocialLoginConfigProperties obj = socialProperties.getType().get(source);
          if (ObjectUtil.isNull(obj)) {
             throw new AuthException("涓嶆敮鎸佺殑绗笁鏂圭櫥褰曠被鍨�");
@@ -33,106 +35,32 @@
         String clientId = obj.getClientId();
         String clientSecret = obj.getClientSecret();
         String redirectUri = obj.getRedirectUri();
-        AuthRequest authRequest = null;
-        switch (source.toLowerCase()) {
-            case "dingtalk" ->
-                authRequest = new AuthDingTalkRequest(AuthConfig.builder()
-                    .clientId(clientId)
-                    .clientSecret(clientSecret)
-                    .redirectUri(redirectUri)
-                    .build());
-            case "baidu" ->
-                authRequest = new AuthBaiduRequest(AuthConfig.builder()
-                    .clientId(clientId)
-                    .clientSecret(clientSecret)
-                    .redirectUri(redirectUri)
-                    .build());
-            case "github" ->
-                authRequest = new AuthGithubRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "gitee" ->
-                authRequest = new AuthGiteeRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "weibo" ->
-                authRequest = new AuthWeiboRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "coding" ->
-                authRequest = new AuthCodingRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "oschina" ->
-                authRequest = new AuthOschinaRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "alipay" ->
-                // 鏀粯瀹濆湪鍒涘缓鍥炶皟鍦板潃鏃讹紝涓嶅厑璁镐娇鐢╨ocalhost鎴栬��127.0.0.1锛屾墍浠ヨ繖鍎跨殑鍥炶皟鍦板潃浣跨敤鐨勫眬鍩熺綉鍐呯殑ip
-                authRequest = new AuthAlipayRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "qq" ->
-                authRequest = new AuthQqRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "wechat_open" -> authRequest = new AuthWeChatOpenRequest(AuthConfig.builder().clientId(clientId)
-                .clientSecret(clientSecret).redirectUri(redirectUri).build());
-            case "csdn" ->
-                //娉ㄦ剰,缁忓挩璇SDN瀹樻柟瀹㈡湇寰楃煡锛孋SDN鐨勬巿鏉冨紑鏀惧钩鍙板凡缁忎笅绾裤�傚鏋滀互鍓嶇敵璇疯繃鐨勫簲鐢紝鍙互缁х画浣跨敤锛屼絾鏄笉鍐嶆敮鎸佺敵璇锋柊鐨勫簲鐢ㄣ��
-                // so, 鏈」鐩腑鐨凜SDN鐧诲綍鍙兘閽堝灏戦儴鍒嗙敤鎴蜂娇鐢ㄤ簡
-                authRequest = new AuthCsdnRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "taobao" ->
-                authRequest = new AuthTaobaoRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "douyin" ->
-                authRequest = new AuthDouyinRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "linkedin" ->
-                authRequest = new AuthLinkedinRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "microsoft" -> authRequest = new AuthMicrosoftRequest(AuthConfig.builder().clientId(clientId)
-                .clientSecret(clientSecret).redirectUri(redirectUri).build());
-            case "mi" ->
-                authRequest = new AuthMiRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "toutiao" ->
-                authRequest = new AuthToutiaoRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "teambition" -> authRequest = new AuthTeambitionRequest(AuthConfig.builder().clientId(clientId)
-                .clientSecret(clientSecret).redirectUri(redirectUri).build());
-            case "pinterest" -> authRequest = new AuthPinterestRequest(AuthConfig.builder().clientId(clientId)
-                .clientSecret(clientSecret).redirectUri(redirectUri).build());
-            case "renren" ->
-                authRequest = new AuthRenrenRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "stack_overflow" -> authRequest = new AuthStackOverflowRequest(AuthConfig.builder().clientId(clientId)
-                .clientSecret(clientSecret).redirectUri(redirectUri).stackOverflowKey("").build());
-            case "huawei" ->
-                authRequest = new AuthHuaweiRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "wechat_enterprise" ->
-                authRequest = new AuthWeChatEnterpriseQrcodeRequest(AuthConfig.builder().clientId(clientId)
-                    .clientSecret(clientSecret).redirectUri(redirectUri).agentId("").build());
-            case "kujiale" ->
-                authRequest = new AuthKujialeRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "gitlab" ->
-                authRequest = new AuthGitlabRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "meituan" ->
-                authRequest = new AuthMeituanRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "eleme" ->
-                authRequest = new AuthElemeRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "wechat_mp" ->
-                authRequest = new AuthWeChatMpRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            case "aliyun" ->
-                authRequest = new AuthAliyunRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret)
-                    .redirectUri(redirectUri).build());
-            default -> {
-            }
-        }
-        if (null == authRequest) {
-            throw new AuthException("鏈幏鍙栧埌鏈夋晥鐨凙uth閰嶇疆");
-        }
-        return authRequest;
+        return switch (source.toLowerCase()) {
+            case "dingtalk" -> new AuthDingTalkRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "baidu" -> new AuthBaiduRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "github" -> new AuthGithubRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "gitee" -> new AuthGiteeRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "weibo" -> new AuthWeiboRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "coding" -> new AuthCodingRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "oschina" -> new AuthOschinaRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            // 鏀粯瀹濆湪鍒涘缓鍥炶皟鍦板潃鏃讹紝涓嶅厑璁镐娇鐢╨ocalhost鎴栬��127.0.0.1锛屾墍浠ヨ繖鍎跨殑鍥炶皟鍦板潃浣跨敤鐨勫眬鍩熺綉鍐呯殑ip
+            // 浣跨敤鏀粯瀹濋渶瑕佹彁渚沘lipay鍏挜
+            // case "alipay" -> new AuthAlipayRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build(), alipayPublicKey);
+            case "qq" -> new AuthQqRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "wechat_open" -> new AuthWeChatOpenRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "taobao" -> new AuthTaobaoRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "douyin" -> new AuthDouyinRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "linkedin" -> new AuthLinkedinRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "microsoft" -> new AuthMicrosoftRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "renren" -> new AuthRenrenRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "stack_overflow" -> new AuthStackOverflowRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).stackOverflowKey("").build());
+            case "huawei" -> new AuthHuaweiRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "wechat_enterprise" -> new AuthWeChatEnterpriseQrcodeRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).agentId("").build());
+            case "gitlab" -> new AuthGitlabRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "wechat_mp" -> new AuthWeChatMpRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            case "aliyun" -> new AuthAliyunRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
+            default -> throw new AuthException("鏈幏鍙栧埌鏈夋晥鐨凙uth閰嶇疆");
+        };
     }
 }
 

--
Gitblit v1.9.3