Class DelegatingSecurityContextExecutor
- java.lang.Object
-
- org.springframework.security.concurrent.DelegatingSecurityContextExecutor
-
- All Implemented Interfaces:
java.util.concurrent.Executor
- Direct Known Subclasses:
DelegatingSecurityContextExecutorService
,DelegatingSecurityContextTaskExecutor
public class DelegatingSecurityContextExecutor extends java.lang.Object implements java.util.concurrent.Executor
- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description DelegatingSecurityContextExecutor(java.util.concurrent.Executor delegate)
Creates a newDelegatingSecurityContextExecutor
that uses the currentSecurityContext
from theSecurityContextHolder
at the time the task is submitted.DelegatingSecurityContextExecutor(java.util.concurrent.Executor delegateExecutor, SecurityContext securityContext)
Creates a newDelegatingSecurityContextExecutor
that uses the specifiedSecurityContext
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(java.lang.Runnable task)
protected java.util.concurrent.Executor
getDelegateExecutor()
void
setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy)
Sets theSecurityContextHolderStrategy
to use.protected java.lang.Runnable
wrap(java.lang.Runnable delegate)
protected <T> java.util.concurrent.Callable<T>
wrap(java.util.concurrent.Callable<T> delegate)
-
-
-
Constructor Detail
-
DelegatingSecurityContextExecutor
public DelegatingSecurityContextExecutor(java.util.concurrent.Executor delegateExecutor, SecurityContext securityContext)
Creates a newDelegatingSecurityContextExecutor
that uses the specifiedSecurityContext
.- Parameters:
delegateExecutor
- theExecutor
to delegate to. Cannot be null.securityContext
- theSecurityContext
to use for eachDelegatingSecurityContextRunnable
or null to default to the currentSecurityContext
-
DelegatingSecurityContextExecutor
public DelegatingSecurityContextExecutor(java.util.concurrent.Executor delegate)
Creates a newDelegatingSecurityContextExecutor
that uses the currentSecurityContext
from theSecurityContextHolder
at the time the task is submitted.- Parameters:
delegate
- theExecutor
to delegate to. Cannot be null.
-
-
Method Detail
-
execute
public final void execute(java.lang.Runnable task)
- Specified by:
execute
in interfacejava.util.concurrent.Executor
-
getDelegateExecutor
protected final java.util.concurrent.Executor getDelegateExecutor()
-
setSecurityContextHolderStrategy
public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy)
Sets theSecurityContextHolderStrategy
to use. The default action is to use theSecurityContextHolderStrategy
stored inSecurityContextHolder
.- Since:
- 5.8
-
wrap
protected final java.lang.Runnable wrap(java.lang.Runnable delegate)
-
wrap
protected final <T> java.util.concurrent.Callable<T> wrap(java.util.concurrent.Callable<T> delegate)
-
-