Solved

Difference between connecting to Active Directory and OpenLDAP

Posted on 2006-11-16
4
658 Views
Last Modified: 2013-11-24
Hi Experts,

I have a Java servlet throws a NamingException when attempting to create an InitialDirContext with an invalid user/password when authenticating against OpenLDAP.  When I point the same code to Active Directory, it does not throw the NamingException.  What is the difference between OpenLDAP and AD?  Another difference between the two runs is that the it's running on WebLogic for the OpenLDAP and WebSphere for the AD, but I don't think that would cause this difference in results, right?

Below is the method that is giving me grief:

      private DirContext getDirContext (String ldapUser, String password, String ldapURL) throws NamingException {
            // Set up the environment for creating the initial context
            Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY,
                        "com.sun.jndi.ldap.LdapCtxFactory");
            env.put(Context.PROVIDER_URL, ldapURL);

            env.put(Context.SECURITY_AUTHENTICATION, "simple");
            env.put(Context.SECURITY_PRINCIPAL, ldapUser);
            env.put(Context.SECURITY_CREDENTIALS, password);
            
            // Create the initial context
            return new InitialDirContext(env);
      }

Any help would be greatly appreciated.  Thank you.
0
Comment
Question by:david_yoshinaga
4 Comments
 
LVL 23

Expert Comment

by:Ajay-Singh
Comment Utility
sound to me that you should use different authentication for OpenLDAP
0
 

Author Comment

by:david_yoshinaga
Comment Utility
I figured it out. . . I was missing these two lines:

            env.put(Context.STATE_FACTORIES, "PersonStateFactory");
            env.put(Context.OBJECT_FACTORIES, "PersonObjectFactory");

Hope someone else can benifit from this!
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
Comment Utility
PAQed with points refunded (500)

DarthMod
Community Support Moderator
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now