Need LDAP user details in AEM JAVA service | Community
Skip to main content
akhilraj
June 9, 2022

Need LDAP user details in AEM JAVA service

  • June 9, 2022
  • 2 replies
  • 1074 views

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 ?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Magicr
June 9, 2022

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

JeevanRaj
Community Advisor
Community Advisor
June 9, 2022

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

akhilraj
akhilrajAuthor
June 9, 2022

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.

 

 

JeevanRaj
Community Advisor
Community Advisor
June 9, 2022

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.