0 Replies Latest reply: Jul 2, 2009 4:45 AM by 843810 RSS

    Novell with Digest MD5 - LDAP: error code 49 - Invalid Credentials

    843810
      I tried this code with Novell edirectory.
      class Digest {
      public static void main(String[] args) {

           // Set up environment for creating initial context
           Hashtable env = new Hashtable(11);
           env.put(Context.INITIAL_CONTEXT_FACTORY,
           "com.sun.jndi.ldap.LdapCtxFactory");
           env.put(Context.PROVIDER_URL, "ldap://10.223.9.224:389/o=kerb-context");

           // Authenticate as C. User and password "mysecret"
           env.put(Context.SECURITY_AUTHENTICATION, "DIGEST-MD5");

           // env.put(Context.SECURITY_PRINCIPAL, "cuser");
           env.put(Context.SECURITY_PRINCIPAL, "dn:cn=user,o=kerb-context");
           env.put(Context.SECURITY_CREDENTIALS, "pwd#123");

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

           System.out.println(ctx.lookup("ou=NewHires"));

           // do something useful with ctx

           // Close the context when we're done
           ctx.close();
           } catch (NamingException e) {
           e.printStackTrace();
           }
      }
      }

      But I am getting the following exception

      javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]
           at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3041)
           at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2987)
           at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2789)
           at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2703)
           at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:293)
           at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
           at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
           at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
           at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
           at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
           at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
           at javax.naming.InitialContext.init(InitialContext.java:223)
           at javax.naming.InitialContext.<init>(InitialContext.java:197)
           at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:82)
           at Digest.main(Digest.java:30)
      What am I missing here? Can anyone help me on this.

      Thanks in advance
      Sankar