Class RequestCacheConfigurer<H extends HttpSecurityBuilder<H>>
java.lang.Object
org.springframework.security.config.annotation.SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>
org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer<RequestCacheConfigurer<H>,H>
org.springframework.security.config.annotation.web.configurers.RequestCacheConfigurer<H>
- All Implemented Interfaces:
SecurityConfigurer<DefaultSecurityFilterChain,
H>
public final class RequestCacheConfigurer<H extends HttpSecurityBuilder<H>>
extends AbstractHttpConfigurer<RequestCacheConfigurer<H>,H>
Adds request cache for Spring Security. Specifically this ensures that requests that
are saved (i.e. after authentication is required) are later replayed. All properties
have reasonable defaults, so no additional configuration is required other than
applying this
SecurityConfigurer
.
Security Filters
The following Filters are populatedShared Objects Created
No shared objects are created.Shared Objects Used
The following shared objects are used:- If no explicit
RequestCache
, is provided aRequestCache
shared object is used to replay the request after authentication is successful
- Since:
- 3.2
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Configure theSecurityBuilder
by setting the necessary properties on theSecurityBuilder
.disable()
Disables theAbstractHttpConfigurer
by removing it.void
Initialize theSecurityBuilder
.requestCache
(RequestCache requestCache) Allows explicit configuration of theRequestCache
to be used.Methods inherited from class org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
getSecurityContextHolderStrategy, withObjectPostProcessor, withObjectPostProcessor
Methods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, addObjectPostProcessor, and, getBuilder, postProcess, setBuilder
-
Constructor Details
-
RequestCacheConfigurer
public RequestCacheConfigurer()
-
-
Method Details
-
requestCache
Allows explicit configuration of theRequestCache
to be used. Defaults to try finding aRequestCache
as a shared object. Then falls back to aHttpSessionRequestCache
.- Parameters:
requestCache
- the explicitRequestCache
to use- Returns:
- the
RequestCacheConfigurer
for further customization
-
disable
Description copied from class:AbstractHttpConfigurer
Disables theAbstractHttpConfigurer
by removing it. After doing so a fresh version of the configuration can be applied.- Overrides:
disable
in classAbstractHttpConfigurer<RequestCacheConfigurer<H extends HttpSecurityBuilder<H>>,
H extends HttpSecurityBuilder<H>> - Returns:
- the
HttpSecurityBuilder
for additional customizations
-
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<DefaultSecurityFilterChain,
H extends HttpSecurityBuilder<H>> - Overrides:
init
in classSecurityConfigurerAdapter<DefaultSecurityFilterChain,
H extends HttpSecurityBuilder<H>>
-
configure
Description copied from interface:SecurityConfigurer
Configure theSecurityBuilder
by setting the necessary properties on theSecurityBuilder
.- Specified by:
configure
in interfaceSecurityConfigurer<DefaultSecurityFilterChain,
H extends HttpSecurityBuilder<H>> - Overrides:
configure
in classSecurityConfigurerAdapter<DefaultSecurityFilterChain,
H extends HttpSecurityBuilder<H>>
-