harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "spark shen (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4928) [classlib][jndi] Implements Ldap bind operation request and response messages
Date Thu, 11 Oct 2007 08:56:50 GMT
[classlib][jndi] Implements Ldap bind operation request and response messages
-----------------------------------------------------------------------------

                 Key: HARMONY-4928
                 URL: https://issues.apache.org/jira/browse/HARMONY-4928
             Project: Harmony
          Issue Type: New Feature
          Components: Classlib
            Reporter: spark shen


This patch implemnts Ldap bind request and response, encode and decode them according to Harmony
ASN.1 framework.

The following main function can test the implementation:
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 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());
    }
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message