Get list of users & persons by login with ldap java -


i'm working on app contains official employees information login.

i ldap search filter retrieve me information concerning specific users corresspond list of logins provide.

a bit select statement in sql : select * ldap login in(my list of login)

i'm using basic javax.naming.directory blah blah comming with.

// set properties our connection , provider properties properties = new properties(); properties.put( context.initial_context_factory,    "com.sun.jndi.ldap.ldapctxfactory" ); properties.put( context.provider_url, "ldap://myserver.somewhere.com:389"; ); properties.put( context.referral, "ignore" );  // set properties authentication properties.put( context.security_principal, "user name" ); properties.put( context.security_credentials, "password" );  initialdircontext context = new initialdircontext( properties ); 

the thing far lising object users if directly i'm looking nice :)

thanks lot guys :)

    string searchfilter = "your_query";     string ldapsearchbase = "dc=ad,dc=my-domain,dc=com"     searchcontrols searchcontrols = new searchcontrols();     searchcontrols.setsearchscope(searchcontrols.subtree_scope);      namingenumeration<searchresult> results = context.search(ldapsearchbase, searchfilter, searchcontrols); 

an query might this:

(&(objectclass=user)(samaccountname=" + accountname + ")) 

complete example here: http://www.adamretter.org.uk/blog/entries/ldaptest.java


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -