| | |
| | | package org.dromara.common.social.utils; |
| | | |
| | | import me.zhyd.oauth.cache.AuthStateCache; |
| | | import me.zhyd.oauth.config.AuthConfig; |
| | | import me.zhyd.oauth.exception.AuthException; |
| | | import me.zhyd.oauth.request.*; |
| | |
| | | */ |
| | | public class SocialUtils { |
| | | |
| | | public static AuthRequest getAuthRequest(String source, |
| | | String clientId, |
| | | String clientSecret, |
| | | String redirectUri) throws AuthException { |
| | | public static AuthRequest getAuthRequest(String source, String clientId, |
| | | String clientSecret, String redirectUri) throws AuthException { |
| | | AuthRequest authRequest = null; |
| | | switch (source.toLowerCase()) { |
| | | case "dingtalk" -> |
| | | authRequest = new AuthDingTalkRequest(AuthConfig.builder(). |
| | | clientId(clientId). |
| | | clientSecret(clientSecret) |
| | | .redirectUri(redirectUri). |
| | | build()); |
| | | 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()); |
| | | 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()); |