Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Need LDAP user details in AEM JAVA service

Avatar

Level 4

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 5

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

Avatar

Community Advisor

Hi @akhilr48142671 

 

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 4

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 4

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?