有没有一种方法可以配置 Web 应用程序(通过 web.xml)以允许使用我们的证书连接到 SSL 站点,类似于 curl
的 -k
选项?
-k, --insecure 允许连接到没有证书的 SSL 站点 (H)
例如使用 curl 我们可以这样做:
# curl -vk --data "appip=adsfa123&login=testt@jelastic.com&password=adfas1123" https://app.sample-jelastic-server.com/1.0/users/authentication/cross/signin
我的问题是我的 Web 应用程序无法从容器内(或从服务器)访问使用 HTTPS 的站点。
它抛出这个错误:
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
有了这个,我认为如果我们可以配置 web.xml 以允许在没有证书的情况下连接到 SSL 站点,那么应该可以解决这个问题。
最佳答案
您需要在 standalone.conf
中添加以下内容文件。
JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.trustStore=/<Path>/conf/xyz.keystore -Djavax.net.ssl.trustStorePassword=password"
在xyz.keystore
, 添加您尝试调用的应用程序的证书。系统 keystore 由 wildfly 自动添加。
您可以调试 ssl 请求和响应您可以将另一个配置添加到 wildfly 启动 -Djavax.net.debug=all
更多信息 here
关于java - Wildfly - 允许在没有证书的情况下连接到 SSL 站点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43088329/