From 8fc1935cb2fc3c6c1f679ffcf990e574afb39e52 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Mon, 5 Aug 2019 13:13:58 +0200 Subject: the sign button supports now also dynmic generated names --- .../src/main/java/at/asit/pdfover/gui/Constants.java | 10 ++++++++++ .../at/asit/pdfover/gui/bku/mobile/ATrustHandler.java | 18 ++++++++++-------- .../at/asit/pdfover/gui/bku/mobile/ATrustStatus.java | 17 ++++++++++++++++- 3 files changed, 36 insertions(+), 9 deletions(-) (limited to 'pdf-over-gui/src') 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 c3485971..85f003a2 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 @@ -23,6 +23,7 @@ import java.util.Properties; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Display; +import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; /** @@ -355,4 +356,13 @@ public class Constants { public static final String CERTIFICATE_XML_FILE = "certificates.xml"; //$NON-NLS-1$ public static final String LABEL_TAN = "input_tan"; //$NON-NLS-1$ + + public static final String LABEL_SIGN_BTN = "SignButton"; //$NON-NLS-1$ + + public static final String LABEL_PHONE_NUMBER = "handynummer"; //$NON-NLS-1$ + + public static final String LABEL_SIGN_PASS = "signaturpasswort"; //$NON-NLS-1$ + + public static final String LABEL_BTN_IDF = "Button_Identification"; //$NON-NLS-1$ + } 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 0a92f553..2c13cb9d 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 @@ -111,10 +111,11 @@ public class ATrustHandler extends MobileBKUHandler { String viewstateGenerator = MobileBKUHelper.extractValueFromTagWithParamOptional(responseData, "", "id", "__VIEWSTATEGENERATOR", "value"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - 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$ + String dynamicAttrPhonenumber = MobileBKUHelper.getNameAttribute(responseData, Constants.LABEL_PHONE_NUMBER); + String dynamicAttrPassword = MobileBKUHelper.getNameAttribute(responseData, Constants.LABEL_SIGN_PASS); + String dynamicAttrButtonId = MobileBKUHelper.getNameAttribute(responseData, Constants.LABEL_BTN_IDF); + String dynamicAttrTan = MobileBKUHelper.getNameAttribute(responseData, Constants.LABEL_TAN); + log.info("sessionID: " + sessionID); //$NON-NLS-1$ log.info("viewState: " + viewState); //$NON-NLS-1$ @@ -127,8 +128,7 @@ public class ATrustHandler extends MobileBKUHandler { status.setDynAttrPhonenumber(dynamicAttrPhonenumber); status.setDynAttrPassword(dynamicAttrPassword); status.setDynAttrBtnId(dynamicAttrButtonId); - //status.setDynAttrTan(dynamicAttrTan); - status.setDynAttrTan("ctl00$content$input_tan"); + status.setDynAttrTan(dynamicAttrTan); } /* (non-Javadoc) @@ -259,6 +259,7 @@ public class ATrustHandler extends MobileBKUHandler { tanField = MobileBKUHelper.extractValueFromTagWithParam(responseData, "label", "id", "label_for_input_tan", "for"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ status.setTanField(tanField); status.setDynAttrTan(MobileBKUHelper.getNameAttribute(responseData, Constants.LABEL_TAN)); + status.setDynAttrSignButton(MobileBKUHelper.getNameAttribute(responseData, Constants.LABEL_SIGN_BTN)); } catch (Exception e) { log.debug("No tan field found"); //$NON-NLS-1$ } @@ -266,6 +267,7 @@ public class ATrustHandler extends MobileBKUHandler { tanTextTan = tanField = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "id", "text_tan"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ status.setIsAPPTan(tanTextTan); status.setDynAttrTan(MobileBKUHelper.getNameAttribute(responseData, Constants.LABEL_TAN)); + status.setDynAttrSignButton(MobileBKUHelper.getNameAttribute(responseData, Constants.LABEL_SIGN_BTN)); }catch (Exception e) { log.debug("No text_tan tag"); //$NON-NLS-1$ } @@ -326,8 +328,8 @@ public class ATrustHandler extends MobileBKUHandler { post.addParameter("__VIEWSTATE", status.getViewstate()); //$NON-NLS-1$ post.addParameter( "__EVENTVALIDATION", status.getEventvalidation()); //$NON-NLS-1$ - post.addParameter(status.getDynAttrTan(), status.getTan()); //$NON-NLS-1$ - post.addParameter(/*button name: "SignButton"*/"ctl00$content$SignButton", "Signieren"); //$NON-NLS-1$ //$NON-NLS-2$ + post.addParameter(status.getDynAttrTan(), status.getTan()); + post.addParameter(status.getDynAttrSignButton(), "Signieren"); //$NON-NLS-1$ post.addParameter("Button1", "Identifizieren"); //$NON-NLS-1$ //$NON-NLS-2$ return executePost(client, post); 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 5d1b9c65..b34322b8 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 @@ -46,6 +46,7 @@ public class ATrustStatus extends AbstractMobileBKUStatusImpl { private String dynAttrPassword; private String dynAttrBtnId; private String dynAttrTan; + private String dynAttrSignButton; /** * Constructor @@ -60,7 +61,7 @@ public class ATrustStatus extends AbstractMobileBKUStatusImpl { * @return the dynAttrTan */ public String getDynAttrTan() { - return dynAttrTan; + return this.dynAttrTan; } /** @@ -225,4 +226,18 @@ public class ATrustStatus extends AbstractMobileBKUStatusImpl { this.dynAttrBtnId = dynAttrBtnId; } + /** + * @return the dynAttrSignButton + */ + public String getDynAttrSignButton() { + return this.dynAttrSignButton; + } + + /** + * @param dynAttrSignButton the dynAttrSignButton to set + */ + public void setDynAttrSignButton(String dynAttrSignButton) { + this.dynAttrSignButton = dynAttrSignButton; + } + } -- cgit v1.2.3