日期:2014-05-16  浏览次数:20949 次

如何向apacheDS添加新的user
1.Right-click on the ou=users node and select New Entry. The New Entry wizard appears.

2.In the Entry Creation Method pane, you do not need to change any settings. Click Next.

3.In the Object Classes pane, select inetOrgPerson from the list of Available object classes on the left and then click Add to populate the list of Selected object classes. Click Next.



4.In the Distinguished Name pane, complete the RDN field, putting uid in front and jdoe after the equals sign. Click Next.



5.Now fill in the remaining mandatory attributes in the Attributes pane. Set the cn (common name) attribute to John Doe and the sn (surname) attribute to Doe. Click Finish.



6.Add a userPassword attribute to the user entry. In the LDAP Browser view, you should now be able to see a new node, uid=jdoe. Select the uid=jdoe node. Now, right-click in the Entry Editor view and select New Attribute. The New Attribute wizard appears.

7.From the Attribute type drop-down list, select userPassword. Click Finish.

8.The Password Editor dialog appears. In the Enter New Password field, enter the password, 123456. Click Ok.

9.To add more users, repeat steps 7 to 14.

10.To verify new created user and password, right-click the connection name, select Properties, click on Authentication, enter the username you just created and the password.

or you can test connection with apacheDS API, sample:

LdapConnection connection = new LdapNetworkConnection("192.168.71.82", 10389);
		BindRequest bindRequest = new BindRequestImpl();
		Dn dn = new Dn("uid=mike,ou=users,ou=system");
		bindRequest.setDn(dn);
		bindRequest.setCredentials("123456");
		BindResponse bindResponse = connection.bind(bindRequest);
		System.out.println(bindResponse.getLdapResult());
		connection.unBind();
		connection.close();