Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.springframework.security.oauth2.core.AuthenticationMethod;
import org.springframework.security.oauth2.core.AuthorizationGrantType;
import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;

/**
Expand All @@ -45,6 +46,12 @@
* @since 4.0.0
*/
public final class OAuth2ClientPropertiesMapper {
private static final boolean SPRING_SECURITY_CONFIG_PRESENT;

static {
ClassLoader loader = OAuth2ClientPropertiesMapper.class.getClassLoader();
SPRING_SECURITY_CONFIG_PRESENT = ClassUtils.isPresent("org.springframework.security.config.oauth2.client.CommonOAuth2Provider", loader);
}

private final OAuth2ClientProperties properties;

Expand Down Expand Up @@ -137,6 +144,10 @@ private static Builder getBuilder(Builder builder, Provider provider) {
}

private static @Nullable CommonOAuth2Provider getCommonProvider(String providerId) {
if (!SPRING_SECURITY_CONFIG_PRESENT) {
return null;
}

try {
return ApplicationConversionService.getSharedInstance().convert(providerId, CommonOAuth2Provider.class);
}
Expand Down