Why does this work?
env.put(Context.PROVIDER_URL, "ldap://localhost:10389/o=csRepository");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
//env.put(Context.SECURITY_PRINCIPAL, "cn=John Eipe, ou=employees, o=csRepository");
//env.put(Context.SECURITY_CREDENTIALS, "qwer1234");
DirContext ctx = new InitialDirContext(env);
//operations on ctx
My understanding is that when SECURITY_AUTHENTICATION is specified as simple and no username or password is specified then it should throw javax.naming.AuthenticationException.