Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1

LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1

I know "52e" code is when username is valid, but password is invalid. I am using the same user name and password in my apache studio, I was able to establish the connection succesfully to LDAP.

Here is my java code

    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);

My error is on this line: ctx = new InitialDirContext(env);

I do not know what exactly is causing this error.

like image 619
anusha vannela Avatar asked Jul 14 '15 15:07

anusha vannela


People also ask

What is LDAP error code 49 80090308?

This error line here "LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903C8, comment: AcceptSecurityContext error, data 52e" indicates thats its invalid credentials. This error message is standard message when we dont provide correct credentials. They are many links/forums for this error on google.

How do I fix LDAP Error 49?

This can occur if the vCenter Server is restored to an earlier version from backups or an older snapshot. To resolve this issue, reset the password for the user account listed in the vmdird-syslog. log file.

What is LDAP error?

LDAP Error Codes is an Result Code indicating something went wrong. They are really LDAP Result Codes and we have a lot of them well defined.


3 Answers

data 52e - Returns when username is valid but password/credential is invalid.

You probably need something like

String dn = "cn=" + userName + "," + "CN=Users," + base;  
like image 130
jwilleke Avatar answered Oct 11 '22 06:10

jwilleke


For me the issue resolved when I set the principal section like this:

env.put(Context.SECURITY_PRINCIPAL, userId@domainWithoutProtocolAndPortNo);
like image 32
Vishal Avatar answered Oct 11 '22 04:10

Vishal


52e 1326 ERROR_LOGON_FAILURE Returns when username is valid but password/credential is invalid. Will prevent most other errors from being displayed as noted.

http://ldapwiki.com/wiki/Common%20Active%20Directory%20Bind%20Errors

like image 18
brcaak Avatar answered Oct 11 '22 05:10

brcaak