directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Boorshtein <mboorsht...@gmail.com>
Subject Re: Client library
Date Tue, 02 Aug 2005 15:26:30 GMT
You may also want to check out JLDAP and JDBC-LDAP from the OpenLDAP
project.  JLDAP is a java implementation for client libraries of the
LDAP protocol and is closer to the protocol then JNDI.  JDBC-LDAP is
based on JLDAP but alows you to use SQL statements when working with
LDAP directories (it also includes a browser as well).

Marc


On 8/2/05, Robert r. Sanders <robert.sanders@ipov.net> wrote:
> Its a little hard to find "from scratch", but JNDI has a lot to do w/
> LDAP (look at the javax.naming.dir package).
> 
> Create a connection to the Apache Directory server (when its running on
> localhost):
> 
>         Hashtable env = new Hashtable();
> 
>         env.put(Context.PROVIDER_URL, "ldap://localhost:389/ou=system");
> 
>         env.put(Context.INITIAL_CONTEXT_FACTORY,
> 
>             "com.sun.jndi.ldap.LdapCtxFactory");
> 
>         env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
> 
>         env.put(Context.SECURITY_CREDENTIALS, "secret");
> 
>         DirContext context = new InitialDirContext(env);
> 
> 
> Add entries to a context:
> 
>     String name = "cn=User Two,ou=users";
> 
>     Attributes attrs = new BasicAttributes();
> 
>     attrs.put("dn", name + ",ou=system");
> 
>     attrs.put("cn", "Two User");
> 
>     attrs.put("givenName", "Two");
> 
>     attrs.put("sn", "User");
> 
>     attrs.put("uid", "user.two");
> 
>     attrs.put("mail", "user.two@hotmail.com");
> 
>     attrs.put("userPassword", "plaintext2");
> 
>     attrs.put("objectClass", "inetOrgPerson");
> 
>     attrs.put("objectClass", "top");
> 
> 
> 
>     context.createSubcontext(name, attrs);
> 
> 
> There are some pretty decent tutorials under the JNDI trail on this.
> 
> 
> Ugo Cei wrote:
> 
> > Hi,
> >
> > I'm looking for a good LDAP Java client library and I'd like to use
> > Apache stuff, if at all possible. Looking around on
> > directory.apache.org I couldn't understand whether there is something
> > usable already, and couldn't find anything in the latest distributed
> > version (0.9 I think). My needs are quite basic: I just need to create
> > and update entries in an LDAP repository used for storing user
> > credentials. If something is available, I could invest some time
> > towards developing it further.
> >
> >     Thanks in Advance,
> >
> >         Ugo
> >
> > P.S.: I'm not subscribed to this list, so I would be grateful if you
> > could Cc: me in your replies. I will certainly subscribe if necessary.
> >
> --
>     Robert r. Sanders
>     Chief Technologist
>     iPOV
>     (334) 821-5412
>     www.ipov.net
> 
>

Mime
View raw message