We are integrating .net code to AEM.
In .net we have a method to get logged in User Roles. They are taking the same with below lines.
WindowsPrincipal winPrincipal = (WindowsPrincipal)HttpContext.Current.User;
In AEM we tried with
UserProperties userProps = request.adaptTo(UserProperties.class);
But it is not working, Do You have any suggestions here ?
You can pick the user properties from the Authorizable. Below is the code snippet of that.
ResourceResolver rr = request.getResourceResolver();
Authorizable userAuthorizable = rr.adaptTo(Authorizable.class);
String familyName = userAuthorizable.getProperty("email").toString();
Please let me know if this helps.
Do you have the LDAP integration in place? If yes, are you able to login through LDAP? Once the "windows user" logs in into aem, the user will be created in aem. You will be able to fetch the user details using the user Authorizable.
Hi @JeevanRaj :
We have implemented a LDAP code and deployed in AEM.
It was working fine in local instance with System.getProperty(user.name) and we were able to fetch our details.
But wen we deploy to our dev servers, this line of code is giving value as "aem" instead of actual windows login. I think we may need some more configuration to do in AEM.