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 forSecurityConfigurer
that allows subclasses to only implement the methods they are interested in. It also provides a mechanism for using theSecurityConfigurer
and when done gaining access to theSecurityBuilder
that is being configured.
-
-
Constructor Summary
Constructors Constructor Description SecurityConfigurerAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
Adds anObjectPostProcessor
to be used for thisSecurityConfigurerAdapter
.B
and()
Return theSecurityBuilder
when done using theSecurityConfigurer
.void
configure(B builder)
Configure theSecurityBuilder
by setting the necessary properties on theSecurityBuilder
.protected B
getBuilder()
Gets theSecurityBuilder
.void
init(B builder)
Initialize theSecurityBuilder
.protected <T> T
postProcess(T object)
Performs post processing of an object.void
setBuilder(B builder)
Sets theSecurityBuilder
to be used.
-
-
-
Method Detail
-
init
public void init(B builder) throws java.lang.Exception
Description copied from interface:SecurityConfigurer
Initialize theSecurityBuilder
. Here only shared state should be created and modified, but not properties on theSecurityBuilder
used 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:
init
in interfaceSecurityConfigurer<O,B extends SecurityBuilder<O>>
- Throws:
java.lang.Exception
-
configure
public void configure(B builder) throws java.lang.Exception
Description copied from interface:SecurityConfigurer
Configure theSecurityBuilder
by setting the necessary properties on theSecurityBuilder
.- Specified by:
configure
in interfaceSecurityConfigurer<O,B extends SecurityBuilder<O>>
- Throws:
java.lang.Exception
-
and
public B and()
Return theSecurityBuilder
when done using theSecurityConfigurer
. This is useful for method chaining.- Returns:
- the
SecurityBuilder
for further customizations
-
getBuilder
protected final B getBuilder()
Gets theSecurityBuilder
. Cannot be null.- Returns:
- the
SecurityBuilder
- Throws:
java.lang.IllegalStateException
- ifSecurityBuilder
is 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 anObjectPostProcessor
to be used for thisSecurityConfigurerAdapter
. The default implementation does nothing to the object.- Parameters:
objectPostProcessor
- theObjectPostProcessor
to use
-
setBuilder
public void setBuilder(B builder)
Sets theSecurityBuilder
to be used. This is automatically set when usingAbstractConfiguredSecurityBuilder.apply(SecurityConfigurerAdapter)
- Parameters:
builder
- theSecurityBuilder
to set
-
-