admin管理员组文章数量:1122833
I am trying to use my SOAP API with Apache CXF, but the API requires SSL client certificates. I saw that there is some XML-Config you can use, but I would like to do this programmatically. Setting the sslContext
within the tlsClientParameters
doesn't seem to work either. This is my code:
val service = SoapyService()
val port = service.soapyPort
val cond = ClientProxy.getClient(port).conduit
(cond as HTTPConduit).apply {
tlsClientParameters =
TLSClientParameters().apply {
sslContext = sslContextWithCert
}
}
val result = port.login(username, password)
But the server terminates the connection during SSL handshake due to missing certificate.
I am trying to use my SOAP API with Apache CXF, but the API requires SSL client certificates. I saw that there is some XML-Config you can use, but I would like to do this programmatically. Setting the sslContext
within the tlsClientParameters
doesn't seem to work either. This is my code:
val service = SoapyService()
val port = service.soapyPort
val cond = ClientProxy.getClient(port).conduit
(cond as HTTPConduit).apply {
tlsClientParameters =
TLSClientParameters().apply {
sslContext = sslContextWithCert
}
}
val result = port.login(username, password)
But the server terminates the connection during SSL handshake due to missing certificate.
Share Improve this question asked Nov 22, 2024 at 14:50 Ian RehwinkelIan Rehwinkel 2,6155 gold badges27 silver badges61 bronze badges1 Answer
Reset to default 0With an SSLContext already present, we can easily get the SSLSocketFactory from that.
Simply use sslSocketFactory = sslContextWithCert.socketFactory
instead of sslContext = sslContextWithCert
. This will make Apache CXF use the sockets from that factory, which (if you added your cert to that SSL context) will send the certificates with your requests.
本文标签: javaHow do I use a client certificate with Apache CXFStack Overflow
版权声明:本文标题:java - How do I use a client certificate with Apache CXF? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736303031a1931744.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论