LDAP: il codice di errore 49-80.090.308: LdapErr: DSID-0C0903A9, commentare: errore di AcceptSecurityContext, 52e i dati, v1db1LDAP: il codice di errore 49-80.090.308: LdapErr: DSID-0C0903A9, commentare: errore di AcceptSecurityContext, 52e dati, v1db1
So che il codice "52e" è quando il nome utente è valido, ma la password non è valida. Sto usando lo stesso nome utente e la stessa password nel mio studio di apache, sono riuscito a stabilire la connessione con successo su LDAP.
Ecco il mio codice Java
String userName = "*******";
String password = "********";
String base ="DC=PSLTESTDOMAIN,DC=LOCAL";
String dn = "cn=" + userName + "," + base;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://******");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, dn);
env.put(Context.SECURITY_CREDENTIALS, password);
LDAPAuthenticationService ldap = new LDAPAuthenticationService();
// LdapContext ctx;
DirContext ctx = null;
try {
ctx = new InitialDirContext(env);
Il mio errore è su questa linea: ctx = new InitialDirContext(env);
Non so che cosa esattamente sta causando questo errore.
si dovrebbe verificare un modo migliore per trovare utenti: https://bitbucket.org/jwilleke/examples/src/dba1d74d172f9a3f13fc375f6d17370b6da91adf/Examples-JNDI/src/com/willeke/samples/ldap/jndi/BasicAdminSearchBind.java? at = master – jwilleke