Expand my Community achievements bar.

Need LDAP user details in AEM JAVA service

Avatar

Level 6

Hi Team,

 

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);
 userProps.getProperty("roles");

 But it is not working, Do You have any suggestions here ?

5 Replies

Avatar

Level 7

Does the node property exists, when you take a look in CRX?

Avatar

Community Advisor

Hi @akhilraj 

 

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.

 

Thanks

Jeevan

Avatar

Level 6

Hi @JeevanRaj and @Magicr ,

 

Actually this user is not AEM user. It is kind of windows user and we have to fetch his role, like, developer /Manager/ Executive etc.

I believe we need to integrate LDAP mechanism here.

 

 

Avatar

Community Advisor

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.

Avatar

Level 6

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.

 

Any idea?