Last updatedSep 10, 2019

Rate this page:

How do I find the logged in user?

This page describes how to access the logged in user when writing a Confluence app.

Confluence prior to 5.2

For Confluence versions prior to 5.2, the user can be retrieved from the com.atlassian.confluence.user.AuthenticatedUserThreadLocal class, which will give you the current logged in user as a com.atlassian.confluence.user.ConfluenceUser object.

ConfluenceUser confluenceUser = AuthenticatedUserThreadLocal.get();

Note that if there is no logged in user, then the user object returned will be null.

Confluence 5.2 and above

AuthenticatedUserThreadLocal was deprecated in Confluence 5.2. For newer versions use com.atlassian.confluence.user.AuthenticatedUserAccessor.

Optional<ConfluenceUser> confluenceUser = AuthenticatedUserAccessor.get();

Which returns the currently authenticated com.atlassian.confluence.user.ConfluenceUser, if any.

Rate this page: