public final class OAuth2ClientConfigurer<B extends HttpSecurityBuilder<B>> extends AbstractHttpConfigurer<OAuth2ClientConfigurer<B>,B>
AbstractHttpConfigurer
for OAuth 2.0 Client support.
The following configuration options are available:
authorizationCodeGrant()
- support for the OAuth 2.0 Authorization Code Grant
Defaults are provided for all configuration options with the only required configuration
being clientRegistrationRepository(ClientRegistrationRepository)
.
Alternatively, a ClientRegistrationRepository
@Bean
may be registered instead.
Filter
's are populated for authorizationCodeGrant()
:
ClientRegistrationRepository
(required)OAuth2AuthorizedClientRepository
(optional)Modifier and Type | Class and Description |
---|---|
class |
OAuth2ClientConfigurer.AuthorizationCodeGrantConfigurer
Configuration options for the OAuth 2.0 Authorization Code Grant.
|
Constructor and Description |
---|
OAuth2ClientConfigurer() |
disable, withObjectPostProcessor
addObjectPostProcessor, and, getBuilder, postProcess, setBuilder
public OAuth2ClientConfigurer<B> clientRegistrationRepository(ClientRegistrationRepository clientRegistrationRepository)
clientRegistrationRepository
- the repository of client registrationsOAuth2ClientConfigurer
for further configurationpublic OAuth2ClientConfigurer<B> authorizedClientRepository(OAuth2AuthorizedClientRepository authorizedClientRepository)
authorizedClientRepository
- the authorized client repositoryOAuth2ClientConfigurer
for further configurationpublic OAuth2ClientConfigurer<B> authorizedClientService(OAuth2AuthorizedClientService authorizedClientService)
authorizedClientService
- the authorized client serviceOAuth2ClientConfigurer
for further configurationpublic OAuth2ClientConfigurer.AuthorizationCodeGrantConfigurer authorizationCodeGrant()
OAuth2ClientConfigurer.AuthorizationCodeGrantConfigurer
for configuring the OAuth 2.0 Authorization Code Grant.public OAuth2ClientConfigurer<B> authorizationCodeGrant(Customizer<OAuth2ClientConfigurer.AuthorizationCodeGrantConfigurer> authorizationCodeGrantCustomizer)
authorizationCodeGrantCustomizer
- the Customizer
to provide more options for
the OAuth2ClientConfigurer.AuthorizationCodeGrantConfigurer
OAuth2ClientConfigurer
for further customizationspublic void init(B builder)
SecurityConfigurer
SecurityBuilder
. Here only shared state should be created
and modified, but not properties on the SecurityBuilder
used for building
the object. This ensures that the SecurityConfigurer.configure(SecurityBuilder)
method uses
the correct shared objects when building. Configurers should be applied here.init
in interface SecurityConfigurer<DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>
init
in class SecurityConfigurerAdapter<DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>
public void configure(B builder)
SecurityConfigurer
SecurityBuilder
by setting the necessary properties on the
SecurityBuilder
.configure
in interface SecurityConfigurer<DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>
configure
in class SecurityConfigurerAdapter<DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>