com.atlassian.bamboo.applinks
Class ImpersonationServiceImpl

java.lang.Object
  extended by com.atlassian.bamboo.applinks.ImpersonationServiceImpl
All Implemented Interfaces:
ImpersonationService

public class ImpersonationServiceImpl
extends java.lang.Object
implements ImpersonationService


Field Summary
static java.lang.String USER_TOKEN_KEY
           
 
Constructor Summary
ImpersonationServiceImpl(BambooUserManager bambooUserManager)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_TOKEN_KEY

public static final java.lang.String USER_TOKEN_KEY
See Also:
Constant Field Values
Constructor Detail

ImpersonationServiceImpl

public ImpersonationServiceImpl(BambooUserManager bambooUserManager)
Method Detail

runAsUser

@NotNull
public <V> java.util.concurrent.Callable<V> runAsUser(@NotNull
                                                              java.lang.String username,
                                                              @NotNull
                                                              java.util.concurrent.Callable<V> delegate)
Description copied from interface: ImpersonationService
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.

Specified by:
runAsUser in interface ImpersonationService
Parameters:
username - username to set the authentication context to.
delegate - callable to execute in the new context
Returns:
callable

runWithOptionalUserImpersonation

@NotNull
public <V> java.util.concurrent.Callable<V> runWithOptionalUserImpersonation(@Nullable
                                                                                     java.lang.String username,
                                                                                     @NotNull
                                                                                     java.util.concurrent.Callable<V> delegate)
Description copied from interface: ImpersonationService
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.

Specified by:
runWithOptionalUserImpersonation in interface ImpersonationService
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.