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
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