harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Spark Shen" <smallsmallor...@gmail.com>
Subject Re: [classlib][jndi] Bind operation has now been added to ldap service provider
Date Fri, 12 Oct 2007 02:09:02 GMT
I am feeling upset that my patch draws no one's interest. :-(
Would any committer take a look at my contribution? It's for ldap bind
operation, which is used to say hello to ldap server.

2007/10/11, Spark Shen <smallsmallorgan@gmail.com>:
>
> 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




-- 
Spark Shen
China Software Development Lab, IBM

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message