Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpHost;
Expand Down Expand Up @@ -116,8 +115,9 @@ public void initialize(ClientConfiguration config) {
if (tlsConfig.isHostnameVerification()) {
sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslCtx);
} else {
sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslCtx,
NoopHostnameVerifier.INSTANCE);
logConfig.warn("Hostname verification is disabled in configuration. " +
"This setting is ignored for security reasons. Hostname verification will remain active.");
sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslCtx);
}

if (tlsConfig.getSslContext() == null && sslCtx != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public class MssServiceFactory<PortType> extends BasePooledObjectFactory<MssServ
private static final String JDK_JAXWS_REQUEST_TIMEOUT = "com.sun.xml.internal.ws.request.timeout";
private static final String JBOSS_CXF_REQUEST_TIMEOUT = "javax.xml.ws.client.receiveTimeout";

private static final java.lang.String JAXWS_HOSTNAME_VERIFIER = "com.sun.xml.internal.ws.transport.https.client.hostname.verifier";
private static final java.lang.String JAXWS_SSL_SOCKET_FACTORY = "com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory";

private static final String MSSP_NAMESPACE = "http://uri.etsi.org/TS102204/etsi204-kiuru.wsdl";
Expand Down Expand Up @@ -150,9 +149,8 @@ private MssService<PortType> createMssService() {
bindingProvider.getRequestContext().put(JAXWS_SSL_SOCKET_FACTORY, sslSocketFactory);

if (!clientConfiguration.getTls().isHostnameVerification()) {
NoopHostnameVerifier noopHostnameVerifier = new NoopHostnameVerifier();
bindingProvider.getRequestContext().put(JAXWSProperties.HOSTNAME_VERIFIER, noopHostnameVerifier);
bindingProvider.getRequestContext().put(JAXWS_HOSTNAME_VERIFIER, noopHostnameVerifier);
log.warn("MSS Soap client: Hostname verification is disabled in configuration. " +
"This setting is ignored for security reasons. Hostname verification will remain active.");
}

String serviceBaseUrl = serviceUrlSupplier.get();
Expand Down Expand Up @@ -300,13 +298,4 @@ private KeyStore produceATrustStore(TlsConfiguration tlsConfig) {
}
}

// ----------------------------------------------------------------------------------------------------

private static class NoopHostnameVerifier implements HostnameVerifier {
@Override
public boolean verify(String hostName, SSLSession session) {
return true;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.ByteArrayOutputStream;
import java.util.Set;

import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.OutputKeys;
Expand Down Expand Up @@ -134,6 +135,8 @@ private String convertToUnformattedString(SOAPMessage soapMessage) {
private String convertToPrettyPrintedMessage(SOAPMessage soapMessage) {
try {
TransformerFactory tff = TransformerFactory.newInstance();
tff.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
tff.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
Transformer tf = tff.newTransformer();
// Set formatting
tf.setOutputProperty(OutputKeys.INDENT, "yes");
Expand Down
Loading