Package com.atlassian.bamboo.applinks
Interface ImpersonationService
-
- All Known Implementing Classes:
ImpersonationServiceImpl
public interface ImpersonationService
Allows you to run something in the context of a user A replica of this exists in the Jira Bamboo Plugin.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description <V> @NotNull Callable<V>
runAsUser(@NotNull String username, @NotNull Callable<V> delegate)
Delegates the given callable so that it can run in the context of the given user.void
runWith(@NotNull org.acegisecurity.Authentication authentication, BambooRunnables.NotThrowing notThrowing)
Runs a given Bamboo runnable with supplied Authentication.<V> @NotNull Callable<V>
runWithAuthenticationImpersonation(@NotNull org.acegisecurity.Authentication authentication, @NotNull Callable<V> delegate)
Deprecated.since 5.4 use @{link ImpersonationHelper} instead<V> @NotNull Callable<V>
runWithOptionalUserImpersonation(@Nullable String username, @NotNull Callable<V> delegate)
Delegates the given runnable so that it can run in the context of the given user.
-
-
-
Method Detail
-
runAsUser
@NotNull <V> @NotNull Callable<V> runAsUser(@NotNull @NotNull String username, @NotNull @NotNull Callable<V> delegate)
Delegates the given callable so that it can run in the context of the given user. If the context can not be set to the given user it will fail.- Parameters:
username
- username to set the authentication context to.delegate
- callable to execute in the new context- Returns:
- callable
- Throws:
IllegalArgumentException
- if username is invalidIllegalStateException
- if it fails to set up the authentication correctly.
-
runWithOptionalUserImpersonation
@NotNull <V> @NotNull Callable<V> runWithOptionalUserImpersonation(@Nullable @Nullable String username, @NotNull @NotNull Callable<V> delegate)
Delegates the given runnable so that it can run in the context of the given user. If use context can not be set it will execute the callable regardless.- Parameters:
username
- (optional) to set the authentication context todelegate
- callable to execute in the new context- Returns:
- callable
-
runWithAuthenticationImpersonation
@NotNull @Deprecated <V> @NotNull Callable<V> runWithAuthenticationImpersonation(@NotNull @NotNull org.acegisecurity.Authentication authentication, @NotNull @NotNull Callable<V> delegate)
Deprecated.since 5.4 use @{link ImpersonationHelper} insteadDelegates the given runnable so that it can run in the context of a given authentication.- Parameters:
authentication
- to set the authentication context todelegate
- callable to execute in the new context- Returns:
- callable
-
runWith
void runWith(@NotNull @NotNull org.acegisecurity.Authentication authentication, @NotNull BambooRunnables.NotThrowing notThrowing)
Runs a given Bamboo runnable with supplied Authentication.
-
-