Class OAuth2AuthorizedClientProviderBuilder
- java.lang.Object
-
- org.springframework.security.oauth2.client.OAuth2AuthorizedClientProviderBuilder
-
public final class OAuth2AuthorizedClientProviderBuilder extends java.lang.Object
A builder that builds aDelegatingOAuth2AuthorizedClientProvider
composed of one or moreOAuth2AuthorizedClientProvider
(s) that implement specific authorization grants. The supported authorization grants areauthorization_code
,refresh_token
,client_credentials
andpassword
. 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 class
OAuth2AuthorizedClientProviderBuilder.AuthorizationCodeGrantBuilder
A builder for theauthorization_code
grant.class
OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder
A builder for theclient_credentials
grant.class
OAuth2AuthorizedClientProviderBuilder.PasswordGrantBuilder
A builder for thepassword
grant.class
OAuth2AuthorizedClientProviderBuilder.RefreshTokenGrantBuilder
A builder for therefresh_token
grant.
-
Method Summary
-
-
-
Method Detail
-
builder
public static OAuth2AuthorizedClientProviderBuilder builder()
Returns a newOAuth2AuthorizedClientProviderBuilder
for configuring the supported authorization grant(s).- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
provider
public OAuth2AuthorizedClientProviderBuilder provider(OAuth2AuthorizedClientProvider provider)
Configures anOAuth2AuthorizedClientProvider
to 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_code
grant.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
refreshToken
public OAuth2AuthorizedClientProviderBuilder refreshToken()
Configures support for therefresh_token
grant.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
refreshToken
public OAuth2AuthorizedClientProviderBuilder refreshToken(java.util.function.Consumer<OAuth2AuthorizedClientProviderBuilder.RefreshTokenGrantBuilder> builderConsumer)
Configures support for therefresh_token
grant.- Parameters:
builderConsumer
- aConsumer
ofOAuth2AuthorizedClientProviderBuilder.RefreshTokenGrantBuilder
used for further configuration- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
clientCredentials
public OAuth2AuthorizedClientProviderBuilder clientCredentials()
Configures support for theclient_credentials
grant.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
clientCredentials
public OAuth2AuthorizedClientProviderBuilder clientCredentials(java.util.function.Consumer<OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder> builderConsumer)
Configures support for theclient_credentials
grant.- Parameters:
builderConsumer
- aConsumer
ofOAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder
used 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 thepassword
grant.- 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 thepassword
grant.- Parameters:
builderConsumer
- aConsumer
ofOAuth2AuthorizedClientProviderBuilder.PasswordGrantBuilder
used for further configuration- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
build
public OAuth2AuthorizedClientProvider build()
Builds an instance ofDelegatingOAuth2AuthorizedClientProvider
composed of one or moreOAuth2AuthorizedClientProvider
(s).- Returns:
- the
DelegatingOAuth2AuthorizedClientProvider
-
-