Get authenticated user from the bloomreach application

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.

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:

somewhat related:

Event Bus - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS (if you need custom events)

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.

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:

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.

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()

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

import org.hippoecm.frontend.session.UserSession;

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