From 2f20884b7899d2c044646273f226cb9071408e54 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Wed, 31 Jul 2019 16:31:07 +0200 Subject: additional dynamically generated values are read from the html string and set when sending post --- .../src/main/java/at/asit/pdfover/gui/Constants.java | 1 + .../java/at/asit/pdfover/gui/bku/MobileBKUConnector.java | 2 +- .../at/asit/pdfover/gui/bku/mobile/ATrustHandler.java | 13 ++++++++----- .../java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 6 deletions(-) (limited to 'pdf-over-gui/src/main') 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 d2a1b047..1f6af7bc 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 @@ -85,6 +85,7 @@ 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$ /** 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/MobileBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java index 5c5494b5..3b6eec31 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java @@ -91,7 +91,7 @@ public class MobileBKUConnector implements BkuSlConnector { try { String responseData = handler.postCredentials(); - if (responseData.contains("page_undecided")) { //$NON-NLS-1$ + if (responseData.contains(/*"page_undecided"*/"undecided.aspx?sid=")) { //$NON-NLS-1$ // handle polling this.state.showOpenAppMessage(); 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 44e35a64..02af7686 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 @@ -112,6 +112,7 @@ public class ATrustHandler extends MobileBKUHandler { String dynamicAttrPhonenumber = MobileBKUHelper.getNameAttribute(responseData, "handynummer"); //$NON-NLS-1$ String dynamicAttrPassword = MobileBKUHelper.getNameAttribute(responseData, "signaturpasswort"); //$NON-NLS-1$ String dynamicAttrButtonId = MobileBKUHelper.getNameAttribute(responseData, "Button_Identification"); //$NON-NLS-1$ + String dynamicAttrTan = MobileBKUHelper.getNameAttribute(responseData, "input_tan"); //$NON-NLS-1$ log.info("sessionID: " + sessionID); //$NON-NLS-1$ log.info("viewState: " + viewState); //$NON-NLS-1$ @@ -124,6 +125,8 @@ public class ATrustHandler extends MobileBKUHandler { status.setDynAttrPhonenumber(dynamicAttrPhonenumber); status.setDynAttrPassword(dynamicAttrPassword); status.setDynAttrBtnId(dynamicAttrButtonId); + status.setDynAttrTan(dynamicAttrTan); + } /* (non-Javadoc) @@ -141,9 +144,9 @@ public class ATrustHandler extends MobileBKUHandler { post.addParameter("__VIEWSTATE", status.getViewstate()); //$NON-NLS-1$ post.addParameter("__VIEWSTATEGENERATOR", status.getViewstateGenerator() ); //$NON-NLS-1$ post.addParameter("__EVENTVALIDATION", status.getEventvalidation()); //$NON-NLS-1$ - post.addParameter(status.getDynAttrPhonenumber(), status.getPhoneNumber()); //$NON-NLS-1$ - post.addParameter(status.getDynAttrPassword(), status.getMobilePassword()); //$NON-NLS-1$ - post.addParameter(status.getDynAttrBtnId(), "Identifizieren"); //$NON-NLS-1$ //$NON-NLS-2$ + post.addParameter(status.getDynAttrPhonenumber(), status.getPhoneNumber()); + post.addParameter(status.getDynAttrPassword(), status.getMobilePassword()); + post.addParameter(status.getDynAttrBtnId(), "Identifizieren"); //$NON-NLS-1$ return executePost(client, post); } @@ -268,7 +271,7 @@ public class ATrustHandler extends MobileBKUHandler { log.debug("Credentials accepted - Response given"); //$NON-NLS-1$ getSigningState().setSignatureResponse(new SLResponse(responseData, getStatus().getServer(), null, null)); return; - } else if (responseData.contains("page_undecided")) { //$NON-NLS-1$ + } else if (responseData.contains(/*page_undecided*/"undecided.aspx?sid=")) { //$NON-NLS-1$ // skip intermediate page log.debug("Page Undecided"); //$NON-NLS-1$ getSigningState().setSignatureResponse(new SLResponse(responseData, getStatus().getServer(), null, null)); @@ -319,7 +322,7 @@ public class ATrustHandler extends MobileBKUHandler { post.addParameter("__VIEWSTATE", status.getViewstate()); //$NON-NLS-1$ post.addParameter( "__EVENTVALIDATION", status.getEventvalidation()); //$NON-NLS-1$ - post.addParameter("input_tan", status.getTan()); //$NON-NLS-1$ + post.addParameter(status.getDynAttrTan(), status.getTan()); //$NON-NLS-1$ post.addParameter("SignButton", "Signieren"); //$NON-NLS-1$ //$NON-NLS-2$ post.addParameter("Button1", "Identifizieren"); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java index af804a98..5d1b9c65 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java @@ -45,6 +45,7 @@ public class ATrustStatus extends AbstractMobileBKUStatusImpl { private String dynAttrPhonenumber; private String dynAttrPassword; private String dynAttrBtnId; + private String dynAttrTan; /** * Constructor @@ -55,6 +56,20 @@ public class ATrustStatus extends AbstractMobileBKUStatusImpl { setMobilePassword(provider.getDefaultMobilePassword()); } + /** + * @return the dynAttrTan + */ + public String getDynAttrTan() { + return dynAttrTan; + } + + /** + * @param dynAttrTan the dynAttrTan to set + */ + public void setDynAttrTan(String dynAttrTan) { + this.dynAttrTan = dynAttrTan; + } + /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.states.mobilebku.MobileBKUStatus#getMaxTanTries() */ -- cgit v1.2.3