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():
OAuth2AuthorizationRequestRedirectFilterOAuth2AuthorizationCodeGrantFilterClientRegistrationRepository (required)OAuth2AuthorizedClientRepository (optional)ClientRegistrationRepositoryOAuth2AuthorizedClientRepositoryOAuth2AuthorizationRequestRedirectFilter,
OAuth2AuthorizationCodeGrantFilter,
ClientRegistrationRepository,
OAuth2AuthorizedClientRepository,
AbstractHttpConfigurer| Modifier and Type | Class and Description |
|---|---|
class |
OAuth2ClientConfigurer.AuthorizationCodeGrantConfigurer
Configuration options for the OAuth 2.0 Authorization Code Grant.
|
| Constructor and Description |
|---|
OAuth2ClientConfigurer() |
| Modifier and Type | Method and Description |
|---|---|
OAuth2ClientConfigurer.AuthorizationCodeGrantConfigurer |
authorizationCodeGrant()
Returns the
OAuth2ClientConfigurer.AuthorizationCodeGrantConfigurer for configuring the OAuth 2.0
Authorization Code Grant. |
OAuth2ClientConfigurer<B> |
authorizationCodeGrant(Customizer<OAuth2ClientConfigurer.AuthorizationCodeGrantConfigurer> authorizationCodeGrantCustomizer)
Configures the OAuth 2.0 Authorization Code Grant.
|
OAuth2ClientConfigurer<B> |
authorizedClientRepository(org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository authorizedClientRepository)
Sets the repository for authorized client(s).
|
OAuth2ClientConfigurer<B> |
authorizedClientService(org.springframework.security.oauth2.client.OAuth2AuthorizedClientService authorizedClientService)
Sets the service for authorized client(s).
|
OAuth2ClientConfigurer<B> |
clientRegistrationRepository(org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository)
Sets the repository of client registrations.
|
void |
configure(B builder)
Configure the
SecurityBuilder by setting the necessary properties on the
SecurityBuilder. |
void |
init(B builder)
Initialize the
SecurityBuilder. |
disable, withObjectPostProcessoraddObjectPostProcessor, and, getBuilder, postProcess, setBuilderpublic OAuth2ClientConfigurer<B> clientRegistrationRepository(org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository)
clientRegistrationRepository - the repository of client registrationsOAuth2ClientConfigurer for further configurationpublic OAuth2ClientConfigurer<B> authorizedClientRepository(org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository authorizedClientRepository)
authorizedClientRepository - the authorized client repositoryOAuth2ClientConfigurer for further configurationpublic OAuth2ClientConfigurer<B> authorizedClientService(org.springframework.security.oauth2.client.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.AuthorizationCodeGrantConfigurerOAuth2ClientConfigurer for further customizationspublic void init(B builder)
SecurityConfigurerSecurityBuilder. 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<org.springframework.security.web.DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>init in class SecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>public void configure(B builder)
SecurityConfigurerSecurityBuilder by setting the necessary properties on the
SecurityBuilder.configure in interface SecurityConfigurer<org.springframework.security.web.DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>configure in class SecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>