How can I register webservice through OSGi (karaf) API with custom trustManager

≯℡__Kan透↙ 提交于 2019-12-04 22:13:01

Karaf uses Pax Web for the HttpService implementation, plus a lot more. In general a X509certificate will be needed if a SSL based connection is used. So you just need to configure the HttpService accordingly to the OSGi spec and with special Pax Web properties.

To enable SSL support you must set the following properties:
org.osgi.service.http.secure.enabled to true
org.ops4j.pax.web.ssl.keystore to the path to the keystore to be used. If not set the default path ${user.home}/.keystore is used.
org.ops4j.pax.web.ssl.password to the password used for keystore integrity check. The value can be in plain text or obfuscated ( starting with OBF: ) as described in step 4 of jetty docummentation
org.ops4j.pax.web.ssl.keypassword to the password used for keystore. The value can be in plain text or obfuscated ( starting with OBF: ) as described in step 4 of jetty docummentation
You may also set the following:
org.osgi.service.http.port.secure to change the port. Default is 8443.

Additionally for Certificates you'll need to set the following: org.ops4j.pax.web.ssl.clientauthwanted=wanted
This property specifies, if certificate-based client authentication at the server is "wanted".

org.ops4j.pax.web.ssl.clientauthneeded=required
This property specifies, if certificate-based client authentication at the server is "required".

More details may be found at the Pax Web project. Also there are samples available at the projects GitHub Project.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!