1 Reply Latest reply: Feb 23, 2013 3:50 PM by EJP RSS

    Active Directory supported user name formats for Context.SECURITY_PRINCIPAL

      I am using InitialLdapContext to bind to Active Directory for authentication. The credentials are passed by the user on the login screen of the product.

           String url = "ldap://testdom.com";
           Hashtable<String, String> env = new Hashtable<String, String>();
           env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
           env.put(Context.PROVIDER_URL, url);
           env.put(Context.SECURITY_AUTHENTICATION, "simple");
           env.put(Context.SECURITY_PRINCIPAL, "testdom\\administrator");
           env.put(Context.SECURITY_CREDENTIALS, "password");
           LdapContext context = new InitialLdapContext(env, null);

      If user specifies UPN i.e. user@domain.com or using testdom\administrator then authentication is happening properly.
      If instead of domain netbios user specifies fqdn of domain i.e. testdom.com\administrator then authentication fails with bad credentials error.

      What are the user name formats supported for Context.SECURITY_PRINCIPAL for Active Directory?