Class SecurityContextCallableProcessingInterceptor
- java.lang.Object
-
- org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter
-
- org.springframework.security.web.context.request.async.SecurityContextCallableProcessingInterceptor
-
- All Implemented Interfaces:
org.springframework.web.context.request.async.CallableProcessingInterceptor
public final class SecurityContextCallableProcessingInterceptor extends org.springframework.web.context.request.async.CallableProcessingInterceptorAdapterAllows for integration with Spring MVC's
Callablesupport.A
CallableProcessingInterceptorthat establishes the injectedSecurityContexton theSecurityContextHolderwhenpreProcess(NativeWebRequest, Callable)is invoked. It also clear out theSecurityContextHolderby invokingSecurityContextHolder.clearContext()in thepostProcess(NativeWebRequest, Callable, Object)method.- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description SecurityContextCallableProcessingInterceptor()Create a newSecurityContextCallableProcessingInterceptorthat uses theSecurityContextfrom theSecurityContextHolderat the timebeforeConcurrentHandling(NativeWebRequest, Callable)is invoked.SecurityContextCallableProcessingInterceptor(org.springframework.security.core.context.SecurityContext securityContext)Creates a newSecurityContextCallableProcessingInterceptorwith the specifiedSecurityContext.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> voidbeforeConcurrentHandling(org.springframework.web.context.request.NativeWebRequest request, java.util.concurrent.Callable<T> task)<T> voidpostProcess(org.springframework.web.context.request.NativeWebRequest request, java.util.concurrent.Callable<T> task, java.lang.Object concurrentResult)<T> voidpreProcess(org.springframework.web.context.request.NativeWebRequest request, java.util.concurrent.Callable<T> task)
-
-
-
Constructor Detail
-
SecurityContextCallableProcessingInterceptor
public SecurityContextCallableProcessingInterceptor()
Create a newSecurityContextCallableProcessingInterceptorthat uses theSecurityContextfrom theSecurityContextHolderat the timebeforeConcurrentHandling(NativeWebRequest, Callable)is invoked.
-
SecurityContextCallableProcessingInterceptor
public SecurityContextCallableProcessingInterceptor(org.springframework.security.core.context.SecurityContext securityContext)
Creates a newSecurityContextCallableProcessingInterceptorwith the specifiedSecurityContext.- Parameters:
securityContext- theSecurityContextto set on theSecurityContextHolderinpreProcess(NativeWebRequest, Callable). Cannot be null.- Throws:
java.lang.IllegalArgumentException- ifSecurityContextis null.
-
-
Method Detail
-
beforeConcurrentHandling
public <T> void beforeConcurrentHandling(org.springframework.web.context.request.NativeWebRequest request, java.util.concurrent.Callable<T> task)- Specified by:
beforeConcurrentHandlingin interfaceorg.springframework.web.context.request.async.CallableProcessingInterceptor- Overrides:
beforeConcurrentHandlingin classorg.springframework.web.context.request.async.CallableProcessingInterceptorAdapter
-
preProcess
public <T> void preProcess(org.springframework.web.context.request.NativeWebRequest request, java.util.concurrent.Callable<T> task)- Specified by:
preProcessin interfaceorg.springframework.web.context.request.async.CallableProcessingInterceptor- Overrides:
preProcessin classorg.springframework.web.context.request.async.CallableProcessingInterceptorAdapter
-
postProcess
public <T> void postProcess(org.springframework.web.context.request.NativeWebRequest request, java.util.concurrent.Callable<T> task, java.lang.Object concurrentResult)- Specified by:
postProcessin interfaceorg.springframework.web.context.request.async.CallableProcessingInterceptor- Overrides:
postProcessin classorg.springframework.web.context.request.async.CallableProcessingInterceptorAdapter
-
-