开发者

A Java client for LDAP [closed]

开发者 https://www.devze.com 2023-01-28 20:52 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

C开发者_开发百科losed 3 years ago.

Improve this question

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!


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


Novell provides an LDAP library that you could use for this purpose:

http://blogs.oracle.com/marginNotes/entry/ldap_client_apis

There are also a couple of other options, detailed here:

https://stackoverflow.com/questions/389746/ldap-java-library


A very nice ldap api is the unboundid ldap sdk:

http://www.unboundid.com/products/ldapsdk/


JLDAP from OpenLDAP: http://www.openldap.org/jldap/ is a good library.


Just use JNDI with the LDAP provider.


I would recommend opends-sdk client api. It's fast, easy and free (under CDDL). Novell and jndi are old, unbound is good but beware of the license requirements.


As I'm a spring fetishist, I'd suggest to use Spring LDAP :p

http://www.springsource.org/ldap

Especially if you're already using spring for your application.

cheers


Spring LDAP configuration tutorial will help you implementing a Java client for LDAP.

0

精彩评论

暂无评论...
验证码 换一张
取 消