org.springframework.security.config.annotation.web.configurers
Class HttpBasicConfigurer<B extends HttpSecurityBuilder<B>>

java.lang.Object
  extended by org.springframework.security.config.annotation.SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>
      extended by org.springframework.security.config.annotation.web.configurers.HttpBasicConfigurer<B>
All Implemented Interfaces:
SecurityConfigurer<DefaultSecurityFilterChain,B>

public final class HttpBasicConfigurer<B extends HttpSecurityBuilder<B>>
extends SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>

Adds HTTP basic based authentication. All attributes have reasonable defaults making all parameters are optional.

Security Filters

The following Filters are populated

Shared Objects Created

Shared Objects Used

The following shared objects are used:

Since:
3.2

Constructor Summary
HttpBasicConfigurer()
          Creates a new instance
 
Method Summary
 HttpBasicConfigurer<B> authenticationDetailsSource(AuthenticationDetailsSource<javax.servlet.http.HttpServletRequest,?> authenticationDetailsSource)
          Specifies a custom AuthenticationDetailsSource to use for basic authentication.
 HttpBasicConfigurer<B> authenticationEntryPoint(AuthenticationEntryPoint authenticationEntryPoint)
          The AuthenticationEntryPoint to be po pulated on BasicAuthenticationFilter in the event that authentication fails.
 void configure(B http)
          Configure the SecurityBuilder by setting the necessary properties on the SecurityBuilder.
 B disable()
          Disables the AbstractHttpConfigurer by removing it.
 void init(B http)
          Initialize the SecurityBuilder.
 HttpBasicConfigurer<B> realmName(String realmName)
          Shortcut for authenticationEntryPoint(AuthenticationEntryPoint) specifying a BasicAuthenticationEntryPoint with the specified realm name.
 T withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
           
 
Methods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, and, getBuilder, postProcess, setBuilder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpBasicConfigurer

public HttpBasicConfigurer()
                    throws Exception
Creates a new instance

Throws:
Exception
See Also:
HttpSecurity#httpBasic()}
Method Detail

realmName

public HttpBasicConfigurer<B> realmName(String realmName)
                                                                throws Exception
Shortcut for authenticationEntryPoint(AuthenticationEntryPoint) specifying a BasicAuthenticationEntryPoint with the specified realm name.

Parameters:
realmName - the HTTP Basic realm to use
Returns:
HttpBasicConfigurer for additional customization
Throws:
Exception

authenticationEntryPoint

public HttpBasicConfigurer<B> authenticationEntryPoint(AuthenticationEntryPoint authenticationEntryPoint)
The AuthenticationEntryPoint to be po pulated on BasicAuthenticationFilter in the event that authentication fails. The default to use BasicAuthenticationEntryPoint with the realm "Spring Security Application".

Parameters:
authenticationEntryPoint - the AuthenticationEntryPoint to use
Returns:
HttpBasicConfigurer for additional customization

authenticationDetailsSource

public HttpBasicConfigurer<B> authenticationDetailsSource(AuthenticationDetailsSource<javax.servlet.http.HttpServletRequest,?> authenticationDetailsSource)
Specifies a custom AuthenticationDetailsSource to use for basic authentication. The default is WebAuthenticationDetailsSource.

Parameters:
authenticationDetailsSource - the custom AuthenticationDetailsSource to use
Returns:
HttpBasicConfigurer for additional customization

init

public void init(B http)
          throws Exception
Description copied from interface: SecurityConfigurer
Initialize the 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.

Specified by:
init in interface SecurityConfigurer<DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>
Overrides:
init in class SecurityConfigurerAdapter<DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>
Throws:
Exception

configure

public void configure(B http)
               throws Exception
Description copied from interface: SecurityConfigurer
Configure the SecurityBuilder by setting the necessary properties on the SecurityBuilder.

Specified by:
configure in interface SecurityConfigurer<DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>
Overrides:
configure in class SecurityConfigurerAdapter<DefaultSecurityFilterChain,B extends HttpSecurityBuilder<B>>
Throws:
Exception

disable

public B disable()
Disables the AbstractHttpConfigurer by removing it. After doing so a fresh version of the configuration can be applied.

Returns:
the HttpSecurityBuilder for additional customizations

withObjectPostProcessor

public T withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)