Hi all I have implemented Ldap bind operation, and file it at http://issues.apache.org/jira/browse/HARMONY-4928. It now targets at version 3 ldap protocol, and only supports simple(clear text) authentication.
The implementation for add operation is added through http://issues.apache.org/jira/browse/HARMONY-4910. Currently, the decode function for add operation is not yet implemented. I will add more features for ldap service provider in the future. Any one who is interested can verify this functionality using the following code: import java.io.IOException; import java.net.UnknownHostException; import javax.net.SocketFactory; import org.apache.harmony.jndi.provider.ldap.BindOp; import org.apache.harmony.jndi.provider.ldap.LdapClient; import org.apache.harmony.jndi.provider.ldap.LdapMessage; import org.apache.harmony.jndi.provider.ldap.LdapResult; /** * This class demonstrate how to connect to and send BindRequest to Ldap server. */ public class Sample { @SuppressWarnings("unused") public static void main(String[] args) throws UnknownHostException, IOException { // anonymous binds BindOp bind = new BindOp("cn=Coder,dc=InitialDN", "secret"); // Initialize to your ldap server address LdapClient client = new LdapClient(SocketFactory.getDefault(), <ldap server ip addr>, 389); LdapMessage response = client.doOperation(bind, null); System.out.println(response.getMessageId()); LdapResult re = bind.getResult(); System.out.println(re.getErrorMessage()); System.out.println(re.getMachedDN()); System.out.println(re.getResultCode()); System.out.println(re.getReferrals()); } } -- Spark Shen China Software Development Lab, IBM
