From 57fabe17efe887abc14affaa8fb008e98499493f Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Mon, 21 Nov 2022 10:35:14 +0100 Subject: auto-skip app interstitial --- .../java/at/asit/pdfover/gui/bku/mobile/ATrustParser.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile') 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 843a1881..89f53629 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 @@ -74,6 +74,17 @@ public class ATrustParser { } } + public static class AutoSkipBlock extends TopLevelFormBlock { + public final @Nonnull String submitButton; + + private AutoSkipBlock(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull Map formOptions) throws ComponentParseFailed { + super(htmlDocument, formOptions); + if (htmlDocument.baseUri().contains("/tanAppInfo.aspx")) { + this.submitButton = "#NextBtn"; + } else { throw new ComponentParseFailed(); } + } + } + public static class InterstitialBlock extends TopLevelFormBlock { public final @Nonnull String submitButton; public final @Nonnull String interstitialMessage; @@ -223,6 +234,7 @@ public class ATrustParser { public final @CheckForNull URI fido2Link; /* top-level blocks (exactly one is not null) */ + public final @CheckForNull AutoSkipBlock autoSkipBlock; public final @CheckForNull InterstitialBlock interstitialBlock; public final @CheckForNull ErrorBlock errorBlock; public final @CheckForNull UsernamePasswordBlock usernamePasswordBlock; @@ -235,6 +247,7 @@ public class ATrustParser { private void validate() { Set populated = new HashSet<>(); + if (autoSkipBlock != null) populated.add("autoSkipBlock"); if (interstitialBlock != null) populated.add("interstitialBlock"); if (errorBlock != null) populated.add("errorBlock"); if (usernamePasswordBlock != null) populated.add("usernamePasswordBlock"); @@ -321,6 +334,7 @@ public class ATrustParser { this.smsTanLink = getHrefIfExists("#SmsButton"); this.fido2Link = getHrefIfExists("#FidoButton"); // TODO hide the button if unsupported? + this.autoSkipBlock = TryParseMainBlock(AutoSkipBlock.class); this.interstitialBlock = TryParseMainBlock(InterstitialBlock.class); this.errorBlock = TryParseMainBlock(ErrorBlock.class); this.usernamePasswordBlock = TryParseMainBlock(UsernamePasswordBlock.class); -- cgit v1.2.3