Class SecurityContextConfigurer<H extends HttpSecurityBuilder<H>>
- java.lang.Object
-
- org.springframework.security.config.annotation.SecurityConfigurerAdapter<org.springframework.security.web.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<org.springframework.security.web.DefaultSecurityFilterChain,H>
public final class SecurityContextConfigurer<H extends HttpSecurityBuilder<H>> extends AbstractHttpConfigurer<SecurityContextConfigurer<H>,H>
Allows persisting and restoring of theSecurityContextfound on theSecurityContextHolderfor each request by configuring theSecurityContextPersistenceFilter. All properties have reasonable defaults, so no additional configuration is required other than applying thisSecurityConfigurer.Security Filters
The following Filters are populatedSecurityContextPersistenceFilter
Shared 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. SecurityContextRepositorymust be set and is used onSecurityContextPersistenceFilter.
- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description SecurityContextConfigurer()Creates a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(H http)Configure theSecurityBuilderby setting the necessary properties on theSecurityBuilder.SecurityContextConfigurer<H>requireExplicitSave(boolean requireExplicitSave)SecurityContextConfigurer<H>securityContextRepository(org.springframework.security.web.context.SecurityContextRepository securityContextRepository)Specifies the sharedSecurityContextRepositorythat is to be used-
Methods inherited from class org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
disable, getSecurityContextHolderStrategy, withObjectPostProcessor
-
Methods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, and, getBuilder, init, postProcess, setBuilder
-
-
-
-
Constructor Detail
-
SecurityContextConfigurer
public SecurityContextConfigurer()
Creates a new instance- See Also:
HttpSecurity.securityContext()
-
-
Method Detail
-
securityContextRepository
public SecurityContextConfigurer<H> securityContextRepository(org.springframework.security.web.context.SecurityContextRepository securityContextRepository)
Specifies the sharedSecurityContextRepositorythat is to be used- Parameters:
securityContextRepository- theSecurityContextRepositoryto use- Returns:
- the
HttpSecurityfor further customizations
-
requireExplicitSave
public SecurityContextConfigurer<H> requireExplicitSave(boolean requireExplicitSave)
-
configure
public void configure(H http)
Description copied from interface:SecurityConfigurerConfigure theSecurityBuilderby setting the necessary properties on theSecurityBuilder.- Specified by:
configurein interfaceSecurityConfigurer<org.springframework.security.web.DefaultSecurityFilterChain,H extends HttpSecurityBuilder<H>>- Overrides:
configurein classSecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,H extends HttpSecurityBuilder<H>>
-
-