public final class DelegatingSecurityContextCallable<V> extends Object implements Callable<V>
Callable with logic for setting up a SecurityContext before invoking the delegate
Callable and then removing the SecurityContext after the delegate has completed.| Constructor and Description |
|---|
DelegatingSecurityContextCallable(Callable<V> delegate)
Creates a new
DelegatingSecurityContextCallable with the SecurityContext from the
SecurityContextHolder. |
DelegatingSecurityContextCallable(Callable<V> delegate,
SecurityContext securityContext)
Creates a new
DelegatingSecurityContextCallable with a specific SecurityContext. |
| Modifier and Type | Method and Description |
|---|---|
V |
call() |
static <V> Callable<V> |
create(Callable<V> delegate,
SecurityContext securityContext)
Creates a
DelegatingSecurityContextCallable and with the given Callable and
SecurityContext, but if the securityContext is null will defaults to the current SecurityContext
on the SecurityContextHolder |
public DelegatingSecurityContextCallable(Callable<V> delegate, SecurityContext securityContext)
DelegatingSecurityContextCallable with a specific SecurityContext.delegate - the delegate DelegatingSecurityContextCallable to run with the specified
SecurityContext. Cannot be null.securityContext - the SecurityContext to establish for the delegate Callable. Cannot be
null.public DelegatingSecurityContextCallable(Callable<V> delegate)
DelegatingSecurityContextCallable with the SecurityContext from the
SecurityContextHolder.delegate - the delegate Callable to run under the current SecurityContext. Cannot be null.public static <V> Callable<V> create(Callable<V> delegate, SecurityContext securityContext)
DelegatingSecurityContextCallable and with the given Callable and
SecurityContext, but if the securityContext is null will defaults to the current SecurityContext
on the SecurityContextHolderdelegate - the delegate DelegatingSecurityContextCallable to run with the specified
SecurityContext. Cannot be null.securityContext - the SecurityContext to establish for the delegate Callable. If null,
defaults to SecurityContextHolder.getContext()