org.springframework.security.config.annotation.web.configurers
Class SecurityContextConfigurer<H extends HttpSecurityBuilder<H>>

java.lang.Object
  extended by org.springframework.security.config.annotation.SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>
      extended by org.springframework.security.config.annotation.web.configurers.SecurityContextConfigurer<H>
All Implemented Interfaces:
SecurityConfigurer<DefaultSecurityFilterChain,H>

public final class SecurityContextConfigurer<H extends HttpSecurityBuilder<H>>
extends SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>

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 populated

Shared Objects Created

No shared objects are created.

Shared Objects Used

The following shared objects are used:

Since:
3.2

Constructor Summary
SecurityContextConfigurer()
          Creates a new instance
 
Method Summary
 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(SecurityContextRepository securityContextRepository)
          Specifies the shared SecurityContextRepository that is to be used
 T withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
           
 
Methods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, and, getBuilder, init, postProcess, setBuilder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityContextConfigurer

public SecurityContextConfigurer()
Creates a new instance

See Also:
HttpSecurity.securityContext()
Method Detail

securityContextRepository

public SecurityContextConfigurer<H> securityContextRepository(SecurityContextRepository securityContextRepository)
Specifies the shared SecurityContextRepository that is to be used

Parameters:
securityContextRepository - the SecurityContextRepository to use
Returns:
the HttpSecurity for further customizations

configure

public void configure(H http)
               throws Exception
Description copied from interface: SecurityConfigurer
Configure the SecurityBuilder by setting the necessary properties on the SecurityBuilder.

Specified by:
configure in interface SecurityConfigurer<DefaultSecurityFilterChain,H extends HttpSecurityBuilder<H>>
Overrides:
configure in class SecurityConfigurerAdapter<DefaultSecurityFilterChain,H extends HttpSecurityBuilder<H>>
Throws:
Exception

disable

public B disable()
Disables the AbstractHttpConfigurer by removing it. After doing so a fresh version of the configuration can be applied.

Returns:
the HttpSecurityBuilder for additional customizations

withObjectPostProcessor

public T withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)