public final class SecurityContextConfigurer<H extends HttpSecurityBuilder<H>> extends SecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,B>
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.
SecurityContextPersistenceFilterSessionManagementConfigurer, is provided and set to always, then the
SecurityContextPersistenceFilter.setForceEagerSessionCreation(boolean) will be
set to true.SecurityContextRepository must be set and is used on
SecurityContextPersistenceFilter.| Constructor and Description |
|---|
SecurityContextConfigurer()
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
void |
configure(H http)
Configure the
SecurityBuilder by setting the necessary properties on the
SecurityBuilder. |
B |
disable()
Disables the
AbstractHttpConfigurer by removing it. |
SecurityContextConfigurer<H> |
securityContextRepository(org.springframework.security.web.context.SecurityContextRepository securityContextRepository)
Specifies the shared
SecurityContextRepository that is to be used |
T |
withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor) |
addObjectPostProcessor, and, getBuilder, init, postProcess, setBuilderpublic SecurityContextConfigurer()
HttpSecurity.securityContext()public SecurityContextConfigurer<H> securityContextRepository(org.springframework.security.web.context.SecurityContextRepository securityContextRepository)
SecurityContextRepository that is to be usedsecurityContextRepository - the SecurityContextRepository to useHttpSecurity for further customizationspublic void configure(H http) throws Exception
SecurityConfigurerSecurityBuilder by setting the necessary properties on the
SecurityBuilder.configure in interface SecurityConfigurer<org.springframework.security.web.DefaultSecurityFilterChain,H extends HttpSecurityBuilder<H>>configure in class SecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,H extends HttpSecurityBuilder<H>>Exceptionpublic B disable()
AbstractHttpConfigurer by removing it. After doing so a fresh
version of the configuration can be applied.HttpSecurityBuilder for additional customizationspublic T withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)