Class OAuth2AuthorizedClientProviderBuilder
- java.lang.Object
-
- org.springframework.security.oauth2.client.OAuth2AuthorizedClientProviderBuilder
-
public final class OAuth2AuthorizedClientProviderBuilder extends java.lang.ObjectA builder that builds aDelegatingOAuth2AuthorizedClientProvidercomposed of one or moreOAuth2AuthorizedClientProvider(s) that implement specific authorization grants. The supported authorization grants areauthorization_code,refresh_token,client_credentialsandpassword. In addition to the standard authorization grants, an implementation of an extension grant may be supplied viaprovider(OAuth2AuthorizedClientProvider).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classOAuth2AuthorizedClientProviderBuilder.AuthorizationCodeGrantBuilderA builder for theauthorization_codegrant.classOAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilderA builder for theclient_credentialsgrant.classOAuth2AuthorizedClientProviderBuilder.PasswordGrantBuilderA builder for thepasswordgrant.classOAuth2AuthorizedClientProviderBuilder.RefreshTokenGrantBuilderA builder for therefresh_tokengrant.
-
Method Summary
-
-
-
Method Detail
-
builder
public static OAuth2AuthorizedClientProviderBuilder builder()
Returns a newOAuth2AuthorizedClientProviderBuilderfor configuring the supported authorization grant(s).- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
provider
public OAuth2AuthorizedClientProviderBuilder provider(OAuth2AuthorizedClientProvider provider)
Configures anOAuth2AuthorizedClientProviderto be composed with theDelegatingOAuth2AuthorizedClientProvider. This may be used for implementations of extension authorization grants.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
authorizationCode
public OAuth2AuthorizedClientProviderBuilder authorizationCode()
Configures support for theauthorization_codegrant.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
refreshToken
public OAuth2AuthorizedClientProviderBuilder refreshToken()
Configures support for therefresh_tokengrant.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
refreshToken
public OAuth2AuthorizedClientProviderBuilder refreshToken(java.util.function.Consumer<OAuth2AuthorizedClientProviderBuilder.RefreshTokenGrantBuilder> builderConsumer)
Configures support for therefresh_tokengrant.- Parameters:
builderConsumer- aConsumerofOAuth2AuthorizedClientProviderBuilder.RefreshTokenGrantBuilderused for further configuration- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
clientCredentials
public OAuth2AuthorizedClientProviderBuilder clientCredentials()
Configures support for theclient_credentialsgrant.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
clientCredentials
public OAuth2AuthorizedClientProviderBuilder clientCredentials(java.util.function.Consumer<OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder> builderConsumer)
Configures support for theclient_credentialsgrant.- Parameters:
builderConsumer- aConsumerofOAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilderused for further configuration- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
password
@Deprecated public OAuth2AuthorizedClientProviderBuilder password()
Deprecated.The latest OAuth 2.0 Security Best Current Practice disallows the use of the Resource Owner Password Credentials grant. See reference OAuth 2.0 Security Best Current Practice.Configures support for thepasswordgrant.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
password
@Deprecated public OAuth2AuthorizedClientProviderBuilder password(java.util.function.Consumer<OAuth2AuthorizedClientProviderBuilder.PasswordGrantBuilder> builderConsumer)
Deprecated.The latest OAuth 2.0 Security Best Current Practice disallows the use of the Resource Owner Password Credentials grant. See reference OAuth 2.0 Security Best Current Practice.Configures support for thepasswordgrant.- Parameters:
builderConsumer- aConsumerofOAuth2AuthorizedClientProviderBuilder.PasswordGrantBuilderused for further configuration- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
build
public OAuth2AuthorizedClientProvider build()
Builds an instance ofDelegatingOAuth2AuthorizedClientProvidercomposed of one or moreOAuth2AuthorizedClientProvider(s).- Returns:
- the
DelegatingOAuth2AuthorizedClientProvider
-
-