How do I use JNDI to pass parameters to an LDAP custom socket factory?
•
Java
I am using JNDI to establish an LDAP connection Example:
Hashtable env = new Hashtable(); env.put(Context.PROVIDER_URL,LDAPS_URL); env.put(Context.Security_AUTHENTICATION,"EXTERNAL"); env.put("java.naming.ldap.factory.socket","ldaptest.CustomSocketFactory"); ...
I need to pass the parameters to customsocketfactory at run time Especially the reference to the client certificate
How can I do this? I can use thread local storage
Is there a better way?
Solution
I think you may be looking for something like this:
env.put("javax.net.ssl.keyStore",keystorePath); //Where keystorePath is the path to the Keys file resource env.put("javax.net.ssl.keyStorePassword","password");
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码