java - getting User details using Spring LDAP -


hi i'm trying user details using existing ldap server. ldap server details received, stored them in properties file.

application.properties file:  ldap.url=ldaps://ldap.company.com:636/ ldap.base=ou=users,o=company ldap.userdn=cn=ad,ou=services,o=company ldap.password=password 

i'm using spring ldap in application integrate ldap. in spring ldap, ldaptemplate helping me necessary operations.

my configuration:

@configuration @propertysource(value = "classpath:application.properties") public class ldapconfig {  @autowired private environment env;  @bean public ldapcontextsource contextsourcetarget() {     ldapcontextsource ldapcontextsource = new ldapcontextsource();     ldapcontextsource.seturl(env.getproperty("ldap.url"));     ldapcontextsource.setbase(env.getproperty("ldap.base"));     ldapcontextsource.setuserdn(env.getproperty("ldap.userdn"));     ldapcontextsource.setpassword(env.getproperty("ldap.password"));     ldapcontextsource.afterpropertiesset();     return ldapcontextsource;  }  @bean public ldaptemplate ldaptemplate() throws exception {     ldaptemplate lt = new ldaptemplate(contextsourcetarget());     lt.afterpropertiesset();     return lt;   } } 

in controller i'm trying getting details of users.

   23. ldapquery query = query().base("ou=users,o=company");    24. list<string> str = ldaptemplate.list(query.base()); 

but i'm getting exception @ line 24:

exception while authenticating ldap server : [ldap: error code 32 - nds error: no such entry (-601)]; nested exception  javax.naming.namenotfoundexception: [ldap: error code 32 - nds error: no such entry (-601)]; remaining name 'ou=users,o=company' 

can please going wrong?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -