diff options
Diffstat (limited to 'id/server/idserverlib/src/main/java/at')
4 files changed, 62 insertions, 45 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/proxy/DefaultConnectionBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/proxy/DefaultConnectionBuilder.java index a742a0aae..7f0dfe509 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/proxy/DefaultConnectionBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/proxy/DefaultConnectionBuilder.java @@ -19,21 +19,22 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; -import at.gv.egovernment.moa.util.URLEncoder; //java.net.URLEncoder; import java.util.Iterator; import java.util.Vector; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocketFactory; import javax.servlet.http.HttpServletRequest; import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider; -import at.gv.egovernment.moa.id.util.MOAIDMessageProvider; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.BoolUtils; +import at.gv.egovernment.moa.util.URLEncoder; + -//import com.sun.net.ssl.HostnameVerifier; -//import com.sun.net.ssl.HttpsURLConnection; /** * Defaultimplementierung von <code>ConnectionBuilder</code>. @@ -97,13 +98,14 @@ public class DefaultConnectionBuilder implements ConnectionBuilder { //conn.setAllowUserInteraction(true); conn.setInstanceFollowRedirects(false); - // JSSE-Abhängigkeit - /*if (conn instanceof HttpsURLConnection && sslSocketFactory != null) { + // JSSE Abhängigkeit + if (conn instanceof HttpsURLConnection && sslSocketFactory != null) { HttpsURLConnection httpsConn = (HttpsURLConnection) conn; httpsConn.setSSLSocketFactory(sslSocketFactory); if (cbDisableHostnameVerification) httpsConn.setHostnameVerifier(new HostnameNonVerifier()); - }*/ + } + return conn; } @@ -155,15 +157,19 @@ public class DefaultConnectionBuilder implements ConnectionBuilder { */ // JSSE Abhängigkeit - //private class HostnameNonVerifier implements HostnameVerifier { - + private class HostnameNonVerifier implements HostnameVerifier { + + public boolean verify(String hostname, SSLSession session) { + return true; + } + + /** * @see com.sun.net.ssl.HostnameVerifier#verify(String, String) */ -//JSSE Abhängigkeit -// public boolean verify(String arg0, String arg1) { -// return true; -// } -// } + /*public boolean verify(String arg0, String arg1) { + return true; + }*/ + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/proxy/ElakConnectionBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/proxy/ElakConnectionBuilder.java index c8c1e85d9..6810c9223 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/proxy/ElakConnectionBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/proxy/ElakConnectionBuilder.java @@ -18,17 +18,15 @@ package at.gv.egovernment.moa.id.proxy; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; - -import com.ibm.webdav.HTTPHeaders; -import com.ibm.webdav.protocol.URLStreamHandlerFactory; -import com.ibm.webdav.protocol.http.WebDAVURLConnection; -import java.util.StringTokenizer; import java.net.URL; -import at.gv.egovernment.moa.util.URLEncoder; //java.net.URLEncoder; import java.net.URLStreamHandler; import java.util.Iterator; +import java.util.StringTokenizer; import java.util.Vector; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocketFactory; import javax.servlet.http.HttpServletRequest; @@ -37,9 +35,10 @@ import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider; import at.gv.egovernment.moa.id.util.MOAIDMessageProvider; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.BoolUtils; +import at.gv.egovernment.moa.util.URLEncoder; + +import com.ibm.webdav.protocol.http.WebDAVURLConnection; -//import com.sun.net.ssl.HostnameVerifier; -//import com.sun.net.ssl.HttpsURLConnection; /** * Defaultimplementierung von <code>ConnectionBuilder</code>. @@ -199,12 +198,12 @@ public class ElakConnectionBuilder implements ConnectionBuilder { webDavConn.setAllowUserInteraction(true); webDavConn.setInstanceFollowRedirects(false); // JSSE Abhängigkeit -// if (conn instanceof HttpsURLConnection && sslSocketFactory != null) { -// HttpsURLConnection httpsConn = (HttpsURLConnection) conn; -// httpsConn.setSSLSocketFactory(sslSocketFactory); -// if (cbDisableHostnameVerification) -// httpsConn.setHostnameVerifier(new HostnameNonVerifier()); -// } + if (conn instanceof HttpsURLConnection && sslSocketFactory != null) { + HttpsURLConnection httpsConn = (HttpsURLConnection) conn; + httpsConn.setSSLSocketFactory(sslSocketFactory); + if (cbDisableHostnameVerification) + httpsConn.setHostnameVerifier(new HostnameNonVerifier()); + } return conn; } @@ -253,15 +252,20 @@ public class ElakConnectionBuilder implements ConnectionBuilder { * Hostname Verification Check */ //JSSE Abhängigkeit -// private class HostnameNonVerifier implements HostnameVerifier { + private class HostnameNonVerifier implements HostnameVerifier { - /** + public boolean verify(String hostname, SSLSession session) { + // TODO Auto-generated method stub + return true; + } + /** * @see com.sun.net.ssl.HostnameVerifier#verify(String, String) */ -//JSSE Abhängigkeit // public boolean verify(String arg0, String arg1) { // return true; // } -// } + + + } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/proxy/EnhancedConnectionBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/proxy/EnhancedConnectionBuilder.java index 9ce1e3c8e..4af2561b2 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/proxy/EnhancedConnectionBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/proxy/EnhancedConnectionBuilder.java @@ -21,20 +21,19 @@ import java.net.URLStreamHandler; import java.util.Iterator; import java.util.Vector; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocketFactory; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; +import HTTPClient.HTTPConnection; +import HTTPClient.HttpURLConnection; import at.gv.egovernment.moa.id.config.ConfigurationException; import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider; import at.gv.egovernment.moa.id.util.MOAIDMessageProvider; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.BoolUtils; -//import com.sun.net.ssl.HostnameVerifier; -import HTTPClient.HttpURLConnection; -import HTTPClient.HTTPConnection; - /** * Outlook Web Access (OWA) Implementierung von <code>ConnectionBuilder</code>. @@ -161,17 +160,21 @@ public class EnhancedConnectionBuilder implements ConnectionBuilder { * Hostname Verification Check */ // JSSE Abhängigkeit - //private class HostnameNonVerifier implements HostnameVerifier { + private class HostnameNonVerifier implements HostnameVerifier { - /** + /** * @see com.sun.net.ssl.HostnameVerifier#verify(String, String) */ - // JSSE Abhängigkeit -// public boolean verify(String arg0, String arg1) { + public boolean verify(String hostname, SSLSession session) { + return true; + } + +// public boolean verify(String arg0, String arg1) { // return true; // } -// } -// + + } + /** * Removes parameters from the query-URL recursively * diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/SSLUtils.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/SSLUtils.java index bf38c40d9..e287e7118 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/SSLUtils.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/SSLUtils.java @@ -20,6 +20,7 @@ import iaik.pki.PKIException; import iaik.pki.PKIFactory; import iaik.pki.PKIProfile; import iaik.pki.jsse.IAIKX509TrustManager; +import iaik.security.provider.IAIK; import java.io.BufferedInputStream; import java.io.BufferedReader; @@ -69,8 +70,11 @@ public class SSLUtils { public static void initialize() { sslSocketFactories = new HashMap(); // JSSE Abhängigkeit -// Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); -// System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); + //Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + Security.addProvider(new IAIK()); + //System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); + + } /** |