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> java.util.concurrent.Callable<V>
runAsUser(java.lang.String username, java.util.concurrent.Callable<V> delegate)
          Delegates the given callable so that it can run in the context of the given user.
<V> java.util.concurrent.Callable<V>
runWithOptionalUserImpersonation(java.lang.String username, java.util.concurrent.Callable<V> delegate)
          Delegates the given runnable so that it can run in the context of the given user.
 

Method Detail

runAsUser

@NotNull
<V> java.util.concurrent.Callable<V> runAsUser(@NotNull
                                                       java.lang.String username,
                                                       @NotNull
                                                       java.util.concurrent.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:
java.lang.IllegalArgumentException - if username is invalid
java.lang.IllegalStateException - if it fails to set up the authentication correctly.

runWithOptionalUserImpersonation

@NotNull
<V> java.util.concurrent.Callable<V> runWithOptionalUserImpersonation(@Nullable
                                                                              java.lang.String username,
                                                                              @NotNull
                                                                              java.util.concurrent.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


Copyright © 2012 Atlassian. All Rights Reserved.