Ciao a tutti,
mi trovo a "litigare" con una classe per la semplice autenticazione ldap (true o false).
Premetto che, ovviamente, i dati che immetto sono esatti, l'indirizzo del server è corretto, ho già cercato soluzioni praticamente ovunque.
Il codice è questo:

codice:
public class jcInterrogaLDAP {

    public boolean InterrogaLDAP(String usr, String psw) {
        boolean blLdapVerify = false;
        Properties env = new Properties();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.PROVIDER_URL, "ldap://atmdc03:389");
        env.put(Context.SECURITY_AUTHENTICATION, "simple");
        env.put(Context.SECURITY_PRINCIPAL, "cn=" + usr + ",conn");
        env.put(Context.SECURITY_CREDENTIALS, psw);
        try {
            System.out.println("InterrogaLDAP - inizio autenticazione");
            DirContext authContext = new InitialDirContext(env);
            System.out.println("InterrogaLDAP - server risponde");
            // Authentication OK
            blLdapVerify = true;
            authContext.close();
        } catch (AuthenticationException authEx) {
            authEx.getMessage();
            // Authentication failed
            System.out.println("InterrogaLDAP - autenticazione fallita");
            blLdapVerify = false;
        } catch (NamingException namEx) {
            namEx.getMessage();
            // Something went wrong 
            System.out.println("InterrogaLDAP - qualcosa è andato storto");
            blLdapVerify = false;
        }
        return blLdapVerify;
    }
}
Il problema è che esce sempre per "Autenticazione fallita". Non so più cosa fare.
Qualcuno ravvisa qualche errore ?
Grazie
Massimo