Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-98

Authenticate LDAP Using INITIAL_CONTEXT_FACTORY

    XMLWordPrintable

Details

    • Hide

      1. Set INITIAL_CONTEXT_FACTORY(com.sun.jndi.ldap.LdapCtxFactory), PROVIDER_URL, SECURITY_AUTHENTICATION, SECURITY_PRINCIPAL through Java for LDAP
      2. Failed instantiate InitialContextFactory Error While setting env in InitialContextFactory

      Show
      1. Set INITIAL_CONTEXT_FACTORY(com.sun.jndi.ldap.LdapCtxFactory), PROVIDER_URL, SECURITY_AUTHENTICATION, SECURITY_PRINCIPAL through Java for LDAP 2. Failed instantiate InitialContextFactory Error While setting env in InitialContextFactory

    Description

      We are trying to authenticate Password Using LDAP by Setting INITIAL_CONTEXT_FACTORY which leads to error Failed instantiate InitialContextFactory

      Please find the below code to authenticate using LDAP

      Hashtable<String, Object> env = new Hashtable<String, Object>();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
      env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDILDAP");

      // Authenticate as S. User and password "mysecret"
      env.put(Context.SECURITY_AUTHENTICATION, "simple");
      env.put(Context.SECURITY_PRINCIPAL,
      "cn=S. User, ou=NewHires, o=JNDITutorial");
      env.put(Context.SECURITY_CREDENTIALS, "mysecret");

      // Create the initial context
      DirContext ctx = new InitialDirContext(env);

      The same code works fine in Jboss 4.2

      Attachments

        Activity

          People

            rhn-cservice-bbaranow Bartosz Baranowski
            asrr_90_jira Rahul A (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: