org.springframework.security.web.context.request.async
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.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.
- Since:
- 3.2
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SecurityContextCallableProcessingInterceptor
public SecurityContextCallableProcessingInterceptor()
- Create a new
SecurityContextCallableProcessingInterceptor
that uses the SecurityContext
from the
SecurityContextHolder
at the time beforeConcurrentHandling(NativeWebRequest, Callable)
is invoked.
SecurityContextCallableProcessingInterceptor
public SecurityContextCallableProcessingInterceptor(SecurityContext securityContext)
- Creates a new
SecurityContextCallableProcessingInterceptor
with the specified SecurityContext
.
- Parameters:
securityContext
- the SecurityContext
to set on the SecurityContextHolder
in
preProcess(NativeWebRequest, Callable)
. Cannot be null.
- Throws:
IllegalArgumentException
- if SecurityContext
is null.
beforeConcurrentHandling
public <T> void beforeConcurrentHandling(NativeWebRequest request,
Callable<T> task)
throws Exception
- Specified by:
beforeConcurrentHandling
in interface org.springframework.web.context.request.async.CallableProcessingInterceptor
- Overrides:
beforeConcurrentHandling
in class org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter
- Throws:
Exception
preProcess
public <T> void preProcess(NativeWebRequest request,
Callable<T> task)
throws Exception
- Specified by:
preProcess
in interface org.springframework.web.context.request.async.CallableProcessingInterceptor
- Overrides:
preProcess
in class org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter
- Throws:
Exception
postProcess
public <T> void postProcess(NativeWebRequest request,
Callable<T> task,
Object concurrentResult)
throws Exception
- Specified by:
postProcess
in interface org.springframework.web.context.request.async.CallableProcessingInterceptor
- Overrides:
postProcess
in class org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter
- Throws:
Exception