org.springframework.security.config.annotation
Class SecurityConfigurerAdapter<O,B extends SecurityBuilder<O>>

java.lang.Object
  extended by org.springframework.security.config.annotation.SecurityConfigurerAdapter<O,B>
Type Parameters:
O - The Object being built by B
B - The Builder that is building O and is configured by SecurityConfigurerAdapter
All Implemented Interfaces:
SecurityConfigurer<O,B>
Direct Known Subclasses:
AbstractAuthenticationFilterConfigurer, AbstractRequestMatcherConfigurer, AnonymousConfigurer, CsrfConfigurer, DefaultLoginPageConfigurer, ExceptionHandlingConfigurer, HeadersConfigurer, HttpBasicConfigurer, JeeConfigurer, LdapAuthenticationProviderConfigurer, LogoutConfigurer, PortMapperConfigurer, RememberMeConfigurer, RequestCacheConfigurer, SecurityContextConfigurer, ServletApiConfigurer, SessionManagementConfigurer, UserDetailsAwareConfigurer, X509Configurer

public abstract class SecurityConfigurerAdapter<O,B extends SecurityBuilder<O>>
extends Object
implements SecurityConfigurer<O,B>

A base class for SecurityConfigurer that allows subclasses to only implement the methods they are interested in. It also provides a mechanism for using the SecurityConfigurer and when done gaining access to the SecurityBuilder that is being configured.


Constructor Summary
SecurityConfigurerAdapter()
           
 
Method Summary
 void addObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
          Adds an ObjectPostProcessor to be used for this SecurityConfigurerAdapter.
 B and()
          Return the SecurityBuilder when done using the SecurityConfigurer.
 void configure(B builder)
          Configure the SecurityBuilder by setting the necessary properties on the SecurityBuilder.
protected  B getBuilder()
          Gets the SecurityBuilder.
 void init(B builder)
          Initialize the SecurityBuilder.
protected
<T> T
postProcess(T object)
          Performs post processing of an object.
 void setBuilder(B builder)
          Sets the SecurityBuilder to be used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityConfigurerAdapter

public SecurityConfigurerAdapter()
Method Detail

init

public void init(B builder)
          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<O,B extends SecurityBuilder<O>>
Throws:
Exception

configure

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

Specified by:
configure in interface SecurityConfigurer<O,B extends SecurityBuilder<O>>
Throws:
Exception

and

public B and()
Return the SecurityBuilder when done using the SecurityConfigurer. This is useful for method chaining.

Returns:

getBuilder

protected final B getBuilder()
Gets the SecurityBuilder. Cannot be null.

Returns:
the SecurityBuilder

postProcess

protected <T> T postProcess(T object)
Performs post processing of an object. The default is to delegate to the ObjectPostProcessor.

Parameters:
object - the Object to post process
Returns:
the possibly modified Object to use

addObjectPostProcessor

public void addObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
Adds an ObjectPostProcessor to be used for this SecurityConfigurerAdapter. The default implementation does nothing to the object.

Parameters:
objectPostProcessor - the ObjectPostProcessor to use

setBuilder

public void setBuilder(B builder)
Sets the SecurityBuilder to be used. This is automatically set when using AbstractConfiguredSecurityBuilder.apply(SecurityConfigurerAdapter)

Parameters:
builder - the SecurityBuilder to set