summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/OLDMobileBKUConnector.java12
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustParser.java37
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java99
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/UpdateCheckManager.java5
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java90
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java2
8 files changed, 132 insertions, 135 deletions
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 1c07376c..dc2258a1 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
@@ -250,7 +250,7 @@ public class MobileBKUConnector implements BkuSlConnector {
if (html.usernamePasswordBlock != null) {
try {
while ((this.credentials.username == null) || (this.credentials.password == null)) {
- this.state.getCredentialsFromUserTo(this.credentials, null); // TODO error message
+ this.state.getCredentialsFromUserTo(this.credentials, html.usernamePasswordBlock.errorMessage);
}
html.usernamePasswordBlock.setUsernamePassword(this.credentials.username, this.credentials.password);
return buildFormSubmit(html, "#Button_Identification");
@@ -258,6 +258,17 @@ public class MobileBKUConnector implements BkuSlConnector {
return buildFormSubmit(html, "#Button_Cancel");
}
}
+ if (html.smsTanBlock != null) {
+ MobileBKUState.SMSTanResult result = this.state.getSMSTanFromUser(
+ html.smsTanBlock.referenceValue, html.smsTanBlock.triesRemaining,
+ html.signatureDataLink, html.fido2Link != null, html.smsTanBlock.errorMessage);
+
+ switch (result.type) {
+ case TO_FIDO2: if (html.fido2Link != null) return new HttpGet(html.fido2Link);
+ case SMSTAN: html.smsTanBlock.setTAN(result.smsTan); return buildFormSubmit(html, "#SignButton");
+ }
+ return new HttpGet(html.htmlDocument.baseUri());
+ }
if (html.qrCodeBlock != null) {
try (final CloseableHttpClient httpClient = HttpClients.custom().disableRedirectHandling().build()) {
final HttpGet request = new HttpGet(html.qrCodeBlock.pollingURI);
@@ -297,7 +308,7 @@ public class MobileBKUConnector implements BkuSlConnector {
});
try {
longPollThread.start();
- MobileBKUState.QRResult result = this.state.showQRCode(html.qrCodeBlock.referenceValue, html.qrCodeBlock.qrCodeURI, html.signatureDataLink, html.smsTanLink != null, html.fido2Link != null, null);
+ MobileBKUState.QRResult result = this.state.showQRCode(html.qrCodeBlock.referenceValue, html.qrCodeBlock.qrCodeURI, html.signatureDataLink, html.smsTanLink != null, html.fido2Link != null, html.qrCodeBlock.errorMessage);
switch (result) {
case UPDATE: break;
case TO_FIDO2: if (html.fido2Link != null) return new HttpGet(html.fido2Link); break;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/OLDMobileBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/OLDMobileBKUConnector.java
index 9703e602..8c054e95 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/OLDMobileBKUConnector.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/OLDMobileBKUConnector.java
@@ -176,14 +176,14 @@ public class OLDMobileBKUConnector implements BkuSlConnector {
}
if (enterTAN) {
- // Get TAN
- this.state.checkTAN();
+ try {
+ // Get TAN
+ this.state.OLDcheckTAN();
- if ("cancel".equals(this.state.status.errorMessage))
- throw new SignatureException(new IllegalStateException());
+ if ("cancel".equals(this.state.status.errorMessage))
+ throw new SignatureException(new IllegalStateException());
- // Post TAN
- try {
+ // Post TAN
responseData = handler.postTAN();
log.trace("Response from mobile BKU: " + responseData);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustParser.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustParser.java
index 16f571a3..90afc834 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustParser.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustParser.java
@@ -16,6 +16,8 @@ import org.jsoup.Jsoup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.bku.OLDmobile.ATrustStatus;
+
import static at.asit.pdfover.commons.Constants.ISNOTNULL;
public class ATrustParser {
@@ -60,9 +62,9 @@ public class ATrustParser {
public final boolean isRecoverable;
public final @Nonnull String errorText;
- private ErrorBlock(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull URI formTarget, @Nonnull Map<String, String> formOptions) throws ComponentParseFailed {
+ private ErrorBlock(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull Map<String, String> formOptions) throws ComponentParseFailed {
super(htmlDocument, formOptions);
- if (!formTarget.getPath().contains("/error.aspx"))
+ if (!htmlDocument.baseUri().contains("/error.aspx"))
throw new ComponentParseFailed();
this.isRecoverable = (htmlDocument.selectFirst("#Button_Back") != null);
@@ -83,7 +85,7 @@ public class ATrustParser {
formOptions.put(usernameKey, username); formOptions.put(passwordKey, password);
}
- private UsernamePasswordBlock(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull URI formTarget, @Nonnull Map<String, String> formOptions) throws ComponentParseFailed {
+ private UsernamePasswordBlock(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull Map<String, String> formOptions) throws ComponentParseFailed {
super(htmlDocument, formOptions);
abortIfElementMissing("#handynummer");
this.usernameKey = getAttributeEnsureNotNull("#handynummer", "name");
@@ -92,13 +94,33 @@ public class ATrustParser {
}
}
+ public static class SMSTanBlock extends TopLevelFormBlock {
+ private final @Nonnull String tanKey;
+ public final @Nonnull String referenceValue;
+ public final int triesRemaining;
+ public final @CheckForNull String errorMessage;
+
+ public void setTAN(String tan) {
+ formOptions.put(tanKey, tan);
+ }
+
+ private SMSTanBlock(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull Map<String, String> formOptions) throws ComponentParseFailed {
+ super(htmlDocument, formOptions);
+ abortIfElementMissing("#div_tan");
+ this.tanKey = getAttributeEnsureNotNull("#input_tan", "name");
+ this.referenceValue = ISNOTNULL(getElementEnsureNotNull("#vergleichswert").ownText());
+ this.triesRemaining = ATrustStatus.MOBILE_MAX_TAN_TRIES; // TODO
+ this.errorMessage = null;
+ }
+ }
+
public static class QRCodeBlock extends TopLevelFormBlock {
public final @Nonnull String referenceValue;
public final @Nonnull URI qrCodeURI;
public final @Nonnull URI pollingURI;
public final @Nullable String errorMessage;
- private QRCodeBlock(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull URI formTarget, @Nonnull Map<String, String> formOptions) throws ComponentParseFailed {
+ private QRCodeBlock(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull Map<String, String> formOptions) throws ComponentParseFailed {
super(htmlDocument, formOptions);
abortIfElementMissing("#qrimage");
@@ -132,7 +154,7 @@ public class ATrustParser {
public void setFIDOResult(String result) { formOptions.put(credentialResultKey, result); }
- private Fido2Block(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull URI formTarget, @Nonnull Map<String, String> formOptions) throws ComponentParseFailed {
+ private Fido2Block(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull Map<String, String> formOptions) throws ComponentParseFailed {
super(htmlDocument, formOptions);
abortIfElementMissing("#fidoBlock");
this.fidoOptions = getAttributeEnsureNotNull("#credentialOptions", "value");
@@ -155,6 +177,7 @@ public class ATrustParser {
/* top-level blocks (exactly one is not null) */
public final @CheckForNull ErrorBlock errorBlock;
public final @CheckForNull UsernamePasswordBlock usernamePasswordBlock;
+ public final @CheckForNull SMSTanBlock smsTanBlock;
public final @CheckForNull QRCodeBlock qrCodeBlock;
public final @CheckForNull Fido2Block fido2Block;
@@ -163,6 +186,7 @@ public class ATrustParser {
if (errorBlock != null) populated.add("errorBlock");
if (usernamePasswordBlock != null) populated.add("usernamePasswordBlock");
+ if (smsTanBlock != null) populated.add("smsTanBlock");
if (qrCodeBlock != null) populated.add("qrCodeBlock");
if (fido2Block != null) populated.add("fido2Block");
@@ -192,7 +216,7 @@ public class ATrustParser {
*/
private <T extends TopLevelFormBlock> @Nullable T TryParseMainBlock(Class<T> clazz) {
try {
- return clazz.getDeclaredConstructor(org.jsoup.nodes.Document.class, URI.class, Map.class).newInstance(this.htmlDocument, this.formTarget, this.formOptions);
+ return clazz.getDeclaredConstructor(org.jsoup.nodes.Document.class, Map.class).newInstance(this.htmlDocument, this.formOptions);
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | IllegalArgumentException | SecurityException e) {
log.error("Internal parser error; check your method signatures?", e);
return null;
@@ -245,6 +269,7 @@ public class ATrustParser {
this.errorBlock = TryParseMainBlock(ErrorBlock.class);
this.usernamePasswordBlock = TryParseMainBlock(UsernamePasswordBlock.class);
+ this.smsTanBlock = TryParseMainBlock(SMSTanBlock.class);
this.qrCodeBlock = TryParseMainBlock(QRCodeBlock.class);
this.fido2Block = TryParseMainBlock(Fido2Block.class);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
index ab5f5962..6b52709e 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java
@@ -45,6 +45,7 @@ import com.beust.jcommander.internal.Nullable;
import at.asit.pdfover.commons.Constants;
import at.asit.pdfover.commons.Messages;
+import at.asit.pdfover.gui.bku.OLDmobile.ATrustStatus;
import at.asit.pdfover.gui.utils.SWTUtils;
import at.asit.pdfover.gui.workflow.states.State;
@@ -87,26 +88,7 @@ public class MobileBKUEnterTANComposite extends StateComposite {
}
MobileBKUEnterTANComposite.this.tan = tan;
- MobileBKUEnterTANComposite.this.setUserAck(true);
- MobileBKUEnterTANComposite.this.btn_ok.setEnabled(false);
- //MobileBKUEnterTANComposite.this.state.updateStateMachine();
- //MobileBKUEnterTANComposite.this.btn_ok.setEnabled(true);
- }
- }
-
- /**
- *
- */
- private final class CancelSelectionListener extends SelectionAdapter {
- /**
- * Empty constructor
- */
- public CancelSelectionListener() {
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- MobileBKUEnterTANComposite.this.setUserCancel(true);
+ MobileBKUEnterTANComposite.this.userAck = true;
}
}
@@ -115,16 +97,17 @@ public class MobileBKUEnterTANComposite extends StateComposite {
**/
static final Logger log = LoggerFactory.getLogger(MobileBKUEnterTANComposite.class);
- Text txt_tan;
+ private Text txt_tan;
- boolean userAck = false;
- boolean userCancel = false;
+ private boolean userAck = false;
+ private boolean userCancel = false;
+ private boolean userFido2 = false;
private Label lblRefVal;
- String refVal;
+ private String refVal;
- URI signatureDataURI;
+ private URI signatureDataURI;
/**
* @param signatureData
@@ -135,7 +118,7 @@ public class MobileBKUEnterTANComposite extends StateComposite {
this.lnk_sig_data.setEnabled(uri != null);
}
- String tan;
+ private String tan;
private Link lnk_sig_data;
@@ -143,22 +126,16 @@ public class MobileBKUEnterTANComposite extends StateComposite {
private Label lblRefValLabel;
private Label lblTan;
- Button btn_ok;
- Button btn_cancel;
+ private Button btn_ok;
+ private Button btn_cancel;
+ private Button btn_fido2;
- /**
- * @return the userAck
- */
- public boolean isUserAck() {
- return this.userAck;
- }
+ public boolean isDone() { return (this.userAck || this.userCancel || this.userFido2); }
+ public boolean isUserAck() { return this.userAck; }
+ public boolean isUserCancel() { return this.userCancel; }
+ public boolean isUserFido2() { return this.userFido2; }
- /**
- * @return the userCancel
- */
- public boolean isUserCancel() {
- return this.userCancel;
- }
+ public void reset() { this.userAck = this.userCancel = this.userFido2 = false; }
/**
* Set how many tries are left
@@ -166,8 +143,12 @@ public class MobileBKUEnterTANComposite extends StateComposite {
* @param tries
*/
public void setTries(int tries) {
- this.lblTries.setText(tries == 1 ? Messages.getString("tanEnter.try") :
- String.format(Messages.getString("tanEnter.tries"), tries));
+ if ((tries > 0) && (tries < ATrustStatus.MOBILE_MAX_TAN_TRIES)) {
+ if (tries > 1)
+ SWTUtils.setLocalizedText(lblTries, "tanEnter.try");
+ else
+ SWTUtils.setLocalizedText(lblTries, "tanEnter.tries", tries);
+ }
}
/**
@@ -182,6 +163,9 @@ public class MobileBKUEnterTANComposite extends StateComposite {
Messages.getString("error.Title") + ": " + errorMessage);
}
+ public void setFIDO2Enabled(boolean state) {
+ this.btn_fido2.setEnabled(state);
+ }
/**
* Sets the message
@@ -195,22 +179,6 @@ public class MobileBKUEnterTANComposite extends StateComposite {
}
/**
- * @param userAck
- * the userAck to set
- */
- public void setUserAck(boolean userAck) {
- this.userAck = userAck;
- }
-
- /**
- * @param userCancel
- * the userCancel to set
- */
- public void setUserCancel(boolean userCancel) {
- this.userCancel = userCancel;
- }
-
- /**
* @return the reference value
*/
public String getRefVal() {
@@ -218,13 +186,6 @@ public class MobileBKUEnterTANComposite extends StateComposite {
}
/**
- * Enables the submit button
- */
- public void enableButton() {
- this.btn_ok.setEnabled(true);
- }
-
- /**
* @param refVal
* the reference value to set
*/
@@ -347,10 +308,14 @@ public class MobileBKUEnterTANComposite extends StateComposite {
this.btn_cancel = new Button(containerComposite, SWT.NATIVE);
SWTUtils.anchor(btn_cancel).right(btn_ok, -20).bottom(100, -20);
- this.btn_cancel.addSelectionListener(new CancelSelectionListener());
+ SWTUtils.addSelectionListener(btn_cancel, (e) -> { this.userCancel = true; });
+
+ this.btn_fido2 = new Button(containerComposite, SWT.NATIVE);
+ SWTUtils.anchor(btn_fido2).right(btn_cancel, -20).bottom(100, -20);
+ SWTUtils.addSelectionListener(btn_fido2, (e) -> { this.userFido2 = true; });
this.lblTries = new Label(containerComposite, SWT.WRAP | SWT.NATIVE);
- SWTUtils.anchor(lblTries).right(btn_cancel, -10).bottom(100, -20);
+ SWTUtils.anchor(lblTries).right(btn_fido2, -10).bottom(100, -20);
}
@Override
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java
index 652baed4..baabc192 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUQRComposite.java
@@ -16,9 +16,7 @@
package at.asit.pdfover.gui.composites;
// Imports
-import java.awt.Desktop;
import java.io.ByteArrayInputStream;
-import java.io.InputStream;
import java.net.URI;
import java.util.Objects;
@@ -28,14 +26,11 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
@@ -56,7 +51,7 @@ public class MobileBKUQRComposite extends StateComposite {
/**
* SLF4J Logger instance
**/
- static final Logger log = LoggerFactory.getLogger(MobileBKUQRComposite.class);
+ private static final Logger log = LoggerFactory.getLogger(MobileBKUQRComposite.class);
private Label lblQR;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/UpdateCheckManager.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/UpdateCheckManager.java
index 133ecdcb..095704b7 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/UpdateCheckManager.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/UpdateCheckManager.java
@@ -1,7 +1,5 @@
package at.asit.pdfover.gui.utils;
-import java.awt.Desktop;
-import java.net.URI;
import java.util.ArrayList;
import java.util.function.Consumer;
@@ -18,11 +16,10 @@ import at.asit.pdfover.gui.controls.Dialog.ICON;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Shell;
public final class UpdateCheckManager {
- static final Logger log = LoggerFactory.getLogger(UpdateCheckManager.class);
+ private static final Logger log = LoggerFactory.getLogger(UpdateCheckManager.class);
private static Thread updateCheckThread = null;
private static boolean needsCheck = 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 563b3b88..8a0c95df 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
@@ -16,7 +16,6 @@
package at.asit.pdfover.gui.workflow.states;
import java.io.IOException;
-import java.io.InputStream;
import java.net.ConnectException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -38,7 +37,6 @@ import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClients;
-import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
@@ -48,7 +46,6 @@ import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.MainWindow.Buttons;
import at.asit.pdfover.gui.MainWindowBehavior;
import at.asit.pdfover.gui.bku.MobileBKUConnector;
-import at.asit.pdfover.gui.bku.OLDMobileBKUConnector;
import at.asit.pdfover.gui.bku.OLDmobile.ATrustHandler;
import at.asit.pdfover.gui.bku.OLDmobile.ATrustStatus;
import at.asit.pdfover.gui.composites.MobileBKUEnterNumberComposite;
@@ -327,55 +324,62 @@ public class MobileBKUState extends State {
}
}
- /**
- * Make sure TAN is set in the MobileBKUStatus
- */
- public void checkTAN() {
- final ATrustStatus mobileStatus = this.status;
+ public static class SMSTanResult {
+ public static enum ResultType { TO_FIDO2, SMSTAN };
+ public final @Nonnull ResultType type;
+ public final @CheckForNull String smsTan;
- Display.getDefault().syncExec(() -> {
- MobileBKUEnterTANComposite tan = getMobileBKUEnterTANComposite();
+ private SMSTanResult(@Nullable String smsTan) { this.type = ResultType.SMSTAN; this.smsTan = smsTan; }
+ private SMSTanResult(@Nonnull ResultType type) { this.type = type; this.smsTan = null; }
+ }
- if (!tan.isUserAck()) {
- // we need the TAN
- tan.setRefVal(mobileStatus.refVal);
- try { tan.setSignatureDataURI(new URI(mobileStatus.signatureDataURL)); } catch (URISyntaxException e) {}
- tan.setErrorMessage(mobileStatus.errorMessage);
- if (mobileStatus.tanTries < ATrustStatus.MOBILE_MAX_TAN_TRIES
- && mobileStatus.tanTries > 0) {
- // show warning message x tries left!
- // overrides error message
-
- tan.setTries(mobileStatus.tanTries);
- }
- tan.enableButton();
- getStateMachine().display(tan);
+ public SMSTanResult getSMSTanFromUser(final @Nonnull String referenceValue, final int triesRemaining, final @Nullable URI signatureDataURI, final boolean showFido2, final @Nullable String errorMessage) throws UserCancelledException {
+ return Display.getDefault().syncCall(() -> {
+ MobileBKUEnterTANComposite tan = getMobileBKUEnterTANComposite();
+
+ tan.reset();
+ tan.setRefVal(referenceValue);
+ tan.setSignatureDataURI(signatureDataURI);
+ tan.setErrorMessage(errorMessage);
+ tan.setTries(triesRemaining);
+ tan.setFIDO2Enabled(showFido2);
+ getStateMachine().display(tan);
- Display display = getStateMachine().getMainShell().getDisplay();
- while (!tan.isUserAck() && !tan.isUserCancel()) {
- if (!display.readAndDispatch()) {
- display.sleep();
- }
+ Display display = getStateMachine().getMainShell().getDisplay();
+ while (!tan.isDone()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
}
}
-
- if (tan.isUserCancel()) {
- tan.setUserCancel(false);
- clearRememberedPassword();
- mobileStatus.errorMessage = "cancel";
- return;
- }
-
- // user hit ok!
- tan.setUserAck(false);
-
- mobileStatus.tan = tan.getTan();
-
- // show waiting composite
getStateMachine().display(getWaitingComposite());
+
+ if (tan.isUserCancel())
+ throw new UserCancelledException();
+
+ if (tan.isUserFido2())
+ return new SMSTanResult(SMSTanResult.ResultType.TO_FIDO2);
+
+ return new SMSTanResult(tan.getTan());
});
}
+ /**
+ * Make sure TAN is set in the MobileBKUStatus
+ */
+ public void OLDcheckTAN() throws URISyntaxException {
+ final ATrustStatus mobileStatus = this.status;
+
+ try {
+ SMSTanResult result = getSMSTanFromUser(mobileStatus.refVal, mobileStatus.tanTries, new URI(mobileStatus.signatureDataURL), false, mobileStatus.errorMessage);
+ if (result.type == SMSTanResult.ResultType.SMSTAN) {
+ mobileStatus.tan = result.smsTan;
+ }
+ } catch (UserCancelledException e) {
+ clearRememberedPassword();
+ mobileStatus.errorMessage = "cancel";
+ }
+ }
+
public enum QRResult {
/* the user has pressed the FIDO2 button */
TO_FIDO2,
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
index e45de3fa..0229acb6 100644
--- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
+++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
@@ -46,7 +46,7 @@ public class PdfAs4SignatureParameter {
/**
* SLF4J Logger instance
**/
- static final Logger log = LoggerFactory.getLogger(PdfAs4SignatureParameter.class);
+ private static final Logger log = LoggerFactory.getLogger(PdfAs4SignatureParameter.class);
/**
* this is set by CliArguments.InvisibleProfile