Forums Register Login

Get DistinguishedName of an LDAP entry given a uid

+Pie Number of slices to send: Send
Hi,

I'm trying to find the most efficient way to get the Distinguished Name of an LDAP entry given some attribute of that entry (ie, 'uid'). That is, assume each entry in the directory has an attribute 'uid' that is unique across all entries. How do I get that entry's DN?

Here's some code to put it in perspective:

// assume InitialContext 'ctx' is created
String uid = "myuniqueid";
Attributes matchAttrs = new BasicAttributes(true);
matchAttrs.put(new BasicAttribute("uid", uid));
try {
NamingEnumeration answer = ctx.search("ou=sales,
dc=scotts_ldap_server", matchAttrs);
// how do I get the DN out of the answer?
} catch (Exception e){}
It was the best of times. It was the worst of times. It was a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 696 times.
Similar Threads
Need help with DigestUtils SHA encryption
LDAP Search
Problems setting up JForum with LDAP
LDAP: Add Users
JNDI and LDAP group operations
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:19:39.