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
<V> Callable<V>
runAsUser(String username, Callable<V> delegate)
          Delegates the given callable so that it can run in the context of the given user.
 void runWith(org.acegisecurity.Authentication authentication, BambooRunnables.NotThrowing notThrowing)
          Runs a given Bamboo runnable with supplied Authentication.
<V> Callable<V>
runWithAuthenticationImpersonation(org.acegisecurity.Authentication authentication, Callable<V> delegate)
          Deprecated. since 5.4 use @{link ImpersonationHelper} instead
<V> Callable<V>
runWithOptionalUserImpersonation(String username, Callable<V> delegate)
          Delegates the given runnable so that it can run in the context of the given user.
 

Method Detail

runAsUser

@NotNull
<V> 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. 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 invalid
IllegalStateException - if it fails to set up the authentication correctly.

runWithOptionalUserImpersonation

@NotNull
<V> 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. If use context can not be set it will execute the callable regardless.

Parameters:
username - (optional) to set the authentication context to
delegate - callable to execute in the new context
Returns:
callable

runWithAuthenticationImpersonation

@NotNull
@Deprecated
<V> Callable<V> runWithAuthenticationImpersonation(@NotNull
                                                                      org.acegisecurity.Authentication authentication,
                                                                      @NotNull
                                                                      Callable<V> delegate)
Deprecated. since 5.4 use @{link ImpersonationHelper} instead

Delegates the given runnable so that it can run in the context of a given authentication.

Parameters:
authentication - to set the authentication context to
delegate - callable to execute in the new context
Returns:
callable

runWith

void runWith(@NotNull
             org.acegisecurity.Authentication authentication,
             @NotNull
             BambooRunnables.NotThrowing notThrowing)
Runs a given Bamboo runnable with supplied Authentication.



Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.