summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-10-07 12:57:31 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-10-07 12:57:31 +0200
commit9fe54cdfa59ac84449a840e01267af08d2194a51 (patch)
tree3e3a6fe95add14541d6b9da00db5c9c068417678 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku
parent96588895b599d08d21264f34190e37f695c0489f (diff)
downloadpdf-over-9fe54cdfa59ac84449a840e01267af08d2194a51.tar.gz
pdf-over-9fe54cdfa59ac84449a840e01267af08d2194a51.tar.bz2
pdf-over-9fe54cdfa59ac84449a840e01267af08d2194a51.zip
expiry interstitial + waiting for fingerprint screen
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java19
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustParser.java32
2 files changed, 50 insertions, 1 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 2e301a2e..3efecb4c 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
@@ -291,6 +291,10 @@ public class MobileBKUConnector implements BkuSlConnector {
state.rememberCredentialsIfNecessary(this.credentials);
}
+ if (html.interstitialBlock != null) {
+ this.state.showInformationMessage(html.interstitialBlock.interstitialMessage);
+ return buildFormSubmit(html, html.interstitialBlock.submitButton);
+ }
if (html.errorBlock != null) {
try {
this.credentials.password = null;
@@ -342,7 +346,7 @@ public class MobileBKUConnector implements BkuSlConnector {
}
if (html.waitingForAppBlock != null) {
try (LongPollThread longPollThread = new LongPollThread(html.waitingForAppBlock.pollingURI, () -> { this.state.signalAppOpened(); })) {
- this.state.showWaitingForApp(html.waitingForAppBlock.referenceValue, html.signatureDataLink, html.smsTanLink != null, html.fido2Link != null);
+ this.state.showWaitingForAppOpen(html.waitingForAppBlock.referenceValue, html.signatureDataLink, html.smsTanLink != null, html.fido2Link != null);
longPollThread.start();
var result = this.state.waitForAppOpen();
switch (result) {
@@ -353,6 +357,19 @@ public class MobileBKUConnector implements BkuSlConnector {
return new HttpGet(html.htmlDocument.baseUri());
}
}
+ if (html.waitingForBiometryBlock != null) {
+ try (LongPollThread longPollThread = new LongPollThread(html.waitingForBiometryBlock.pollingURI, () -> { this.state.signalAppBiometryDone(); })) {
+ this.state.showWaitingForAppBiometry(html.waitingForBiometryBlock.referenceValue, html.signatureDataLink, html.smsTanLink != null, html.fido2Link != null);
+ longPollThread.start();
+ var result = this.state.waitForAppBiometry();
+ switch (result) {
+ case UPDATE: break;
+ case TO_FIDO2: if (html.fido2Link != null) return new HttpGet(html.fido2Link); break;
+ case TO_SMS: if (html.smsTanLink != null) return new HttpGet(html.smsTanLink); break;
+ }
+ return new HttpGet(html.htmlDocument.baseUri());
+ }
+ }
if (html.fido2Block != null) {
var fido2Result = this.state.promptUserForFIDO2Auth(html.fido2Block.fidoOptions, html.signatureDataLink, html.smsTanLink != null);
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 f7bd45bf..1d0b6406 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,19 @@ public class ATrustParser {
}
}
+ public static class InterstitialBlock extends TopLevelFormBlock {
+ public final @Nonnull String submitButton;
+ public final @Nonnull String interstitialMessage;
+
+ private InterstitialBlock(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull Map<String, String> formOptions) throws ComponentParseFailed {
+ super(htmlDocument, formOptions);
+ if (htmlDocument.baseUri().contains("/ExpiresInfo.aspx")) {
+ this.interstitialMessage = ISNOTNULL(getElementEnsureNotNull("#Label2").ownText());
+ this.submitButton = "#Button_Next";
+ } else { throw new ComponentParseFailed(); }
+ }
+ }
+
public static class ErrorBlock extends TopLevelFormBlock {
public final boolean isRecoverable;
public final @Nonnull String errorText;
@@ -159,6 +172,19 @@ public class ATrustParser {
}
}
+ public static class WaitingForBiometryBlock extends TopLevelFormBlock {
+ public final @Nonnull String referenceValue;
+ public final @Nonnull URI pollingURI;
+
+ private WaitingForBiometryBlock(@Nonnull org.jsoup.nodes.Document htmlDocument, @Nonnull Map<String, String> formOptions) throws ComponentParseFailed {
+ super(htmlDocument, formOptions);
+ abortIfElementMissing("#biometricimage");
+
+ this.referenceValue = ISNOTNULL(getElementEnsureNotNull("#vergleichswert").ownText());
+ this.pollingURI = getLongPollURI();
+ }
+ }
+
public static class Fido2Block extends TopLevelFormBlock {
public final @Nonnull String fidoOptions;
private final @Nonnull String credentialResultKey;
@@ -186,21 +212,25 @@ public class ATrustParser {
public final @CheckForNull URI fido2Link;
/* top-level blocks (exactly one is not null) */
+ public final @CheckForNull InterstitialBlock interstitialBlock;
public final @CheckForNull ErrorBlock errorBlock;
public final @CheckForNull UsernamePasswordBlock usernamePasswordBlock;
public final @CheckForNull SMSTanBlock smsTanBlock;
public final @CheckForNull QRCodeBlock qrCodeBlock;
public final @CheckForNull WaitingForAppBlock waitingForAppBlock;
+ public final @CheckForNull WaitingForBiometryBlock waitingForBiometryBlock;
public final @CheckForNull Fido2Block fido2Block;
private void validate() {
Set<String> populated = new HashSet<>();
+ if (interstitialBlock != null) populated.add("interstitialBlock");
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 (waitingForAppBlock != null) populated.add("waitingForAppBlock");
+ if (waitingForBiometryBlock != null) populated.add("waitingForBiometryBlock");
if (fido2Block != null) populated.add("fido2Block");
switch (populated.size()) {
@@ -280,11 +310,13 @@ public class ATrustParser {
this.smsTanLink = getHrefIfExists("#SmsButton");
this.fido2Link = getHrefIfExists("#FidoButton");
+ this.interstitialBlock = TryParseMainBlock(InterstitialBlock.class);
this.errorBlock = TryParseMainBlock(ErrorBlock.class);
this.usernamePasswordBlock = TryParseMainBlock(UsernamePasswordBlock.class);
this.smsTanBlock = TryParseMainBlock(SMSTanBlock.class);
this.qrCodeBlock = TryParseMainBlock(QRCodeBlock.class);
this.waitingForAppBlock = TryParseMainBlock(WaitingForAppBlock.class);
+ this.waitingForBiometryBlock = TryParseMainBlock(WaitingForBiometryBlock.class);
this.fido2Block = TryParseMainBlock(Fido2Block.class);
validate();