I want to add and delete users from an OpenDS server, can someone please provide some sample code? I could not find it anywhere, including the OpenDS wiki.
4 Answers
The ldapmodify
command has the ability to add and delete users. Try checking out the OpenDS source code and reviewing the implementation of the ldapmodify
program for an example.

- 151,642
- 46
- 269
- 291
If you are open to using the GUI, here's how to add admin users: https://docs.opends.org/2.2/page/ManagingUsersWithControlpanel.
If you are open to using Spring, here's a pretty comprehensive example: http://blog.javachap.com/index.php/ldap-user-management-with-spring-ldap/.
If you are using OpenSSO (a sister project to OpenDS), you can use the OpenSSO REST interfaces to admin users.

- 9,139
- 1
- 36
- 40
-
Hi Aaron, thx for the reply, i am creating an interface using eclipse rcp and i have to use opends. any idea or any sample code snippet to add user to ldap using ldap. – speedsri Aug 22 '11 at 16:37
-
The Apache Directory Studio is an LDAP GUI built in Eclipse (it can be deployed standalone or as an Eclipse plugin). Its open source, so you'll be able to get lots of example code: http://directory.apache.org/studio/ – atrain Aug 22 '11 at 19:33
The UnboundID LDAP SDK provides examples of add, delete, modify, and modify DN operations against an LDAP directory server in the com.unboundid.ldap.sdk.examples
package, LDAPModify
class.

- 10,957
- 2
- 28
- 38
-
You asked how to add and delete users to an LDAP database using Java. I gave you a pointer to the best Java API you should use. It makes no difference whatsoever that your directory server is OpenDS. – Terry Gardner Aug 23 '11 at 08:51
If you want to use Java to Add and Delete users in OpenDS, you can use JNDI or OpenDJ LDAP SDK (or any other LDAP client api). JNDI is bundle in the JVM and you can find detailed tutorials on Java.sun.com. The OpenDJ LDAP SDK is an external library, has lots of sample code and docs on opendj.forgerock.org. You just need to point to the Maven repository to make use of it.
As Aaron mentioned, Apache Directory Studio is an LDAP GUI built in Eclipse and it works very well with OpenDS and its continuation : OpenDJ.

- 4,788
- 2
- 21
- 30