Class HttpBasicConfigurer<B extends HttpSecurityBuilder<B>>
java.lang.Object
org.springframework.security.config.annotation.SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>
org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer<HttpBasicConfigurer<B>,B>
org.springframework.security.config.annotation.web.configurers.HttpBasicConfigurer<B>
- All Implemented Interfaces:
SecurityConfigurer<DefaultSecurityFilterChain,B>
public final class HttpBasicConfigurer<B extends HttpSecurityBuilder<B>>
extends AbstractHttpConfigurer<HttpBasicConfigurer<B>,B>
Adds HTTP basic based authentication. All attributes have reasonable defaults making
all parameters are optional.
Security Filters
The following Filters are populatedShared Objects Created
- AuthenticationEntryPoint - populated with the
authenticationEntryPoint(AuthenticationEntryPoint)(defaultBasicAuthenticationEntryPoint)
Shared Objects Used
The following shared objects are used:- Since:
- 3.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthenticationDetailsSource(AuthenticationDetailsSource<javax.servlet.http.HttpServletRequest, ?> authenticationDetailsSource) Specifies a customAuthenticationDetailsSourceto use for basic authentication.authenticationEntryPoint(AuthenticationEntryPoint authenticationEntryPoint) TheAuthenticationEntryPointto be populated onBasicAuthenticationFilterin the event that authentication fails.voidConfigure theSecurityBuilderby setting the necessary properties on theSecurityBuilder.voidInitialize theSecurityBuilder.Allows easily changing the realm, but leaving the remaining defaults in place.Methods inherited from class org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
disable, getSecurityContextHolderStrategy, withObjectPostProcessorMethods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, and, getBuilder, postProcess, setBuilder
-
Constructor Details
-
HttpBasicConfigurer
public HttpBasicConfigurer()Creates a new instance- See Also:
-
-
Method Details
-
realmName
Allows easily changing the realm, but leaving the remaining defaults in place. IfauthenticationEntryPoint(AuthenticationEntryPoint)has been invoked, invoking this method will result in an error.- Parameters:
realmName- the HTTP Basic realm to use- Returns:
HttpBasicConfigurerfor additional customization
-
authenticationEntryPoint
public HttpBasicConfigurer<B> authenticationEntryPoint(AuthenticationEntryPoint authenticationEntryPoint) TheAuthenticationEntryPointto be populated onBasicAuthenticationFilterin the event that authentication fails. The default to useBasicAuthenticationEntryPointwith the realm "Realm".- Parameters:
authenticationEntryPoint- theAuthenticationEntryPointto use- Returns:
HttpBasicConfigurerfor additional customization
-
authenticationDetailsSource
public HttpBasicConfigurer<B> authenticationDetailsSource(AuthenticationDetailsSource<javax.servlet.http.HttpServletRequest, ?> authenticationDetailsSource) Specifies a customAuthenticationDetailsSourceto use for basic authentication. The default isWebAuthenticationDetailsSource.- Parameters:
authenticationDetailsSource- the customAuthenticationDetailsSourceto use- Returns:
HttpBasicConfigurerfor additional customization
-
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,B extends HttpSecurityBuilder<B>> - Overrides:
initin classSecurityConfigurerAdapter<DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>
-
configure
Description copied from interface:SecurityConfigurerConfigure theSecurityBuilderby setting the necessary properties on theSecurityBuilder.- Specified by:
configurein interfaceSecurityConfigurer<DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>> - Overrides:
configurein classSecurityConfigurerAdapter<DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>
-