From 56da4c50206ca64ed5e13735de38871ccc45eb70 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Fri, 4 Nov 2022 10:39:06 +0100 Subject: hide fido2 buttons if unsupported --- .../src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java | 2 +- .../src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustParser.java | 2 +- .../java/at/asit/pdfover/gui/composites/PositioningComposite.java | 3 --- .../pdfover/gui/composites/mobilebku/MobileBKUEnterTANComposite.java | 2 ++ .../gui/composites/mobilebku/MobileBKUFingerprintComposite.java | 2 ++ .../asit/pdfover/gui/composites/mobilebku/MobileBKUQRComposite.java | 5 +++-- .../pdfover/gui/composites/mobilebku/WaitingForAppComposite.java | 3 +++ 7 files changed, 12 insertions(+), 7 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover') 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 6d7c2cd7..58762b03 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 @@ -285,7 +285,7 @@ public class MobileBKUConnector implements BkuSlConnector { private boolean wantsFido2Default; /** * Main lifting function for MobileBKU UX - * @return the next request to make, or null if the current response should be returned + * @return the next request to make */ private @Nonnull ClassicHttpRequest presentResponseToUserAndReturnNextRequest(@Nonnull ATrustParser.HTMLResult html) throws UserCancelledException { if ((html.errorBlock == null) && (html.usernamePasswordBlock == null)) { /* successful username/password auth */ 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 7978187d..843a1881 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 @@ -145,7 +145,7 @@ public class ATrustParser { private SMSTanBlock(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull Map formOptions) throws ComponentParseFailed { super(htmlDocument, formOptions); - abortIfElementMissing("#div_tan"); + abortIfElementMissing("#input_tan"); this.tanKey = getAttributeEnsureNotNull("#input_tan", "name"); this.referenceValue = ISNOTNULL(getElementEnsureNotNull("#vergleichswert").ownText()); this.errorMessage = null; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index 5be8a4c7..c2f69501 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -31,9 +31,6 @@ import java.awt.geom.Point2D; import org.apache.pdfbox.pdmodel.PDDocument; import org.eclipse.swt.SWT; import org.eclipse.swt.awt.SWT_AWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterTANComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterTANComposite.java index 3a3030de..70fabcc8 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterTANComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterTANComposite.java @@ -43,6 +43,7 @@ import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.composites.StateComposite; import at.asit.pdfover.gui.utils.SWTUtils; import at.asit.pdfover.gui.workflow.states.State; +import at.asit.webauthn.WebAuthN; /** * Composite for entering the TAN for the mobile BKU @@ -251,6 +252,7 @@ public class MobileBKUEnterTANComposite extends StateComposite { 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.btn_fido2.setVisible(WebAuthN.isAvailable()); this.lblMessage = new Label(containerComposite, SWT.WRAP | SWT.NATIVE); SWTUtils.anchor(lblMessage).right(btn_fido2, -10).bottom(100, -20); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFingerprintComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFingerprintComposite.java index 05b91e87..9d9e3064 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFingerprintComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFingerprintComposite.java @@ -38,6 +38,7 @@ import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.composites.StateComposite; import at.asit.pdfover.gui.utils.SWTUtils; import at.asit.pdfover.gui.workflow.states.State; +import at.asit.webauthn.WebAuthN; /** * Composite for displaying the QR code for the mobile BKU @@ -151,6 +152,7 @@ public class MobileBKUFingerprintComposite extends StateComposite { this.btn_fido2 = new Button(containerComposite, SWT.NATIVE); SWTUtils.anchor(btn_fido2).right(btn_sms, -20).bottom(100, -20); SWTUtils.addSelectionListener(btn_fido2, () -> { this.userFido2Clicked = true; }); + this.btn_fido2.setVisible(WebAuthN.isAvailable()); this.lblError = new Label(containerComposite, SWT.WRAP | SWT.NATIVE); SWTUtils.anchor(lblError).right(btn_sms, -10).bottom(100, -20); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUQRComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUQRComposite.java index f736f65a..b121d420 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUQRComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUQRComposite.java @@ -44,6 +44,7 @@ import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.composites.StateComposite; import at.asit.pdfover.gui.utils.SWTUtils; import at.asit.pdfover.gui.workflow.states.State; +import at.asit.webauthn.WebAuthN; /** * Composite for displaying the QR code for the mobile BKU @@ -210,8 +211,8 @@ public class MobileBKUQRComposite extends StateComposite { this.btn_fido2 = new Button(containerComposite, SWT.NATIVE); SWTUtils.anchor(btn_fido2).right(btn_sms, -20).bottom(100, -5); - SWTUtils.addSelectionListener(btn_fido2, (e) -> {this.userFIDO2Clicked = true; }); - + SWTUtils.addSelectionListener(btn_fido2, (e) -> { this.userFIDO2Clicked = true; }); + this.btn_fido2.setVisible(WebAuthN.isAvailable()); SWTUtils.anchor(lblQR).left(50, 10).right(100, -20).top(lblRefVal, 10).bottom(btn_sms, -10); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/WaitingForAppComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/WaitingForAppComposite.java index cbe6e822..226c416d 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/WaitingForAppComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/WaitingForAppComposite.java @@ -26,6 +26,8 @@ import org.eclipse.swt.widgets.ProgressBar; import at.asit.pdfover.gui.composites.StateComposite; import at.asit.pdfover.gui.utils.SWTUtils; import at.asit.pdfover.gui.workflow.states.State; +import at.asit.webauthn.WebAuthN; + import org.eclipse.swt.widgets.Button; /** @@ -85,6 +87,7 @@ public class WaitingForAppComposite extends StateComposite { this.btn_fido2 = new Button(this, SWT.NONE); SWTUtils.anchor(btn_fido2).top(btn_cancel, 0, SWT.TOP).right(btn_cancel, -6); SWTUtils.addSelectionListener(btn_fido2, (e) -> { this.userFIDO2Clicked = true; }); + this.btn_fido2.setVisible(WebAuthN.isAvailable()); reloadResources(); -- cgit v1.2.3