From c7e732e3f5b5cccc6f7dd0c59350e8714faa66b1 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Thu, 14 Jul 2022 11:27:19 +0200 Subject: hook the remember credentials functionality up --- .../java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java | 8 +++++--- .../at/asit/pdfover/gui/workflow/states/MobileBKUState.java | 13 +++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'pdf-over-gui/src/main/java') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java index 75f02dd6..96530cf0 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java @@ -231,6 +231,7 @@ public class ATrustHandler extends MobileBKUHandler { if (responseData.contains("signature.aspx?sid=")) { // credentials ok! TAN entry + state.rememberCredentialsIfNecessary(); log.debug("Credentials accepted - TAN required"); sessionID = MobileBKUHelper.extractSubstring(responseData, "signature.aspx?sid=", "\""); viewState = MobileBKUHelper.extractValueFromTagWithParam(responseData, "", "id", "__VIEWSTATE", "value"); @@ -264,6 +265,7 @@ public class ATrustHandler extends MobileBKUHandler { } else if (responseData.contains("sl:InfoboxReadResponse")) { // credentials ok! InfoboxReadResponse + state.rememberCredentialsIfNecessary(); log.debug("Credentials accepted - Response given"); getSigningState().setSignatureResponse(new SLResponse(responseData, getStatus().server, null, null)); return; @@ -275,6 +277,9 @@ public class ATrustHandler extends MobileBKUHandler { return; }else { // error page + + // force UI again! + state.clearRememberedCredentials(); // extract error text! try { String errorMessage = MobileBKUHelper.extractContentFromTagWithParam(responseData, "span", "class", "ErrorClass"); @@ -283,9 +288,6 @@ public class ATrustHandler extends MobileBKUHandler { throw new SignatureException(MobileBKUHelper.extractSubstring(responseData, "", "") + ": " + MobileBKUHelper.extractSubstring(responseData, "", "")); } - - // force UI again! - status.mobilePassword = null; } log.debug("sessionID: " + sessionID); 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 d5f5cbe0..020ead33 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 @@ -186,6 +186,19 @@ public class MobileBKUState extends State { }); } + public void rememberCredentialsIfNecessary() { + if (getStateMachine().configProvider.getRememberMobilePassword()) + { + getStateMachine().configProvider.setDefaultMobileNumberOverlay(status.phoneNumber); + getStateMachine().configProvider.setDefaultMobilePasswordOverlay(status.mobilePassword); + } + } + + public void clearRememberedCredentials() { + getStateMachine().configProvider.setDefaultMobilePasswordOverlay(null); + status.mobilePassword = null; + } + /** * Make sure phone number and password are set in the MobileBKUStatus */ -- cgit v1.2.3