Hello,
I am trying to fetch the users or details of particular user from AD and I am using ldapsearch() to achieve this, but I am facing issues to fetch the results
I have created 'scsExternalSystemKey' ad.test with below details
username:<full DN>
password:<password>
ldapsearch( config: { scsExternalSystemKey: "ad.test", usePerUserCredentials: false, url: "ldap://<IP>:389/DC=PSIAPPIAN,DC=com" }, searchFilter: "(&(ObjectClass=organizationalPerson)(uid=administrator)", attributes: {}, pagingInfo: a!pagingInfo( startIndex: 1, batchSize: - 1 ))
Output:
LdapResponse success: true result: DataSubset startIndex: 1 batchSize: -1 sort: null (List of SortInfo) totalCount: 0 data: null (List of Variant) identifiers: null (List of Variant) error: null (Text)
I have tried multiple filters to fetch the result but none are working. Highly appreciated if I get any pointers on this. Thanks in advance.
Discussion posts and replies are publicly visible
kaushikr276 , Please add the list of attributes which you want to query from the LDAP server in the attributes parameter and try,
Eg.
ldapsearch( config: { scsExternalSystemKey: "ad.test", usePerUserCredentials: false, url: "ldap://<IP>:389/DC=PSIAPPIAN,DC=com" }, searchFilter: "(&(ObjectClass=organizationalPerson)(uid=administrator)", attributes: {"givenName", "sn", "sAMAccountName", "mail"}, pagingInfo: a!pagingInfo( startIndex: 1, batchSize: - 1 ))
If this doesn't help,
raghuvarann Thanks for the reply, I tried adding attributes to search. I also made changes in config dictionary by adding timeout parameter, but it doesn't work (even search of single user also not giving result) When I do search in jxplorer and other tools I get desired result. And also I tried to add baseDN param in config but it gives me connection issue but when I append baseDN in URL it's able to connect. for eg in config. url: "ldap://<IP>:389/DC=PSIAPPIAN,DC=com" (This works) url: "ldap://<IP>:389" baseDN="DC=PSIAPPIAN,DC=com" (Fail to connect)
I have also tried with configuring OU. Not sure where m I going wrong?
kaushikr276
Can you please share the masked code of your ldapsearch() function to help me understand the problem better?
Thanks,
Raghu