Class OAuth2AuthorizationServerConfigurer
java.lang.Object
org.springframework.security.config.annotation.SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>
org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer<OAuth2AuthorizationServerConfigurer,HttpSecurity>
org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization.OAuth2AuthorizationServerConfigurer
- All Implemented Interfaces:
SecurityConfigurer<DefaultSecurityFilterChain,HttpSecurity>
public final class OAuth2AuthorizationServerConfigurer
extends AbstractHttpConfigurer<OAuth2AuthorizationServerConfigurer,HttpSecurity>
An
AbstractHttpConfigurer for OAuth 2.1 Authorization Server support.- Since:
- 7.0
- See Also:
-
AbstractHttpConfigurerOAuth2ClientAuthenticationConfigurerOAuth2AuthorizationServerMetadataEndpointConfigurerOAuth2AuthorizationEndpointConfigurerOAuth2PushedAuthorizationRequestEndpointConfigurerOAuth2TokenEndpointConfigurerOAuth2TokenIntrospectionEndpointConfigurerOAuth2TokenRevocationEndpointConfigurerOAuth2DeviceAuthorizationEndpointConfigurerOAuth2DeviceVerificationEndpointConfigurerOidcConfigurerRegisteredClientRepositoryOAuth2AuthorizationServiceOAuth2AuthorizationConsentServiceNimbusJwkSetEndpointFilter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthorizationConsentService(OAuth2AuthorizationConsentService authorizationConsentService) Sets the authorization consent service.authorizationEndpoint(Customizer<OAuth2AuthorizationEndpointConfigurer> authorizationEndpointCustomizer) Configures the OAuth 2.0 Authorization Endpoint.authorizationServerMetadataEndpoint(Customizer<OAuth2AuthorizationServerMetadataEndpointConfigurer> authorizationServerMetadataEndpointCustomizer) Configures the OAuth 2.0 Authorization Server Metadata Endpoint.authorizationServerSettings(AuthorizationServerSettings authorizationServerSettings) Sets the authorization server settings.authorizationService(OAuth2AuthorizationService authorizationService) Sets the authorization service.clientAuthentication(Customizer<OAuth2ClientAuthenticationConfigurer> clientAuthenticationCustomizer) Configures OAuth 2.0 Client Authentication.voidconfigure(HttpSecurity httpSecurity) Configure theSecurityBuilderby setting the necessary properties on theSecurityBuilder.deviceAuthorizationEndpoint(Customizer<OAuth2DeviceAuthorizationEndpointConfigurer> deviceAuthorizationEndpointCustomizer) Configures the OAuth 2.0 Device Authorization Endpoint.deviceVerificationEndpoint(Customizer<OAuth2DeviceVerificationEndpointConfigurer> deviceVerificationEndpointCustomizer) Configures the OAuth 2.0 Device Verification Endpoint.Returns aRequestMatcherfor the authorization server endpoints.voidinit(HttpSecurity httpSecurity) Initialize theSecurityBuilder.oidc(Customizer<OidcConfigurer> oidcCustomizer) Configures OpenID Connect 1.0 support (disabled by default).pushedAuthorizationRequestEndpoint(Customizer<OAuth2PushedAuthorizationRequestEndpointConfigurer> pushedAuthorizationRequestEndpointCustomizer) Configures the OAuth 2.0 Pushed Authorization Request Endpoint.registeredClientRepository(RegisteredClientRepository registeredClientRepository) Sets the repository of registered clients.tokenEndpoint(Customizer<OAuth2TokenEndpointConfigurer> tokenEndpointCustomizer) Configures the OAuth 2.0 Token Endpoint.tokenGenerator(OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator) Sets the token generator.tokenIntrospectionEndpoint(Customizer<OAuth2TokenIntrospectionEndpointConfigurer> tokenIntrospectionEndpointCustomizer) Configures the OAuth 2.0 Token Introspection Endpoint.tokenRevocationEndpoint(Customizer<OAuth2TokenRevocationEndpointConfigurer> tokenRevocationEndpointCustomizer) Configures the OAuth 2.0 Token Revocation Endpoint.Methods inherited from class org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
disable, getRequestMatcherBuilder, getSecurityContextHolderStrategy, withObjectPostProcessorMethods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, getBuilder, postProcess, setBuilder
-
Constructor Details
-
OAuth2AuthorizationServerConfigurer
public OAuth2AuthorizationServerConfigurer()
-
-
Method Details
-
registeredClientRepository
public OAuth2AuthorizationServerConfigurer registeredClientRepository(RegisteredClientRepository registeredClientRepository) Sets the repository of registered clients.- Parameters:
registeredClientRepository- the repository of registered clients- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
authorizationService
public OAuth2AuthorizationServerConfigurer authorizationService(OAuth2AuthorizationService authorizationService) Sets the authorization service.- Parameters:
authorizationService- the authorization service- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
authorizationConsentService
public OAuth2AuthorizationServerConfigurer authorizationConsentService(OAuth2AuthorizationConsentService authorizationConsentService) Sets the authorization consent service.- Parameters:
authorizationConsentService- the authorization consent service- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
authorizationServerSettings
public OAuth2AuthorizationServerConfigurer authorizationServerSettings(AuthorizationServerSettings authorizationServerSettings) Sets the authorization server settings.- Parameters:
authorizationServerSettings- the authorization server settings- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
tokenGenerator
public OAuth2AuthorizationServerConfigurer tokenGenerator(OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator) Sets the token generator.- Parameters:
tokenGenerator- the token generator- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
clientAuthentication
public OAuth2AuthorizationServerConfigurer clientAuthentication(Customizer<OAuth2ClientAuthenticationConfigurer> clientAuthenticationCustomizer) Configures OAuth 2.0 Client Authentication.- Parameters:
clientAuthenticationCustomizer- theCustomizerproviding access to theOAuth2ClientAuthenticationConfigurer- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
authorizationServerMetadataEndpoint
public OAuth2AuthorizationServerConfigurer authorizationServerMetadataEndpoint(Customizer<OAuth2AuthorizationServerMetadataEndpointConfigurer> authorizationServerMetadataEndpointCustomizer) Configures the OAuth 2.0 Authorization Server Metadata Endpoint.- Parameters:
authorizationServerMetadataEndpointCustomizer- theCustomizerproviding access to theOAuth2AuthorizationServerMetadataEndpointConfigurer- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
authorizationEndpoint
public OAuth2AuthorizationServerConfigurer authorizationEndpoint(Customizer<OAuth2AuthorizationEndpointConfigurer> authorizationEndpointCustomizer) Configures the OAuth 2.0 Authorization Endpoint.- Parameters:
authorizationEndpointCustomizer- theCustomizerproviding access to theOAuth2AuthorizationEndpointConfigurer- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
pushedAuthorizationRequestEndpoint
public OAuth2AuthorizationServerConfigurer pushedAuthorizationRequestEndpoint(Customizer<OAuth2PushedAuthorizationRequestEndpointConfigurer> pushedAuthorizationRequestEndpointCustomizer) Configures the OAuth 2.0 Pushed Authorization Request Endpoint.- Parameters:
pushedAuthorizationRequestEndpointCustomizer- theCustomizerproviding access to theOAuth2PushedAuthorizationRequestEndpointConfigurer- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
tokenEndpoint
public OAuth2AuthorizationServerConfigurer tokenEndpoint(Customizer<OAuth2TokenEndpointConfigurer> tokenEndpointCustomizer) Configures the OAuth 2.0 Token Endpoint.- Parameters:
tokenEndpointCustomizer- theCustomizerproviding access to theOAuth2TokenEndpointConfigurer- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
tokenIntrospectionEndpoint
public OAuth2AuthorizationServerConfigurer tokenIntrospectionEndpoint(Customizer<OAuth2TokenIntrospectionEndpointConfigurer> tokenIntrospectionEndpointCustomizer) Configures the OAuth 2.0 Token Introspection Endpoint.- Parameters:
tokenIntrospectionEndpointCustomizer- theCustomizerproviding access to theOAuth2TokenIntrospectionEndpointConfigurer- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
tokenRevocationEndpoint
public OAuth2AuthorizationServerConfigurer tokenRevocationEndpoint(Customizer<OAuth2TokenRevocationEndpointConfigurer> tokenRevocationEndpointCustomizer) Configures the OAuth 2.0 Token Revocation Endpoint.- Parameters:
tokenRevocationEndpointCustomizer- theCustomizerproviding access to theOAuth2TokenRevocationEndpointConfigurer- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
deviceAuthorizationEndpoint
public OAuth2AuthorizationServerConfigurer deviceAuthorizationEndpoint(Customizer<OAuth2DeviceAuthorizationEndpointConfigurer> deviceAuthorizationEndpointCustomizer) Configures the OAuth 2.0 Device Authorization Endpoint.- Parameters:
deviceAuthorizationEndpointCustomizer- theCustomizerproviding access to theOAuth2DeviceAuthorizationEndpointConfigurer- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
deviceVerificationEndpoint
public OAuth2AuthorizationServerConfigurer deviceVerificationEndpoint(Customizer<OAuth2DeviceVerificationEndpointConfigurer> deviceVerificationEndpointCustomizer) Configures the OAuth 2.0 Device Verification Endpoint.- Parameters:
deviceVerificationEndpointCustomizer- theCustomizerproviding access to theOAuth2DeviceVerificationEndpointConfigurer- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
oidc
Configures OpenID Connect 1.0 support (disabled by default).- Parameters:
oidcCustomizer- theCustomizerproviding access to theOidcConfigurer- Returns:
- the
OAuth2AuthorizationServerConfigurerfor further configuration
-
getEndpointsMatcher
Returns aRequestMatcherfor the authorization server endpoints.- Returns:
- a
RequestMatcherfor the authorization server endpoints
-
init
Description copied from interface:SecurityConfigurerInitialize theSecurityBuilder. Here only shared state should be created and modified, but not properties on theSecurityBuilderused for building the object. This ensures that theSecurityConfigurer.configure(SecurityBuilder)method uses the correct shared objects when building. Configurers should be applied here.- Specified by:
initin interfaceSecurityConfigurer<DefaultSecurityFilterChain,HttpSecurity> - Overrides:
initin classSecurityConfigurerAdapter<DefaultSecurityFilterChain,HttpSecurity> - Throws:
Exception
-
configure
Description copied from interface:SecurityConfigurerConfigure theSecurityBuilderby setting the necessary properties on theSecurityBuilder.- Specified by:
configurein interfaceSecurityConfigurer<DefaultSecurityFilterChain,HttpSecurity> - Overrides:
configurein classSecurityConfigurerAdapter<DefaultSecurityFilterChain,HttpSecurity>
-