| | |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.social.config.properties.SocialLoginConfigProperties; |
| | | import org.dromara.common.social.config.properties.SocialProperties; |
| | | import org.dromara.common.social.keycloak.AuthKeycloakRequest; |
| | | import org.dromara.common.social.maxkey.AuthMaxKeyRequest; |
| | | import org.dromara.common.social.topiam.AuthTopIamRequest; |
| | | |
| | |
| | | case "aliyun" -> new AuthAliyunRequest(builder.build(), STATE_CACHE); |
| | | case "maxkey" -> new AuthMaxKeyRequest(builder.build(), STATE_CACHE); |
| | | case "topiam" -> new AuthTopIamRequest(builder.build(), STATE_CACHE); |
| | | case "keycloak" -> new AuthKeycloakRequest(builder.build(), STATE_CACHE); |
| | | default -> throw new AuthException("未获取到有效的Auth配置"); |
| | | }; |
| | | } |
| | | |
| | | |
| | | public static AuthKeycloakRequest getAuthKeyloakRequest(String source, SocialProperties socialProperties) { |
| | | SocialLoginConfigProperties obj = socialProperties.getType().get(source); |
| | | if (ObjectUtil.isNull(obj)) { |
| | | throw new AuthException("不支持的第三方登录类型"); |
| | | } |
| | | AuthConfig.AuthConfigBuilder builder = AuthConfig.builder() |
| | | .clientId(obj.getClientId()) |
| | | .clientSecret(obj.getClientSecret()) |
| | | .redirectUri(obj.getRedirectUri()) |
| | | .scopes(obj.getScopes()); |
| | | return new AuthKeycloakRequest(builder.build(), STATE_CACHE); |
| | | } |
| | | } |
| | | |