From 851fda341cc53b4aa61de6637917741f5508515c Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Thu, 3 Nov 2022 17:02:40 +0100 Subject: text w/ dependency info if fido2 unsupported --- .../composites/configuration/AboutComposite.java | 3 +-- .../configuration/Fido2ConfigurationComposite.java | 24 ++++++++++++++++++++-- .../at/asit/pdfover/gui/messages.properties | 2 ++ .../at/asit/pdfover/gui/messages_de.properties | 2 ++ 4 files changed, 27 insertions(+), 4 deletions(-) (limited to 'pdf-over-gui/src/main') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java index 2dced6ac..09c2fdbc 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java @@ -82,8 +82,7 @@ public class AboutComposite extends ConfigurationCompositeBase { SWTUtils.reanchor(lnkDataProtection).bottom(btnUpdateCheck,-5); SWTUtils.addSelectionListener(btnOpenLogDirectory, (e) -> { - try - { + try { if (Desktop.isDesktopSupported()) Desktop.getDesktop().open(new File(Constants.CONFIG_DIRECTORY + File.separator + "logs")); } catch (Exception ex) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/Fido2ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/Fido2ConfigurationComposite.java index 36e2931b..a294569f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/Fido2ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/Fido2ConfigurationComposite.java @@ -9,18 +9,21 @@ import org.eclipse.swt.widgets.Link; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.sun.jna.Platform; + import at.asit.pdfover.commons.Constants; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.utils.SWTUtils; import at.asit.pdfover.gui.workflow.config.ConfigurationDataInMemory; import at.asit.pdfover.gui.workflow.config.ConfigurationManager; import at.asit.pdfover.gui.workflow.states.State; +import at.asit.webauthn.WebAuthN; public class Fido2ConfigurationComposite extends ConfigurationCompositeBase { private static final Logger log = LoggerFactory.getLogger(Fido2ConfigurationComposite.class); private Link lnkInfoText; - // TODO information about unsupported/installing deps? + private Link unsupportedText; private Group grpFidoSettings; private Button btnFido2ByDefault; @@ -34,13 +37,18 @@ public class Fido2ConfigurationComposite extends ConfigurationCompositeBase { SWTUtils.setFontHeight(lnkInfoText, Constants.TEXT_SIZE_NORMAL); SWTUtils.addSelectionListener(lnkInfoText, () -> { SWTUtils.openURL(Messages.getString("config.fido2.InfoURL")); }); + this.unsupportedText = new Link(this, SWT.WRAP); + SWTUtils.anchor(unsupportedText).top(lnkInfoText,5).left(0,5).right(100,-5); + SWTUtils.setFontHeight(unsupportedText, Constants.TEXT_SIZE_NORMAL); + SWTUtils.addSelectionListener(unsupportedText, () -> { SWTUtils.openURL("https://developers.yubico.com/libfido2/#_installation"); }); + FormLayout STANDARD_LAYOUT = new FormLayout(); STANDARD_LAYOUT.marginHeight = 10; STANDARD_LAYOUT.marginWidth = 5; this.grpFidoSettings = new Group(this, SWT.NONE); this.grpFidoSettings.setLayout(STANDARD_LAYOUT); - SWTUtils.anchor(grpFidoSettings).top(lnkInfoText,5).left(0,5).right(100,-5); + SWTUtils.anchor(grpFidoSettings).top(lnkInfoText,10).left(0,5).right(100,-5); SWTUtils.setFontHeight(grpFidoSettings, Constants.TEXT_SIZE_NORMAL); this.btnFido2ByDefault = new Button(this.grpFidoSettings, SWT.CHECK); @@ -48,6 +56,11 @@ public class Fido2ConfigurationComposite extends ConfigurationCompositeBase { SWTUtils.setFontHeight(btnFido2ByDefault, Constants.TEXT_SIZE_BUTTON); SWTUtils.addSelectionListener(btnFido2ByDefault, () -> { this.configurationContainer.fido2ByDefault = btnFido2ByDefault.getSelection(); }); + if (WebAuthN.isAvailable()) + this.unsupportedText.setVisible(false); + else + this.grpFidoSettings.setVisible(false); + reloadResources(); } @@ -56,6 +69,13 @@ public class Fido2ConfigurationComposite extends ConfigurationCompositeBase { SWTUtils.setLocalizedText(lnkInfoText, "config.fido2.AboutFIDO"); SWTUtils.setLocalizedText(grpFidoSettings, "config.fido2.Group"); SWTUtils.setLocalizedText(btnFido2ByDefault, "config.fido2.ByDefault"); + + if (Platform.isLinux()) + SWTUtils.setLocalizedText(unsupportedText, "config.fido2.UnsupportedTryLibFido2"); + else { + SWTUtils.setFontStyle(unsupportedText, SWT.BOLD); + SWTUtils.setLocalizedText(unsupportedText, "config.fido2.UnsupportedPlatform"); + } } @Override diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties index 73cdf4ca..4da17d9d 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties @@ -268,6 +268,8 @@ config.UpdateStatus.OUTDATED=New version available. Update now? config.UpdateStatus.UP_TO_DATE=PDF-Over is up to date. Check again? config.UpdateStatus.FAILED=Update check failed. Retry? config.fido2.AboutFIDO=ID Austria users can optionally substitute a suitable hardware security token for app authentication.\n\nThis does not replace username/password entry. However, instead of confirming the signature in the smartphone app, the user instead confirms it using their security token.\n\nFurther information regarding supported tokens is available at oesterreich.gv.at. +config.fido2.UnsupportedTryLibFido2=You are currently missing a required dependency to utilize FIDO2 tokens:\n ● LibFido2\n\nPlease install the dependency via your package manager, then restart PDF-Over. +config.fido2.UnsupportedPlatform=FIDO2 authentication is currently unsupported on your platform. config.fido2.InfoURL=https://www.oesterreich.gv.at/id-austria/haeufige-fragen/allgemeines-zu-id-austria#fido config.fido2.Group=FIDO2 settings config.fido2.ByDefault=Select FIDO2 authentication by default diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties index b09b249c..1ed8d0e9 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties @@ -118,6 +118,8 @@ config.Keystore=&Keystore config.Simple=&Einfach config.ShowLogDirectory=Logs anzeigen config.fido2.AboutFIDO=Nutzer:innen mit ID Austria können einen Hardware-Sicherheitstoken als Ersatz zum Smartphone zur Auslösung von PDF-Signaturen verwenden.\n\nDie Eingabe von Benutzername und Passwort ist weiterhin notwendig, aber die Freigabe über die App wird durch die Freigabe über den Hardware-Token ersetzt.\n\nWeitere Informationen erhalten Sie auf der Informationsseite der ID-Austria. +config.fido2.UnsupportedTryLibFido2=Für die Verwendung von FIDO2-Tokens wird benötigt:\n ● LibFido2\n\nBitte installieren Sie die o.a. Voraussetzungen und starten sie dann PDF-Over neu. +config.fido2.UnsupportedPlatform=Ihr System unterstützt keine Authentifizierung mittels FIDO2-Token. config.fido2.InfoURL=https://www.oesterreich.gv.at/id-austria/haeufige-fragen/allgemeines-zu-id-austria#fido config.fido2.Group=FIDO2-Einstellungen config.fido2.ByDefault=FIDO2 standardmäßig auswählen -- cgit v1.2.3