summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-07-24 14:58:29 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-07-24 14:58:29 +0000
commitace0e313c742fa8542ffbf1c8b119547ce40a69c (patch)
treeae50be867062631f2b41a7088ad1d13fae17a234
parentd5047b55ca5fc5ad2b72ca376becd6944bf4efd7 (diff)
downloadpdf-over-ace0e313c742fa8542ffbf1c8b119547ce40a69c.tar.gz
pdf-over-ace0e313c742fa8542ffbf1c8b119547ce40a69c.tar.bz2
pdf-over-ace0e313c742fa8542ffbf1c8b119547ce40a69c.zip
Move TrustedSocketFactory registration
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@471 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHandler.java11
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/IAIKHandler.java13
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHandler.java5
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHelper.java10
4 files changed, 18 insertions, 21 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHandler.java
index 78153156..70502e64 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHandler.java
@@ -20,7 +20,6 @@ import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.protocol.Protocol;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -89,10 +88,8 @@ public class ATrustHandler extends MobileBKUHandler {
@Override
public String postCredentials() throws Exception {
ATrustStatus status = getStatus();
-
- Protocol.registerProtocol("https", //$NON-NLS-1$
- new Protocol("https", new TrustedSocketFactory(), 443)); //$NON-NLS-1$
-
+
+ MobileBKUHelper.registerTrustedSocketFactory();
HttpClient client = MobileBKUHelper.getHttpClient();
PostMethod post = new PostMethod(status.getBaseURL() + "/identification.aspx?sid=" + status.getSessionID()); //$NON-NLS-1$
@@ -161,9 +158,7 @@ public class ATrustHandler extends MobileBKUHandler {
public String postTAN() throws IOException {
ATrustStatus status = getStatus();
- Protocol.registerProtocol("https", //$NON-NLS-1$
- new Protocol("https", new TrustedSocketFactory(), 443)); //$NON-NLS-1$
-
+ MobileBKUHelper.registerTrustedSocketFactory();
HttpClient client = MobileBKUHelper.getHttpClient();
PostMethod post = new PostMethod(status.getBaseURL()
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/IAIKHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/IAIKHandler.java
index 1587b66b..21f5e318 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/IAIKHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/IAIKHandler.java
@@ -24,7 +24,6 @@ import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.protocol.Protocol;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -96,10 +95,8 @@ public class IAIKHandler extends MobileBKUHandler {
@Override
public String postCredentials() throws Exception {
IAIKStatus status = getStatus();
-
- Protocol.registerProtocol("https", //$NON-NLS-1$
- new Protocol("https", new TrustedSocketFactory(), 443)); //$NON-NLS-1$
-
+
+ MobileBKUHelper.registerTrustedSocketFactory();
HttpClient client = MobileBKUHelper.getHttpClient();
PostMethod post = new PostMethod(status.getBaseURL());
@@ -236,10 +233,8 @@ public class IAIKHandler extends MobileBKUHandler {
@Override
public String postTAN() throws Exception {
IAIKStatus status = getStatus();
-
- Protocol.registerProtocol("https", //$NON-NLS-1$
- new Protocol("https", new TrustedSocketFactory(), 443)); //$NON-NLS-1$
-
+
+ MobileBKUHelper.registerTrustedSocketFactory();
HttpClient client = MobileBKUHelper.getHttpClient();
PostMethod post = new PostMethod(status.getBaseURL());
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHandler.java
index 4448bdd3..e9cee855 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHandler.java
@@ -28,7 +28,6 @@ import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.httpclient.methods.multipart.StringPart;
-import org.apache.commons.httpclient.protocol.Protocol;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -74,9 +73,7 @@ public abstract class MobileBKUHandler {
log.debug("SL Request: " + sl_request); //$NON-NLS-1$
- Protocol.registerProtocol("https", //$NON-NLS-1$
- new Protocol("https", new TrustedSocketFactory(), 443)); //$NON-NLS-1$
-
+ MobileBKUHelper.registerTrustedSocketFactory();
HttpClient client = MobileBKUHelper.getHttpClient();
PostMethod post = new PostMethod(mobileBKUUrl);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHelper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHelper.java
index 65ffc9b0..d4c510e1 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHelper.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/MobileBKUHelper.java
@@ -22,6 +22,7 @@ import java.util.regex.Pattern;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.protocol.Protocol;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -175,4 +176,13 @@ public class MobileBKUHelper {
return client;
}
+
+ /**
+ * Register our TrustedSocketFactory for https connections
+ */
+ @SuppressWarnings("deprecation")
+ public static void registerTrustedSocketFactory() {
+ Protocol.registerProtocol("https", //$NON-NLS-1$
+ new Protocol("https", new TrustedSocketFactory(), 443)); //$NON-NLS-1$
+ }
}