File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Security and the fly likes How to bind() ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "How to bind() ?" Watch "How to bind() ?" New topic

How to bind() ?

Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
If I am going to add a user to an existing LDAP using the JNDI API, what should I provide as the "name" argument for javax.naming.DirContext#bind(String name, Object obj, Attributes attrs)? Should it be the dn of the object or the dn of the context that object should be added to? Something else?

Right now (while prototyping against a mocked-up implementation of DirContext and not having access to a real LDAP server), I'm doing something like this:

It seems a bit stupid giving out first the object itself and then the object's attributes (which the DirContext implementation could easily pick up from the object itself if it implements the appropriate interfaces).

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
I once(3years back) used Netscape LDAP directory server 4.12 with JNDI to add/access/delete new user information, i used there sample tutorials provided in their site and modified them a little to suite my needs!..

BYW i found this link in google, in case if you had not noted..
Novell Contributes Java-based LDAP to Open Standards
OpenLDAP - Free

Netscape Directory Server 6.21

Spritle Software Blogs
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
Thanks for the tip. I gave up on OpenLDAP -- it's too geeky (pure command-line with cryptic error messages) for me to learn in a couple of hours so I downloaded an evaluation version of Sun's directory server earlier today (that's what the production environment will be using but I was hoping for a more lightweight product for testing during development). Well, it doesn't look like a resource hog so I guess I'll be fine.

Anyway, I'm still all ears for further tips
I agree. Here's the link:
subject: How to bind() ?
It's not a secret anymore!