This page describes how to access the logged in user when writing a Confluence app.
For Confluence versions prior to 5.2, the user can be retrieved from the class, which will give you the current logged in user as a object.
ConfluenceUser confluenceUser = AuthenticatedUserThreadLocal.get();
Note that if there is no logged in user, then the user object returned will be .
was deprecated in Confluence 5.2. For newer versions use .
Optional<ConfluenceUser> confluenceUser = AuthenticatedUserAccessor.get();
Which returns the currently authenticated , if any.