Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cert based ldap authentication

843811Apr 17 2008 — edited Jun 4 2008
Hello all,

Ideas of how to do this, examples are always preferred. Either from local workstation's IDE or through a servlet page,
how would one perform a bind to an LDAP server using a clients certificate (X509Certificate)?

Using "simple" method is easy, well documented, and not a problem:

// 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, "ldap://localhost:636");

// Specify SSL
env.put(Context.SECURITY_PROTOCOL, "ssl");

// 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);

// ... do something useful with ctx



But with certificate, seems not as straightforward.

Any help is appreciated.

SK
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 2 2008
Added on Apr 17 2008
16 comments
1,222 views