Reputation: 263
LDAP: error code 49 - 80090308: LdapErr: DSID-0C09042F, comment: AcceptSecurityContext error, data 52e, v2580
I know "52e" code is when username is valid, but password is invalid. I am using the same user name and password for validating user against Active directory and its working fine.
Here is my java code:
String userName = "user_test";
String password = "*******";
String base ="DC=test,DC=local";
String dn = "cn="+ userName + "," + "CN=Users," + base;
try {
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, dn);
env.put(Context.SECURITY_CREDENTIALS, password);
env.put(Context.PROVIDER_URL, "ldap://*****.test.local:389");
System.out.println("Attempting to Connect...");
ctx = new InitialLdapContext(env, null);
System.out.println("Connection Successful.");
} catch (NamingException nex) {
System.out.println("LDAP Connection: FAILED");
nex.printStackTrace();
}
return ctx;
}
I do not know exactly why getting this error. Can anyone please help on this?
Upvotes: 2
Views: 56130
Reputation: 11026
The error is pretty definitive.
49 52e 1326 ERROR_LOGON_FAILURE Returns when username is valid but password/credential is invalid.
Often the Hard Part is properly determining the DN.
Upvotes: 1
Reputation: 111
In case you use simple authority authentication , you should use short username form
I checked, in this case authentication is working. In dn form I have got exactly the same error
javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1
You may also refer to earlier thread LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1
Upvotes: 2