CXF with client certificate wuthentication
CXF with client certificate wuthentication
First of all, please excuse me for may bad English.
So i need help. Over a week i have a problem and can't find solution.
<wsdl:definitions name="EDeliveryIntegrationService" targetNamespace="http://tempuri.org/">
<wsp:Policy wsu:Id="BasicHttpBinding_IEDeliveryIntegrationService_policy">
<wsp:ExactlyOne>
<wsp:All>
<wsoma:OptimizedMimeSerialization/>
<sp:TransportBinding>
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false"/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy></wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Lax/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
</wsp:Policy>
</sp:TransportBinding>
<sp:EndorsingSupportingTokens>
<wsp:Policy>
<sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssX509V3Token10/>
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:EndorsingSupportingTokens>
<sp:Wss10>
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier/>
<sp:MustSupportRefIssuerSerial/>
</wsp:Policy>
</sp:Wss10>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
........
.......
</wsdl:definitions>
I'm using apache CXF without spring, and can't find wаy to add client certificate for authentication.
Any help?
EDIT
Hm. I don't have a problem with HTTPS. In my source I have somethhing like this:
SSLContext sslCtx = null;
sslCtx = SSLContext.getInstance("TLSv1.2");
/************** TRUST STORE *****************/
KeyStore trustStore = KeyStore.getInstance("jks");
trustStore.load(new FileInputStream(pathToStore), passForStore.toCharArray());
TrustManagerFactory tmf = TrustManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
tmf.init(trustStore);
// ***************** KEY STORE *********************/
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory
.getDefaultAlgorithm());
KeyStore keyStore = KeyStore.getInstance("PKCS12");
FileInputStream keyStoreIn = new FileInputStream(pathToCert);
keyStore.load(keyStoreIn, passForCert.toCharArray()); // This is jks key
kmf.init(keyStore, passForCert.toCharArray()); // this is pk key
sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
ctxt.put("com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory",
sslCtx.getSocketFactory());
ctxt.put("com.sun.xml.ws.transport.https.client.SSLSocketFactory",
sslCtx.getSocketFactory());
The adres is public (https://edelivery.egov.bg/Services/EDeliveryIntegrationService.svc?wsdl)
Problem happens when you try to use some endpoint. Then u need to use certificate.
This is some kind authentication like usernamae/password but how to set certificate?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
did you check that stackoverflow.com/questions/1666052/…
– Sai prateek
2 days ago