diff options
author | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2016-11-03 16:18:04 +0100 |
---|---|---|
committer | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2016-11-03 16:18:04 +0100 |
commit | 41b68bbd1b549481aa8603059ed32b8fdd72a3db (patch) | |
tree | 21c474bfb32f5c8b7c76fca9011b4f7a84a4b720 | |
parent | 33dfef091acd2d28e68658c8e0bcb4e67027d1e1 (diff) | |
download | mocca-41b68bbd1b549481aa8603059ed32b8fdd72a3db.tar.gz mocca-41b68bbd1b549481aa8603059ed32b8fdd72a3db.tar.bz2 mocca-41b68bbd1b549481aa8603059ed32b8fdd72a3db.zip |
Only set HostnameVerifier if SSL checks disabled
-rw-r--r-- | bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java index 4f9260d2..8891cce7 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java @@ -129,6 +129,10 @@ public class HTTPBindingProcessorImpl extends AbstractBindingProcessor implement public static final String ALLOW_OTHER_REDIRECTS = "AllowOtherRedirects"; + public static final String SSL_DISSABLE_HOSTNAME_VERIFICATION = "SSL.disableHostnameVerification"; + + public static final String SSL_DISSABLE_ALL_CHECKS = "SSL.disableAllChecks"; + public int getMaxDataUrlHops() { return configuration.getInt(DATAURLCLIENT_MAXHOPS, 10); } @@ -187,6 +191,14 @@ public class HTTPBindingProcessorImpl extends AbstractBindingProcessor implement public boolean getAllowOtherRedirects() { return configuration.getBoolean(ALLOW_OTHER_REDIRECTS, false); } + + public boolean disableSslHostnameVerification() { + return configuration.getBoolean(SSL_DISSABLE_HOSTNAME_VERIFICATION, false); + } + + public boolean disableAllSslChecks() { + return configuration.getBoolean(SSL_DISSABLE_ALL_CHECKS, false); + } } /** @@ -388,7 +400,8 @@ public class HTTPBindingProcessorImpl extends AbstractBindingProcessor implement // set user agent and signature layout headers conn.setHTTPHeader(HttpUtil.HTTP_HEADER_USER_AGENT, getServerHeaderValue()); conn.setHTTPHeader(HttpUtil.HTTP_HEADER_SIGNATURE_LAYOUT, getSignatureLayoutHeaderValue()); - conn.setHostnameVerifier(hostnameVerifier); + if (configurationFacade.disableAllSslChecks() || configurationFacade.disableSslHostnameVerification()) + conn.setHostnameVerifier(hostnameVerifier); conn.setSSLSocketFactory(sslSocketFactory); // set transfer headers |