1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
public static void testConnexion(){
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "cn=Administrateur,ou=Utilisateurs,dc=paap,dc=fr");
env.put(Context.SECURITY_CREDENTIALS, "monpassword");
env.put(Context.PROVIDER_URL, "ldap://serveur.domaine.fr:135");
env.put(Context.REFERRAL, "follow");
try {
dirContext = new InitialDirContext(env);
dirContext.close();
}
catch (NamingException e) {
return(new Vector(null));
}
}
} |
Partager