aspose file tools*
The moose likes Security and the fly likes unable to do ssl authentication using ldaps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "unable to do ssl authentication using ldaps" Watch "unable to do ssl authentication using ldaps" New topic
Author

unable to do ssl authentication using ldaps

Dharmakumar Gajendran
Greenhorn

Joined: Feb 22, 2010
Posts: 20
Hi,

I have written a program to authenticate the login user with my organisations ldap directory. I have given the code below,

public boolean authenticate() {

String userName = "username";
String password = "password";
Hashtable<String, String> env = new Hashtable<String, String>();

env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");

env.put(Context.PROVIDER_URL, "ldap://simple.com.au/DC=simple,DC=com,DC=au");
env.put(Context.SECURITY_AUTHENTICATION, "Simple");
/***
* Review : Please Move the domain name to the properties file.
*/
env.put(Context.SECURITY_PRINCIPAL,"userName");
env.put(Context.SECURITY_CREDENTIALS, password);
DirContext ctx = null;
NamingEnumeration results = null;
try {
try {
ctx = new InitialDirContext(env);

} catch (AuthenticationException authEx) {
authEx.printStackTrace();
} catch(Exception e) {
e.printStackTrace();
}


The authentication is successful with the above code. Now I am trying to authenticate with ldaps://simple.com.au and using 'ssl' instead of 'simple'. But the authentication has failed and I am getting the below error.

javax.naming.AuthenticationNotSupportedException: ssl
at com.sun.jndi.ldap.sasl.LdapSasl.saslBind(LdapSasl.java:100)
at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:214)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2694)
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:198)
at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:83)
at SimpleLdapClient.authenticate(SimpleLdapClient.java:69)
at SimpleLdapClient.main(SimpleLdapClient.java:142)

Can any one please help to resolve this issue.

Thanks in advance.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3162
    
  10
It's the protocol type, not the authentication type, that you need to set to 'ssl'

Joanne
Dharmakumar Gajendran
Greenhorn

Joined: Feb 22, 2010
Posts: 20
Hi Joanne,

Thanks for your suggestion. I have tried this. But still getting the same error.

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to do ssl authentication using ldaps
 
Similar Threads
LDAP server Access Error in java
hi
LDAP authentication using ssl
ldap authentication using ssl
cannot connect to LDAP through JNDI