I have got the session from the repository login (using username and password), now how to access the profile of the user from the session(/home/users/username/profile). In the end, I need user properties. The request could not be adopted to user properties since its still pointing to the anonymous user.
Solved! Go to Solution.
Dear Sharat,
Thank you for your quick response,
You should be able to adapt org.apache.jackrabbit.api.JackrabbitSession to Authorisable[1] and retrieve property you want.
E.g. instead of adapting to request, adapt to the session which holds user information you want to present.
[1] Authorizable (Apache Jackrabbit 2.6.10 API)
Regards,
Peter
Views
Replies
Total Likes
Dear Sharat,
Just to clarify,
When request comes in the user is not authenticated and is anonymous user. E.g. did not do any authorisation.
You want to serve user properties of another user(possibly system user) who is authenticated into repository to anonymous user?
Regards,
Peter
Views
Replies
Total Likes
When the request comes in, the user is trying to signup. I want to access the same user properties( Node ) from the session which i got from the repository login (which call the External login module and creates the same user in aem) .
Views
Replies
Total Likes
Dear Sharat,
Thank you for your quick response,
You should be able to adapt org.apache.jackrabbit.api.JackrabbitSession to Authorisable[1] and retrieve property you want.
E.g. instead of adapting to request, adapt to the session which holds user information you want to present.
[1] Authorizable (Apache Jackrabbit 2.6.10 API)
Regards,
Peter
Views
Replies
Total Likes
I dont know why you need the path but you can get the value,
I am getting logged in user property like this..(i am using AEM 6.2 )
Session session = slingRequest.getResourceResolver().adaptTo(Session.class);
UserManager userManager = AccessControlUtil.getUserManager(session);
if (session != null) {
final User currentUser = (User) userManager.getAuthorizable(session.getUserID());
userEmail = currentUser.getProperty(USER_EMAIL) != null ? currentUser.getProperty(USER_EMAIL)[0].getString() : null;
userName = currentUser.getProperty(USER_NAME) != null ? currentUser.getProperty(USER_NAME)[0].getString() : null;
here
USER_NAME = "./profile/familyName";
USER_EMAIL = "./profile/email";
rest properties you can look in crx /home/users/geometrixx/aparker@geometrixx.info/profile
same way you can get others also
Thanks !!
This is what i came up with
JackrabbitSession jaSession = (JackrabbitSession) session;
UserManager auth = jaSession.getUserManager();
Authorizable authorizable = auth.getAuthorizable(session.getUserID());
Then u can easily access the user path from there.
Views
Replies
Total Likes
Views
Likes
Replies