让Web服务使用SSL
在WildFly 8.2.1中,我试图使现有的Web服务(JAX-WS)使用SSL,但我还没有在quickstarts中看到任何SSL的使用,而且我能够在google上搜索到的信息是有限的。到目前为止,我已经在web.xml中添加了以下内容:让Web服务使用SSL,ssl,wsdl,jax-ws,wildfly,wildfly-8,Ssl,Wsdl,Jax Ws,Wildfly,Wildfly 8,在WildFly 8.2.1中,我试图使现有的Web服务(JAX-WS)使用SSL,但我还没有在quickstarts中看到任何SSL的使用,而且我能够在google上搜索到的信息是有限的。到目前为止,我已经在web.xml中添加了以下内容: <security-constraint> <display-name>Foo security</display-name> <web-resource-collection>
<security-constraint>
<display-name>Foo security</display-name>
<web-resource-collection>
<web-resource-name>FooService</web-resource-name>
<url-pattern>/foo/FooService</url-pattern>
<http-method>POST</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
请注意,在EAR/WAR中,soap:address.location
只填充了一个占位符(我假设该值被忽略)
我已经找到了一些关于设置安全领域和使用keytool创建自签名证书的信息(我已经找到了),但是我完全不知道如何将它们链接在一起
我还尝试设置
wsdl uri scheme=https
,但这仅在CXF的更高版本中受支持。似乎在替换soap:address.location
值时不会忽略它,由于将其从替换为\u实际\u URL
更改为https://REPLACE_WITH_ACTUAL_URL
成功了-现在服务在https://localhost:8443
在standalone.xml
中,我还需要执行几个步骤:在undertow
中,添加https侦听器
:
<https-listener name="secure" socket-binding="https" security-realm="SslRealm"/>
定义SslRealm:
<security-realm name="SslRealm">
<server-identities>
<ssl>
<keystore path="foo.keystore" relative-to="jboss.server.config.dir" keystore-password="foo1234" alias="foo" key-password="foo1234"/>
</ssl>
</server-identities>
<authentication>
<truststore path="foo.truststore" relative-to="jboss.server.config.dir" keystore-password="foo1234"/>
</authentication>
</security-realm>
注意,我在这里为服务器和客户端重用了相同的密钥库。由于我的客户机在开发过程中位于同一WF节点中,因此我也必须在那里设置客户端部分:
<system-properties>
<property name="javax.net.ssl.trustStore" value="${jboss.server.config.dir}/foo.keystore"/>
<property name="javax.net.ssl.trustStorePassword" value="foo1234"/>
<property name="org.jboss.security.ignoreHttpsHost" value="true"/>
</system-properties>
WF 9+中的最后一个属性应替换为cxf.tls client.disableCNCheck
链接到JBoss论坛:
<security-realm name="SslRealm">
<server-identities>
<ssl>
<keystore path="foo.keystore" relative-to="jboss.server.config.dir" keystore-password="foo1234" alias="foo" key-password="foo1234"/>
</ssl>
</server-identities>
<authentication>
<truststore path="foo.truststore" relative-to="jboss.server.config.dir" keystore-password="foo1234"/>
</authentication>
</security-realm>
<system-properties>
<property name="javax.net.ssl.trustStore" value="${jboss.server.config.dir}/foo.keystore"/>
<property name="javax.net.ssl.trustStorePassword" value="foo1234"/>
<property name="org.jboss.security.ignoreHttpsHost" value="true"/>
</system-properties>