using spring-ldap with ssl(使用带有 ssl 的 spring-ldap)
问题描述
我需要通过带有 SSL 的 spring-ldap 与 LDAP 服务器通信,而另一端也有一个自签名证书.
I need to talk to an LDAP server via spring-ldap with SSL, and the other end has a self-signed certificate no less.
哪位好心人可以指点我一些设置说明吗?
Can any kind soul please point me to some instructions for setting this up?
推荐答案
查看Spring LDAP 用于通过 HTTP(S) 连接到 LDAP 服务器的文档:
Check out Spring LDAP documentation for connecting to LDAP server over HTTP(S):
就自签名证书而言,您可以将证书链导入信任库并设置以下 VM 参数:
As far as self signed certificate is concerned, you can import certificate chain into a truststore and set the following VM arguments:
-Djavax.net.ssl.trustStore="<path to truststore file>"
-Djavax.net.ssl.trustStorePassword="<passphrase for truststore>"
或在运行时覆盖信任库,例如:
or override the truststore at runtime like:
System.setProperty("javax.net.ssl.trustStore","<path to truststore file>");
System.setProperty("javax.net.ssl.trustStorePassword","<passphrase for truststore>");
请记住,这两个选项都会覆盖默认的 JVM 信任库.因此,如果您使用不同的证书访问不同的站点,您可能希望将它们全部导入一个信任库.
Keep in mind that both options will override default JVM truststore. So if you are hitting different sites with different certs, you may want to import all of them into one truststore.
如果您在创建信任库文件时需要帮助,请参阅:数字证书:如何将 .cer 文件导入到 .truststore 文件中?
In case you need help creating truststore file, refer to this: Digital Certificate: How to import .cer file in to .truststore file using?
这篇关于使用带有 ssl 的 spring-ldap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用带有 ssl 的 spring-ldap


基础教程推荐
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 大摇大摆的枚举 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 多个组件的复杂布局 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01