1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
// LDAP url de la forme : ldap://server:port/
env.put(Context.PROVIDER_URL, HOST);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
// Login à renseigner...
env.put(Context.SECURITY_PRINCIPAL, LOGIN);
// Password à renseigner...
env.put(Context.SECURITY_CREDENTIALS, PASSWORD);
try
{
DirContext ctx = new InitialDirContext(env);
}
catch (NamingException e)
{
e.printStackTrace();
} |
Partager