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

查看:36
本文介绍了如何使用 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天全站免登陆