Package com.atlassian.confluence.user
Class AuthenticatedUserThreadLocal
java.lang.Object
com.atlassian.confluence.user.AuthenticatedUserThreadLocal
A simple ThreadLocal to store the currently authenticated user. This can be used when the user comes
 from something other than the web interface (i.e. SOAP).
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic AutoCloseableasUser(ConfluenceUser user) Deprecated.static voidasUser(ConfluenceUser user, Runnable task) Executes the givenRunnablewith the given thread-local User.static <T> TasUser(ConfluenceUser user, Callable<T> task) Executes the givenCallablewith the given thread-local User.static ConfluenceUserget()static com.atlassian.user.UsergetUser()Deprecated.since 5.2.static Stringstatic booleanstatic voidreset()Remove any user from the current contextstatic voidset(ConfluenceUser user) static voidsetUser(com.atlassian.user.User user) Deprecated.since 5.2. 
- 
Constructor Details
- 
AuthenticatedUserThreadLocal
public AuthenticatedUserThreadLocal() 
 - 
 - 
Method Details
- 
set
- Since:
 - 5.2
 
 - 
setUser
Deprecated.since 5.2. Useset(ConfluenceUser)instead. - 
get
- Returns:
 - the currently authenticated user, null if anonymous user
 - Since:
 - 5.2
 
 - 
getUser
Deprecated.since 5.2. Useget()instead.- Returns:
 - the currently authenticated user, null if anonymous user
 
 - 
reset
public static void reset()Remove any user from the current context - 
getUsername
 - 
isAnonymousUser
public static boolean isAnonymousUser()- Returns:
 - true if anonymous user
 - Since:
 - 5.3.1
 
 - 
asUser
Deprecated.since 7.14 PreferasUser(ConfluenceUser, Runnable)orasUser(ConfluenceUser, Callable) - 
asUser
Executes the givenRunnablewith the given thread-local User.- Since:
 - 7.14
 
 - 
asUser
Executes the givenCallablewith the given thread-local User.- Throws:
 Exception- Since:
 - 7.14
 
 
 - 
 
asUser(ConfluenceUser, Runnable)orasUser(ConfluenceUser, Callable)