Class SecurityContextConfigurer<H extends HttpSecurityBuilder<H>>
java.lang.Object
org.springframework.security.config.annotation.SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>
org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer<SecurityContextConfigurer<H>,H>
org.springframework.security.config.annotation.web.configurers.SecurityContextConfigurer<H>
- All Implemented Interfaces:
SecurityConfigurer<DefaultSecurityFilterChain,
H>
public final class SecurityContextConfigurer<H extends HttpSecurityBuilder<H>>
extends AbstractHttpConfigurer<SecurityContextConfigurer<H>,H>
Allows persisting and restoring of the
SecurityContext
found on the
SecurityContextHolder
for each request by configuring the
SecurityContextPersistenceFilter
. 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
SessionManagementConfigurer
, is provided and set to always, then theSecurityContextPersistenceFilter.setForceEagerSessionCreation(boolean)
will be set to true. SecurityContextRepository
must be set and is used onSecurityContextPersistenceFilter
.
- Since:
- 3.2
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Configure theSecurityBuilder
by setting the necessary properties on theSecurityBuilder
.requireExplicitSave
(boolean requireExplicitSave) securityContextRepository
(SecurityContextRepository securityContextRepository) Specifies the sharedSecurityContextRepository
that is to be usedMethods inherited from class org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
disable, getSecurityContextHolderStrategy, withObjectPostProcessor, withObjectPostProcessor
Methods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, addObjectPostProcessor, and, getBuilder, init, postProcess, setBuilder
-
Constructor Details
-
SecurityContextConfigurer
public SecurityContextConfigurer()Creates a new instance- See Also:
-
-
Method Details
-
securityContextRepository
public SecurityContextConfigurer<H> securityContextRepository(SecurityContextRepository securityContextRepository) Specifies the sharedSecurityContextRepository
that is to be used- Parameters:
securityContextRepository
- theSecurityContextRepository
to use- Returns:
- the
HttpSecurity
for further customizations
-
requireExplicitSave
-
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>>
-