引用Running the client with SSL/TLS .这解释了服务器执行客户端身份验证的场景。我正在使用 Spring Integration 来处理 TLS 连接。我的 spring-context 文件是:
<bean id="sslContextSupport"
class="org.springframework.integration.ip.tcp.connection.DefaultTcpSSLContextSupport">
<constructor-arg value="file:keystore.jks"/>
<constructor-arg value="file:truststore.jks"/>
<constructor-arg value="keystorepass"/>
<constructor-arg value="trustpass"/>
</bean>
<int-ip:tcp-connection-factory id="crLfServer"
type="server"
port="${availableServerSocket}"
single-use="true"
so-timeout="10000"
using-nio="false"
ssl-context-support="sslContextSupport" />
我的服务器正在接受 SSL 连接并使用安装在我的服务器和客户端上的证书进行处理。 我不确定上面的 spring 配置是否设置为客户端身份验证。客户端身份验证是在 SSL 传输级别还是在应用程序代码中完成的?
最佳答案
Spring 集成 DefaultTcpSSLContextSupport
完全基于 SSLContext sslContext = SSLContext.getInstance(protocol);
.因此,您在标准 Java SSL/TLS 文档中看到的内容也适用于此处。
因为你的<int-ip:tcp-connection-factory>
产生 type="server",这绝对是
the server does client authentication
所有艰苦的 SSL 工作都在 SSLContext
中完成层,不在 TcpNetServerConnectionFactory
中,如果这是问题的话。
换句话说:是不是Spring Integration并不重要。一切都以与使用标准 SSL/TLS 方法的任何其他 Java 应用程序相同的方式工作。
关于java - 如何设置 TLS 服务器以在 spring 集成中验证客户端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37754652/