Authentication and SSL
I am trying to experiment with various authentication methods with SSL. My directory is Active directory.
1. None - Windows 2003 AD does not support it.
2. simple - successful
3. Digest-MD5 - successful
4. KerberosV5 - successful
5. External - FAILED.
To my amusement, when i looked at the javadocs for
http://java.sun.com/j2se/1.4.2/docs/api/javax/naming/Context.html#SECURITY_AUTHENTICATION
it says possible values are "none", "simple" and "strong".
I don't understand then how "Digest-MD5" and "KerberosV5" (GSSAPI) worked then
Same things for 1.3 and 1.5 docs
For external, i get the error saying
Problem searching directory: javax.naming.AuthenticationNotSupportedException: [LDAP: error code 7 - 00002027: LdapErr: DSID-0C090474, comment: Invalid Authentication method, data 0, vece
the portion of the code is
Hashtable env = new Hashtable();
String adminName = "CN=Administrator,CN=Users,DC=MYDOMAIN,DC=NET";
String adminPassword = "xxxxxxx";
String ldapURL = "ldap://myhost.mydomain.net:636";
String keystore = "c:/JBuilder8/jdk1.4/jre/lib/security/cacerts";
try {
java.io.File f = new java.io.File(keystore);
if (f.exists()) {
System.out.println("Keystore exists ...");
}
} catch (Exception e) {
}
System.setProperty("javax.net.ssl.trustStore",keystore);
System.setProperty("javax.net.ssl.keyStore","c:/user/keystore/usercerts");
System.setProperty("javax.net.ssl.keyStorePassword","changeit");
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
//set security credentials
env.put(Context.SECURITY_AUTHENTICATION,"EXTERNAL");
//System.setProperty("javax.naming.security.authentication","EXTERNAL");
// env.put(Context.SECURITY_PRINCIPAL,adminName);
// env.put(Context.SECURITY_CREDENTIALS,adminPassword);
//specify use of ssl
env.put(Context.SECURITY_PROTOCOL,"ssl");
//connect to my domain controller
env.put(Context.PROVIDER_URL,ldapURL);

