summaryrefslogtreecommitdiff
path: root/pdf-over-gui
diff options
context:
space:
mode:
authorAndreas Abraham <andreas.abraham@egiz.gv.at>2021-01-19 15:35:18 +0100
committerAndreas Abraham <andreas.abraham@egiz.gv.at>2021-01-19 15:35:18 +0100
commitf449eee2e42c73a066475fe7c9dcbbe4fcdc0bb9 (patch)
treeebc4c5da8de6809bab68a2f36d41f574e8197e1b /pdf-over-gui
parent4d758910e41fbfeed78caf10e1c2bffe042df7ec (diff)
downloadpdf-over-f449eee2e42c73a066475fe7c9dcbbe4fcdc0bb9.tar.gz
pdf-over-f449eee2e42c73a066475fe7c9dcbbe4fcdc0bb9.tar.bz2
pdf-over-f449eee2e42c73a066475fe7c9dcbbe4fcdc0bb9.zip
changed urlconnection to apache http client, new pdf-as version added, a-trust url changed
Diffstat (limited to 'pdf-over-gui')
-rw-r--r--pdf-over-gui/pom.xml2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java47
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java57
4 files changed, 72 insertions, 37 deletions
diff --git a/pdf-over-gui/pom.xml b/pdf-over-gui/pom.xml
index 73964384..3fd6bd71 100644
--- a/pdf-over-gui/pom.xml
+++ b/pdf-over-gui/pom.xml
@@ -642,7 +642,7 @@
<version>1.4</version>
<configuration>
<keystore>${ks-file}</keystore>
- <alias>a-sit-3</alias>
+ <alias>code_signing</alias>
<storepass>${ks-pass}</storepass>
<keypass>${ks-pass}</keypass>
<keystoreConfig>
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
index 105eedd5..fe631614 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
@@ -94,7 +94,8 @@ public class Constants {
/** Default Mobile BKU URL */
//public static final String DEFAULT_MOBILE_BKU_URL = "https://test1.a-trust.at/mobile2/https-security-layer-request/default.aspx";//"https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$
- public static final String DEFAULT_MOBILE_BKU_URL = "https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$
+ //public static final String DEFAULT_MOBILE_BKU_URL = "https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$
+ public static final String DEFAULT_MOBILE_BKU_URL = "https://www.handy-signatur.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$
/** Default Mobile BKU type */
public static final MobileBKUs DEFAULT_MOBILE_BKU_TYPE = MobileBKUs.A_TRUST;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
index 7d3f986a..613af38f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java
@@ -504,13 +504,49 @@ public class ATrustHandler extends MobileBKUHandler {
Status serverStatus = null;
int waits = 0;
final String ERROR = "Error: Server is not responding"; //$NON-NLS-1$
-
+ HttpClient client;
+
+ //Connection: keep-alive
try {
do {
- urlconnection = new URL(status.getBaseURL() + "/UndecidedPolling.aspx?sid=" + status.getSessionID()) //$NON-NLS-1$
- .openConnection();
- InputStream in = new BufferedInputStream(urlconnection.getInputStream());
+
+ String baseURL = "https://www.handy-signatur.at/mobile/https-security-layer-request";
+
+ client = MobileBKUHelper.getHttpClient(getStatus());
+ String uri = status.getBaseURL() + "/UndecidedPolling.aspx?sid=" + status.getSessionID();
+ GetMethod get = new GetMethod(uri);
+
+ status.getBaseURL();
+ //urlconnection = new URL(status.getBaseURL() + "/UndecidedPolling.aspx?sid=" + status.getSessionID()) //$NON-NLS-1$
+ // .openConnection();
+
+
+ // GET /mobile/https-security-layer-request/UndecidedPolling.aspx?sid=A3_RFOOXWTJGFOQXHZSXIWQPSZQCHBA&_=1610983069567 HTTP/2
+ // Host: www.handy-signatur.at
+ // User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0
+ // Accept: application/json, text/javascript, */*; q=0.01
+ // Accept-Language: de,en-US;q=0.7,en;q=0.3
+ // Accept-Encoding: gzip, deflate, br
+ // DNT: 1
+ // Connection: keep-alive
+ // Referer: https://www.handy-signatur.at/mobile/https-security-layer-request/undecided.aspx?sid=A3_RFOOXWTJGFOQXHZSXIWQPSZQCHBA
+ // Cookie: ASP.NET_SessionId=hbplnlm1l5gv25rgknfqc3zt
+ // TE: Trailers
+
+ client.setTimeout(35000);
+ client.setConnectionTimeout(35000);
+ get.addRequestHeader("Accept", "application/json, text/javascript");
+ get.addRequestHeader("Connection", "keep-alive");
+ get.addRequestHeader("Referer", uri);
+ System.out.println("URL" + uri);
+ System.out.println("Cookies " + getStatus().getCookies());
+
+
+ int returnValue = client.executeMethod(get);
+ System.out.println("retVal" + returnValue);
+ //InputStream in = new BufferedInputStream(urlconnection.getInputStream());
+ InputStream in = new BufferedInputStream(get.getResponseBodyAsStream());
isReady = IOUtils.toString(in, "utf-8"); //$NON-NLS-1$
serverStatus = new Status(isReady);
@@ -535,7 +571,8 @@ public class ATrustHandler extends MobileBKUHandler {
} catch (Exception e) {
log.error("handle polling failed" + e.getMessage()); //$NON-NLS-1$
- throw new ATrustConnectionException();
+ //throw new ATrustConnectionException();
+ return false;
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
index 116d5bb2..8a416676 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
@@ -542,42 +542,39 @@ public class MobileBKUState extends State {
}
}
}, 0, 5000);
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- MobileBKUFingerprintComposite fingerprintComposite = getMobileBKUFingerprintComposite();
-
- fingerprintComposite.setRefVal(status.getRefVal());
- fingerprintComposite.setSignatureData(status.getSignatureDataURL());
- fingerprintComposite.setErrorMessage(status.getErrorMessage());
- getStateMachine().getGUIProvider().display(fingerprintComposite);
-
- Display display = getStateMachine().getGUIProvider().getMainShell().getDisplay();
- while (!fingerprintComposite.isUserCancel() && !fingerprintComposite.isUserSMS() && !fingerprintComposite.isDone()) {
- if (!display.readAndDispatch()) {
- display.sleep();
- }
+ Display.getDefault().syncExec(() -> {
+ MobileBKUFingerprintComposite fingerprintComposite = getMobileBKUFingerprintComposite();
+
+ fingerprintComposite.setRefVal(status.getRefVal());
+ fingerprintComposite.setSignatureData(status.getSignatureDataURL());
+ fingerprintComposite.setErrorMessage(status.getErrorMessage());
+ getStateMachine().getGUIProvider().display(fingerprintComposite);
+
+ Display display = getStateMachine().getGUIProvider().getMainShell().getDisplay();
+ while (!fingerprintComposite.isUserCancel() && !fingerprintComposite.isUserSMS() && !fingerprintComposite.isDone()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
}
- checkDone.cancel();
+ }
+ checkDone.cancel();
- if (fingerprintComposite.isUserCancel()) {
- fingerprintComposite.setUserCancel(false);
- status.setErrorMessage("cancel"); //$NON-NLS-1$
- return;
- }
+ if (fingerprintComposite.isUserCancel()) {
+ fingerprintComposite.setUserCancel(false);
+ status.setErrorMessage("cancel"); //$NON-NLS-1$
+ return;
+ }
- if (fingerprintComposite.isUserSMS()) {
+ if (fingerprintComposite.isUserSMS()) {
// fingerprintComposite.setUserSMS(false);
- status.setQRCode(null);
- }
+ status.setQRCode(null);
+ }
- if (fingerprintComposite.isDone())
- fingerprintComposite.setDone(false);
+ if (fingerprintComposite.isDone())
+ fingerprintComposite.setDone(false);
- // show waiting composite
- getStateMachine().getGUIProvider().display(
- MobileBKUState.this.getWaitingComposite());
- }
+ // show waiting composite
+ getStateMachine().getGUIProvider().display(
+ MobileBKUState.this.getWaitingComposite());
});
}