Class HttpBasicConfigurer<B extends HttpSecurityBuilder<B>>
- java.lang.Object
-
- org.springframework.security.config.annotation.SecurityConfigurerAdapter<org.springframework.security.web.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<org.springframework.security.web.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 populatedBasicAuthenticationFilter
Shared Objects Created
- AuthenticationEntryPoint - populated with the
authenticationEntryPoint(AuthenticationEntryPoint)(defaultBasicAuthenticationEntryPoint)
Shared Objects Used
The following shared objects are used:AuthenticationManagerRememberMeServices
- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description HttpBasicConfigurer()Creates a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpBasicConfigurer<B>authenticationDetailsSource(org.springframework.security.authentication.AuthenticationDetailsSource<javax.servlet.http.HttpServletRequest,?> authenticationDetailsSource)Specifies a customAuthenticationDetailsSourceto use for basic authentication.HttpBasicConfigurer<B>authenticationEntryPoint(org.springframework.security.web.AuthenticationEntryPoint authenticationEntryPoint)TheAuthenticationEntryPointto be populated onBasicAuthenticationFilterin the event that authentication fails.voidconfigure(B http)Configure theSecurityBuilderby setting the necessary properties on theSecurityBuilder.voidinit(B http)Initialize theSecurityBuilder.HttpBasicConfigurer<B>realmName(java.lang.String realmName)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, withObjectPostProcessor
-
Methods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, and, getBuilder, postProcess, setBuilder
-
-
-
-
Constructor Detail
-
HttpBasicConfigurer
public HttpBasicConfigurer()
Creates a new instance- See Also:
HttpSecurity.httpBasic()
-
-
Method Detail
-
realmName
public HttpBasicConfigurer<B> realmName(java.lang.String 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(org.springframework.security.web.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(org.springframework.security.authentication.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
public void init(B http)
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<org.springframework.security.web.DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>- Overrides:
initin classSecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>
-
configure
public void configure(B http)
Description copied from interface:SecurityConfigurerConfigure theSecurityBuilderby setting the necessary properties on theSecurityBuilder.- Specified by:
configurein interfaceSecurityConfigurer<org.springframework.security.web.DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>- Overrides:
configurein classSecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>
-
-