https - 如何在 tomcat 中为特定项目设置 Java truststore 和 truststorepassword 属性?
问题描述
我在 tomcat 中运行两个应用程序,而 tomcat 在 https 上运行。我需要为 application1 发送证书,而 application2 不需要它。我在 application1 中配置 truststore 和 truststorepassword 以使用来自服务器“x”的服务。配置系统属性后,第二个应用程序正在发送证书,因此我从服务器“y”收到异常(不需要任何证书即可从第二个应用程序访问服务器)。我怎么解决这个问题 ?
在 application2 web.xml 中添加了 security-constraint 元素以禁用 url 模式的 SSL 选项:
<security-constraint>
<web-resource-collection>
<web-resource-name>ShipConsoleSCMCloud</web-resource-name>
<url-pattern>/application2/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
解决方案
不要使用系统属性。
根据您用于与服务通信的 API,它应该具有配置选项来专门为一个连接配置 TLS 参数,而不是仅仅将系统属性作为默认值。
推荐阅读
- angular - Angular 8 passing data to Child routes
- node.js - Nodejs Express API - Mongoose performance response (slow)
- excel - Using SUM function in cell formula yields #NAME error
- powershell - powershell query - how many OR can i use?
- javascript - 图表js onclick函数调用
- python - django 中的异常:查询集没有属性用户
- c# - 将对象列表绑定到 WPF listviewitem
- reactjs - TypeError:未定义不是一个对象(评估'state.routes.find')
- android-studio - 无法在我的自动完成文本视图中显示条码扫描文本
- python - 如何正确安装geopandas?