How to get log in user infor in Confluence

Sreylin Doung September 30, 2012

Dear All,

I want to get the information of user who is currently logging in Confluence 4.3 from my plugin. As I have tried to search, the RemoteUser API is proper for this problem. But when I tried to use this api, the problem occurs. Also, I tried to find out the document of the API usage, but I cannot find.So my question is:

- Does RemoteUser API is the proper api in order to get informaiton of currently login user in Confluence? if not, I hope you could point out the way to solve this poblem. If yes, I hope you could tell me how to use this API.

Thanks in advance,

2 answers

1 accepted

0 votes
Answer accepted
Thomas Kalsberger, MSc September 30, 2012

Hi !

this should work:

HttpServletRequest request = ServletActionContext.getRequest();
String remoteUserName = request.getRemoteUser();
  
or:
             
this.remoteUser = AuthenticatedUserThreadLocal.getUser();

cheers

Sreylin Doung October 1, 2012

I tried the these two ways. They all work properly! Thanks you so much, Thomas.

0 votes
Sandro Herrmann [Communardo]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 30, 2012

Hi,

have your tried to use :

AuthenticatedUserThreadLocal.getUser()

Sreylin Doung October 1, 2012

Thank Sandro, it realy works!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events