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 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addObjectPostProcessor
(ObjectPostProcessor<?> objectPostProcessor) Deprecated, for removal: This API element is subject to removal in a future version.void
addObjectPostProcessor
(ObjectPostProcessor<?> objectPostProcessor) Adds anObjectPostProcessor
to be used for thisSecurityConfigurerAdapter
.and()
Deprecated, for removal: This API element is subject to removal in a future version.For removal in 7.0.void
Configure theSecurityBuilder
by setting the necessary properties on theSecurityBuilder
.protected final B
Gets theSecurityBuilder
.void
Initialize theSecurityBuilder
.protected <T> T
postProcess
(T object) Performs post processing of an object.void
setBuilder
(B builder) Sets theSecurityBuilder
to be used.
-
Constructor Details
-
SecurityConfigurerAdapter
public SecurityConfigurerAdapter()
-
-
Method Details
-
init
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:
Exception
-
configure
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:
Exception
-
and
Deprecated, for removal: This API element is subject to removal in a future version.For removal in 7.0. Use the lambda based configuration instead.Return theSecurityBuilder
when done using theSecurityConfigurer
. This is useful for method chaining.- Returns:
- the
SecurityBuilder
for further customizations
-
getBuilder
Gets theSecurityBuilder
. Cannot be null.- Returns:
- the
SecurityBuilder
- Throws:
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
Adds anObjectPostProcessor
to be used for thisSecurityConfigurerAdapter
. The default implementation does nothing to the object.- Parameters:
objectPostProcessor
- theObjectPostProcessor
to use
-
addObjectPostProcessor
@Deprecated(since="6.4", forRemoval=true) public void addObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor) Deprecated, for removal: This API element is subject to removal in a future version. -
setBuilder
Sets theSecurityBuilder
to be used. This is automatically set when usingAbstractConfiguredSecurityBuilder.apply(SecurityConfigurerAdapter)
- Parameters:
builder
- theSecurityBuilder
to set
-