cancel
Showing results for 
Search instead for 
Did you mean: 

Connect to LDAP use JNDI SSL

Former Member
0 Kudos

Hi all:

I want to connect to a LDAP use SSL, my code is like following.

Hashtable env = new Hashtable();

String ADuid = "user";

String ADpwd = "pwd";

env.put(Context.INITIAL_CONTEXT_FACTORY,

"com.sun.jndi.ldap.LdapCtxFactory");

env.put(Context.SECURITY_AUTHENTICATION,"simple");

env.put(Context.SECURITY_PRINCIPAL,ADuid);

env.put(Context.SECURITY_CREDENTIALS,ADpwd);

env.put(Context.SECURITY_PROTOCOL,"ssl");

env.put(Context.PROVIDER_URL, "ldaps://server address:636");

try {

System.setProperty("javax.net.ssl.trustStore","truststore");

System.setProperty("javax.net.ssl.trustStorePassword", 123456");

// Create the initial directory context

DirContext ctx = new InitialDirContext(env);

}catch(Exception ex){

wdComponentAPI.getComponent().getMessageManager().reportException(store + ex.toString(),false);

}

These code is tested sucessful on java application. But can't work on webdynpro program, it reports an Exception "javax.naming.CommunicationException: simple bind failed Root exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found] "

I've tryed to put the truststore on different DIR, but still not work. Does the method System.setProperty available on Web server? How to implement SSL certification?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Solved myself

0 Kudos

Hello

Could you please share the solution?

TIA

Best Regards

Maciej Gottfried

0 Kudos

Hi Wayne Lou,

I have same issue in connecting LDAP over SSL port 636 in Web Dynpro JAVA code.

could you please share your solution code or guide me to solve my issue.

Regards,

Lakshmi Narayana Kodavati,

Former Member
0 Kudos

Hi

My code work on other Web servers, what's the different of SAP WAS?

Former Member
0 Kudos

I know in VA we can add cert file in key storage, stored on TrustedCAs, but how to use the key store in Webdynpro?

Former Member
0 Kudos

chk it

Former Member
0 Kudos

Hi kanwalpreet:

Thank you for your link, but I can't get the key point from the link?Do you have some code sample or Guider of using keystore in web application?