Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A Java client for LDAP [closed]

I need to write some Java code to connect to an LDAP server to verify that the user supplied LDAP account info is correct, and then I need to get attribute names from the server which this user can see. Is there some recommended Java client library for this ? If yes, which one ?

Thanks in advance!

like image 625
shrini1000 Avatar asked Dec 10 '22 12:12

shrini1000


1 Answers

I would recommend, as have some others, the UnboundID LDAP SDK.

Generally, I would recommend avoiding JNDI for new code in favor of the UnboundID LDAP SDK for the following reasons.

The UnboundID LDAP SDK:

  • is cleaner
  • is clearer
  • has support for failover and load-balancing
  • has support for localization
  • makes the use of matching rules easy
  • supports a shorter learning curve, easier to use than JNDI
  • supports asynchronous operations
  • supports in-memory directory server, which can be useful in unit testing
  • The UnboundID LDAP SDK also provides packages that assist developers with migrating away from the Netscape LDAP SDK and JNDI.

There are examples at the blog, and at the sample code site.

If you plan to use Maven, the dependency is:

<dependency>
  <groupId>com.unboundid</groupId>
  <artifactId>unboundid-ldapsdk</artifactId>
  <version>2.3.1</version>
</dependency>

see also

  • LDAP: Programming Practices
like image 138
Terry Gardner Avatar answered Dec 20 '22 04:12

Terry Gardner