# Get authenticated user from the bloomreach application

**URL:** <https://community.bloomreach.com/t/get-authenticated-user-from-the-bloomreach-application/3977>\
**Category:** Uncategorized\
**Created:** [June 13, 2023, 5:20am UTC](https://community.bloomreach.com/t/get-authenticated-user-from-the-bloomreach-application/3977 "2023-06-13T05:20:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajamk](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@rajamk](https://community.bloomreach.com/u/rajamk)\
**Post date:** [June 13, 2023, 5:20am UTC](https://community.bloomreach.com/t/get-authenticated-user-from-the-bloomreach-application/3977/1 "2023-06-13T05:20:28Z")

</div>

Hello Team,

Get authenticated user from the bloomreach application.,

i) we can able to see the userdetails from active stream bloomreach - where it will be stored.  
II) how to get the those details - kindly help me to get those details.

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/2X/f/fd323f782b6433a827580a1cac6b12365220a987.png)

---

<div class="post-metadata">

**Author:** ![machak](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/machak/32/1298_2.png) [@machak](https://community.bloomreach.com/u/machak)\
**Post date:** [June 13, 2023, 8:07am UTC](https://community.bloomreach.com/t/get-authenticated-user-from-the-bloomreach-application/3977/2 "2023-06-13T08:07:50Z")

</div>

I am not sure which details you mean? We don’t have much user details except user name…  
User activity data is stored into event log:

> **[Repository Event Log - Bloomreach Experience Manager (PaaS/Self-Hosted) - The...](https://xmdocumentation.bloomreach.com/library/concepts/content-repository/repository-event-log.html)**
>
> The fast and flexible on-premise or PaaS headless CMS

somewhat related:

> **[Enable Audit Logging - Bloomreach Experience Manager (PaaS/Self-Hosted) - The...](https://xmdocumentation.bloomreach.com/library/concepts/security/enable-audit-logging.html)**
>
> The fast and flexible on-premise or PaaS headless CMS

[Event Bus - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS](https://xmdocumentation.bloomreach.com/library/concepts/services/event-bus.html) (if you need custom events)

---

<div class="post-metadata">

**Author:** ![rajamk](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@rajamk](https://community.bloomreach.com/u/rajamk)\
**Post date:** [June 13, 2023, 10:10am UTC](https://community.bloomreach.com/t/get-authenticated-user-from-the-bloomreach-application/3977/3 "2023-06-13T10:10:36Z")

</div>

Thanks for the quick response…

How to get the username. kindly help to get the username - needs to use for the logs in published/unpublished content in the username.

---

<div class="post-metadata">

**Author:** ![jasper.floor](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jasper.floor/32/28_2.png) [@jasper.floor](https://community.bloomreach.com/u/jasper.floor)\
**Post date:** [June 13, 2023, 1:05pm UTC](https://community.bloomreach.com/t/get-authenticated-user-from-the-bloomreach-application/3977/4 "2023-06-13T13:05:56Z")

</div>

From what context do you need the user name? If it’s in the context of a logged in user, then you can get it from the UserSession. I think something like:

```auto
UserSession.get().getJcrSession().getUser().getId()

```

Otherwise there is usually a userid on whatever data you are processing. Log events should have a property saynig what user is responsible. Off the top of my head I don’t remember what the property is called, but it shouldn’t be too hard to find out by looking at the events.

---

<div class="post-metadata">

**Author:** ![rajamk](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@rajamk](https://community.bloomreach.com/u/rajamk)\
**Post date:** [June 14, 2023, 5:14am UTC](https://community.bloomreach.com/t/get-authenticated-user-from-the-bloomreach-application/3977/5 "2023-06-14T05:14:30Z")

</div>

Hello Jasper,  
I have tried below code as you suggested but getting package does not exist exception because its available in some other package. kindly help to resolve this…  
import org.onehippo.forge.webservices.jaxrs.jcr.util.JcrSessionUtil;

UserSession.get().getJcrSession().getUser().getId()

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/2X/7/7abfca39666dfc084e0a559c3273ba49c641f153.png)

---

<div class="post-metadata">

**Author:** ![jasper.floor](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jasper.floor/32/28_2.png) [@jasper.floor](https://community.bloomreach.com/u/jasper.floor)\
**Post date:** [June 15, 2023, 11:00am UTC](https://community.bloomreach.com/t/get-authenticated-user-from-the-bloomreach-application/3977/6 "2023-06-15T11:00:17Z")

</div>

I don’t think any of the classes I referenced should come from that package.

org.hippoecm.frontend.session.UserSession  
org.hippoecm.repository.api.HippoSession  
org.onehippo.repository.security.SessionUser

---

<div class="post-metadata">

**Author:** ![rajamk](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@rajamk](https://community.bloomreach.com/u/rajamk)\
**Post date:** [June 19, 2023, 5:47am UTC](https://community.bloomreach.com/t/get-authenticated-user-from-the-bloomreach-application/3977/7 "2023-06-19T05:47:39Z")

</div>

import org.hippoecm.frontend.session.UserSession;

Kindly share related dependency because while use this import getting package doesn’t getting exception…
