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

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,852 views 27 11
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