public final class SecurityContextCallableProcessingInterceptor extends 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.
RESPONSE_HANDLED, RESULT_NONE
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(NativeWebRequest request,
Callable<T> task) |
<T> void |
postProcess(NativeWebRequest request,
Callable<T> task,
Object concurrentResult) |
<T> void |
preProcess(NativeWebRequest request,
Callable<T> task) |
afterCompletion, handleTimeout
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.IllegalArgumentException
- if SecurityContext
is null.public <T> void beforeConcurrentHandling(NativeWebRequest request, Callable<T> task) throws Exception
beforeConcurrentHandling
in interface CallableProcessingInterceptor
beforeConcurrentHandling
in class CallableProcessingInterceptorAdapter
Exception
public <T> void preProcess(NativeWebRequest request, Callable<T> task) throws Exception
preProcess
in interface CallableProcessingInterceptor
preProcess
in class CallableProcessingInterceptorAdapter
Exception
public <T> void postProcess(NativeWebRequest request, Callable<T> task, Object concurrentResult) throws Exception
postProcess
in interface CallableProcessingInterceptor
postProcess
in class CallableProcessingInterceptorAdapter
Exception