Class OAuth2AuthorizedClientProviderBuilder
java.lang.Object
org.springframework.security.oauth2.client.OAuth2AuthorizedClientProviderBuilder
A builder that builds a
DelegatingOAuth2AuthorizedClientProvider
composed of
one or more OAuth2AuthorizedClientProvider
(s) that implement specific
authorization grants. The supported authorization grants are
authorization_code
, refresh_token
,
client_credentials
and password
. In
addition to the standard authorization grants, an implementation of an extension grant
may be supplied via provider(OAuth2AuthorizedClientProvider)
.-
Nested Class Summary
Modifier and TypeClassDescriptionfinal class
A builder for theauthorization_code
grant.final class
A builder for theclient_credentials
grant.final class
A builder for thepassword
grant.final class
A builder for therefresh_token
grant. -
Method Summary
Modifier and TypeMethodDescriptionConfigures support for theauthorization_code
grant.build()
Builds an instance ofDelegatingOAuth2AuthorizedClientProvider
composed of one or moreOAuth2AuthorizedClientProvider
(s).builder()
Returns a newOAuth2AuthorizedClientProviderBuilder
for configuring the supported authorization grant(s).Configures support for theclient_credentials
grant.clientCredentials
(Consumer<OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder> builderConsumer) Configures support for theclient_credentials
grant.password()
Configures support for thepassword
grant.password
(Consumer<OAuth2AuthorizedClientProviderBuilder.PasswordGrantBuilder> builderConsumer) Configures support for thepassword
grant.provider
(OAuth2AuthorizedClientProvider provider) Configures anOAuth2AuthorizedClientProvider
to be composed with theDelegatingOAuth2AuthorizedClientProvider
.Configures support for therefresh_token
grant.refreshToken
(Consumer<OAuth2AuthorizedClientProviderBuilder.RefreshTokenGrantBuilder> builderConsumer) Configures support for therefresh_token
grant.
-
Method Details
-
builder
Returns a newOAuth2AuthorizedClientProviderBuilder
for configuring the supported authorization grant(s).- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
provider
Configures anOAuth2AuthorizedClientProvider
to be composed with theDelegatingOAuth2AuthorizedClientProvider
. This may be used for implementations of extension authorization grants.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
authorizationCode
Configures support for theauthorization_code
grant.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
refreshToken
Configures support for therefresh_token
grant.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
refreshToken
public OAuth2AuthorizedClientProviderBuilder refreshToken(Consumer<OAuth2AuthorizedClientProviderBuilder.RefreshTokenGrantBuilder> builderConsumer) Configures support for therefresh_token
grant.- Parameters:
builderConsumer
- aConsumer
ofOAuth2AuthorizedClientProviderBuilder.RefreshTokenGrantBuilder
used for further configuration- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
clientCredentials
Configures support for theclient_credentials
grant.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
clientCredentials
public OAuth2AuthorizedClientProviderBuilder clientCredentials(Consumer<OAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder> builderConsumer) Configures support for theclient_credentials
grant.- Parameters:
builderConsumer
- aConsumer
ofOAuth2AuthorizedClientProviderBuilder.ClientCredentialsGrantBuilder
used for further configuration- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
password
Configures support for thepassword
grant.- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
password
public OAuth2AuthorizedClientProviderBuilder password(Consumer<OAuth2AuthorizedClientProviderBuilder.PasswordGrantBuilder> builderConsumer) Configures support for thepassword
grant.- Parameters:
builderConsumer
- aConsumer
ofOAuth2AuthorizedClientProviderBuilder.PasswordGrantBuilder
used for further configuration- Returns:
- the
OAuth2AuthorizedClientProviderBuilder
-
build
Builds an instance ofDelegatingOAuth2AuthorizedClientProvider
composed of one or moreOAuth2AuthorizedClientProvider
(s).- Returns:
- the
DelegatingOAuth2AuthorizedClientProvider
-