如何使用JNDI将参数传递给LDAP自定义套接字工厂? [英] How to pass arguments to an LDAP custom socket factory with JNDI?

查看:178
本文介绍了如何使用JNDI将参数传递给LDAP自定义套接字工厂?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JNDI建立LDAP连接。示例:

I'm using JNDI to make LDAP connections. 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");
...

我需要在运行时将参数传递给CustomSocketFactory。特别是对客户证书的引用。

I need to pass parameters at run time to the CustomSocketFactory. Specifically a reference to a client certificate.

我该怎么做?
我可以使用线程本地存储。

How can I do this? I could use thread local storage.

有更好的方法吗?

推荐答案

实际上,本地线程只是解决这个问题的方法。
我在这里发布了我的解决方案:

Actually thread local is only way to solve this I found so far. I posted my solution here:

jndi LDAPS自定义HostnameVerifier和TrustManager

这篇关于如何使用JNDI将参数传递给LDAP自定义套接字工厂?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆