jQuery in Action, 2nd edition*
The moose likes Security and the fly likes LDAP java question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "LDAP java question" Watch "LDAP java question" New topic
Author

LDAP java question

Tim Cerillo
Ranch Hand

Joined: Sep 10, 2002
Posts: 44
I am trying to code something that will identify duplicate user ids
from two different directories. What is the best approach in Java? Do
you know any article or online books that would get me up to speed
with LDAP programming with Java? Thanks a lot.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
The Java API for using LDAP is called JNDI; its home page might be a good starting point for further research.


Ping & DNS - updated with new look and Ping home screen widget
Tim Cerillo
Ranch Hand

Joined: Sep 10, 2002
Posts: 44
Thanks Ulf. I was able to make a successful connection to LDAP via JNDI. I'm a java greenhorn, how can I compare two directories for duplicates say in lastname attribute. I already have the connection to both the directories. Can someone share some codes on how to search thru one attribute and compare with the same attribute on the second directory? Thanks in advance.
Stefan Zoerner
Author
Ranch Hand

Joined: Nov 29, 2001
Posts: 121
Tim,

how many entries do your directories have? One option would be to fetch all users from directory A, and for each entry make a search for the attributes you interested in on directory B. Check out the JNDI Tutorial at Sun for code examples on how to perform search ops with JNDI. Note that the surname is normally not capable to identify a user, because it tends not to be unique (some serial number would do better).

If your directories contain many entries, this algorithm would be rather slow. It is probably better to export the entries into something else instead of using 2 connections to different directories ... But this depends on how often the task should be performed.

Hope that helped, Stefan


Stefan Zoerner
Author of German LDAP-Book
Committer at Apache Directory Project
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LDAP java question
 
Similar Threads
Need an example on LDAP with EJB Stateless Session beans
Welcome Clayton (and everyone else)!
Saving password field in LDAP Server
hi What is Java Naming and Directory Interface?
Authentication mechanism and code procedure from web app to an LDAP server