Sanjay Bordia

Greenhorn
+ Follow
since Jun 05, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Sanjay Bordia

I am getting the following error while Authenticating. Could anyone help sending the Java code for this. And helping in understanding what does DN, sAMAccountname and other attributes means.

�javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]

The code is as follows:

public static String MY_HOST = "host string";
public static String MY_SEARCHBASE = "cn=administrator,cn=user,dc=mahindrabt,dc=com";
public static String MY_FILTER = "(&(objectClass=user))";
public static String MGR_DN = "cn=some user";
public static String MGR_PW = "passwd";
public static void main(String[] args) {
try{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,INITCTX);
env.put(Context.PROVIDER_URL,MY_HOST);
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.SECURITY_PRINCIPAL,MGR_DN);
env.put(Context.SECURITY_CREDENTIALS,MGR_PW);
DirContext ctx = new InitialDirContext(env);
19 years ago