2
public static void main(String[] args)
{


    // Setup environment for authenticating

    Hashtable<String, String> environment = 
        new Hashtable<String, String>();

    environment.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");

    environment.put(Context.PROVIDER_URL,"ldap://192.168.0.100:389");

    environment.put(Context.SECURITY_AUTHENTICATION,"simple");

    environment.put(Context.SECURITY_PRINCIPAL,"uid=dilip.duraiswamy,dc=xxxx,dc=local");

    environment.put(Context.SECURITY_CREDENTIALS,"xxxx");

    try
    {
        DirContext authContext = 
            new InitialDirContext(environment);

        // user is authenticated
        System.out.println("USER IS AUTHETICATED");

    }
    catch (AuthenticationException ex)
    {

        // Authentication failed
        System.out.println("AUTH FAILED : "+ex );

    }
    catch (NamingException ex)
    {
        ex.printStackTrace();
    }
}

Getting the error as javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C09042F, comment: AcceptSecurityContext error, data 52e, v2580

1 Answer 1

1

For the authentication, add the correct distinguished name.

This issue is usually observed if the DN is not specified correctly in the case when it has space or some special characters.

​Here 52e – represents invalid credential

http://www-01.ibm.com/support/docview.wss?uid=swg21290631

Sign up to request clarification or add additional context in comments.

4 Comments

thanks it worked for admin user , but not for normal user , can i know y its not working for normal user
for admin i used CN=username,CN=Users,DC=***,DC=local
for normal user im using CN=Dilip D,OU=IT,OU=***,OU=****,DC=****,DC=local its not working getting data 531 error i.e LDAP: error code 49 - 80090308: LdapErr: DSID-0C09042F, comment: AcceptSecurityContext error, data 531, v2580
Check whether the entered username is permitted to logon at this workstation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.