public final class SecurityContextCallableProcessingInterceptor
extends org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter
Allows for integration with Spring MVC's Callable support.
A CallableProcessingInterceptor that establishes the injected
SecurityContext on the SecurityContextHolder when
preProcess(NativeWebRequest, Callable) is invoked. It also clear out the
SecurityContextHolder by invoking SecurityContextHolder.clearContext()
in the postProcess(NativeWebRequest, Callable, Object) method.
| Constructor and Description |
|---|
SecurityContextCallableProcessingInterceptor()
Create a new
SecurityContextCallableProcessingInterceptor that uses the
SecurityContext from the SecurityContextHolder at the time
beforeConcurrentHandling(NativeWebRequest, Callable) is invoked. |
SecurityContextCallableProcessingInterceptor(SecurityContext securityContext)
Creates a new
SecurityContextCallableProcessingInterceptor with the
specified SecurityContext. |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
beforeConcurrentHandling(org.springframework.web.context.request.NativeWebRequest request,
java.util.concurrent.Callable<T> task) |
<T> void |
postProcess(org.springframework.web.context.request.NativeWebRequest request,
java.util.concurrent.Callable<T> task,
java.lang.Object concurrentResult) |
<T> void |
preProcess(org.springframework.web.context.request.NativeWebRequest request,
java.util.concurrent.Callable<T> task) |
public SecurityContextCallableProcessingInterceptor()
SecurityContextCallableProcessingInterceptor that uses the
SecurityContext from the SecurityContextHolder at the time
beforeConcurrentHandling(NativeWebRequest, Callable) is invoked.public SecurityContextCallableProcessingInterceptor(SecurityContext securityContext)
SecurityContextCallableProcessingInterceptor with the
specified SecurityContext.securityContext - the SecurityContext to set on the
SecurityContextHolder in preProcess(NativeWebRequest, Callable).
Cannot be null.java.lang.IllegalArgumentException - if SecurityContext is null.public <T> void beforeConcurrentHandling(org.springframework.web.context.request.NativeWebRequest request,
java.util.concurrent.Callable<T> task)
throws java.lang.Exception
beforeConcurrentHandling in interface org.springframework.web.context.request.async.CallableProcessingInterceptorbeforeConcurrentHandling in class org.springframework.web.context.request.async.CallableProcessingInterceptorAdapterjava.lang.Exceptionpublic <T> void preProcess(org.springframework.web.context.request.NativeWebRequest request,
java.util.concurrent.Callable<T> task)
throws java.lang.Exception
preProcess in interface org.springframework.web.context.request.async.CallableProcessingInterceptorpreProcess in class org.springframework.web.context.request.async.CallableProcessingInterceptorAdapterjava.lang.Exceptionpublic <T> void postProcess(org.springframework.web.context.request.NativeWebRequest request,
java.util.concurrent.Callable<T> task,
java.lang.Object concurrentResult)
throws java.lang.Exception
postProcess in interface org.springframework.web.context.request.async.CallableProcessingInterceptorpostProcess in class org.springframework.web.context.request.async.CallableProcessingInterceptorAdapterjava.lang.Exception