How to get log in user infor in Confluence

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
Accepted answer

Hi !

this should work:

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

cheers

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

Hi,

have your tried to use :

AuthenticatedUserThreadLocal.getUser()

Thank Sandro, it realy works!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,059 views 16 14
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you