Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / March 2004

Tip: Looking for answers? Try searching our database.

ldap programming in java

Thread view: 
mihir - 09 Mar 2004 05:36 GMT
hi, i want to connect to netscape ldap server with java programming. i am using jsse.jar for this purpose. but i could not find help for this api. so if anyone has code or understanding of how to do sasl or ssl certificate based authentication pls help me out
John W. - 17 Mar 2004 21:51 GMT
I typically use the following code to do LDAPS.  I'm using JDK 1.3.1,
so in addition to JNDI it requires the JSSE jcert.jar, jnet.jar, and
jsse.jar.  The only real difference between plaintext LDAP and LDAP
over SSL is adding the security provider and specifying the security
protocol in the properties passed to the initial context.

John

[snip]
 
// Need JSSE if not using 1.4
java.security.Security.addProvider(
         new com.sun.net.ssl.internal.ssl.Provider() );

// Env to pass to context to establish connection
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
          "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://....:636/o=..." );
env.put(Context.SECURITY_PRINCIPAL, distinguishedName);
env.put(Context.SECURITY_CREDENTIALS, password);
env.put(Context.SECURITY_PROTOCOL,  "ssl");
                                     
try {
 LdapContext ctx = new InitialLdapContext(env, null);    

 // Now connected via LDAPS....perform whatever ops you need to
                                             
 ctx.close();
           
} catch (Exception ex) {
 ex.printStackTrace();
}

> hi, i want to connect to netscape ldap server with java programming. i am using jsse.jar for this purpose. but i could not find help for this api. so if anyone has code or understanding of how to do sasl or ssl certificate based authentication pls help me out


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.