Class SecurityConfigurerAdapter<O,B extends SecurityBuilder<O>>
- java.lang.Object
-
- org.springframework.security.config.annotation.SecurityConfigurerAdapter<O,B>
-
- Type Parameters:
O- The Object being built by BB- The Builder that is building O and is configured bySecurityConfigurerAdapter
- All Implemented Interfaces:
SecurityConfigurer<O,B>
- Direct Known Subclasses:
AbstractHttpConfigurer,LdapAuthenticationProviderConfigurer,UserDetailsAwareConfigurer
public abstract class SecurityConfigurerAdapter<O,B extends SecurityBuilder<O>> extends java.lang.Object implements SecurityConfigurer<O,B>
A base class forSecurityConfigurerthat allows subclasses to only implement the methods they are interested in. It also provides a mechanism for using theSecurityConfigurerand when done gaining access to theSecurityBuilderthat is being configured.
-
-
Constructor Summary
Constructors Constructor Description SecurityConfigurerAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)Adds anObjectPostProcessorto be used for thisSecurityConfigurerAdapter.Band()Return theSecurityBuilderwhen done using theSecurityConfigurer.voidconfigure(B builder)Configure theSecurityBuilderby setting the necessary properties on theSecurityBuilder.protected BgetBuilder()Gets theSecurityBuilder.voidinit(B builder)Initialize theSecurityBuilder.protected <T> TpostProcess(T object)Performs post processing of an object.voidsetBuilder(B builder)Sets theSecurityBuilderto be used.
-
-
-
Method Detail
-
init
public void init(B builder) throws java.lang.Exception
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<O,B extends SecurityBuilder<O>>- Throws:
java.lang.Exception
-
configure
public void configure(B builder) throws java.lang.Exception
Description copied from interface:SecurityConfigurerConfigure theSecurityBuilderby setting the necessary properties on theSecurityBuilder.- Specified by:
configurein interfaceSecurityConfigurer<O,B extends SecurityBuilder<O>>- Throws:
java.lang.Exception
-
and
public B and()
Return theSecurityBuilderwhen done using theSecurityConfigurer. This is useful for method chaining.- Returns:
- the
SecurityBuilderfor further customizations
-
getBuilder
protected final B getBuilder()
Gets theSecurityBuilder. Cannot be null.- Returns:
- the
SecurityBuilder - Throws:
java.lang.IllegalStateException- ifSecurityBuilderis null
-
postProcess
protected <T> T postProcess(T object)
Performs post processing of an object. The default is to delegate to theObjectPostProcessor.- Parameters:
object- the Object to post process- Returns:
- the possibly modified Object to use
-
addObjectPostProcessor
public void addObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
Adds anObjectPostProcessorto be used for thisSecurityConfigurerAdapter. The default implementation does nothing to the object.- Parameters:
objectPostProcessor- theObjectPostProcessorto use
-
setBuilder
public void setBuilder(B builder)
Sets theSecurityBuilderto be used. This is automatically set when usingAbstractConfiguredSecurityBuilder.apply(SecurityConfigurerAdapter)- Parameters:
builder- theSecurityBuilderto set
-
-