summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-14 11:27:19 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-07-14 11:27:19 +0200
commitc7e732e3f5b5cccc6f7dd0c59350e8714faa66b1 (patch)
treef5c98dc36d9e55c70908ba39ea4eb4f426f3f716
parentc98c1a5932f2cb396fc8c9fb20983895e62e652e (diff)
downloadpdf-over-c7e732e3f5b5cccc6f7dd0c59350e8714faa66b1.tar.gz
pdf-over-c7e732e3f5b5cccc6f7dd0c59350e8714faa66b1.tar.bz2
pdf-over-c7e732e3f5b5cccc6f7dd0c59350e8714faa66b1.zip
hook the remember credentials functionality up
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java13
2 files changed, 18 insertions, 3 deletions
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, "<sl:ErrorCode>", "</sl:ErrorCode>") + ": " +
MobileBKUHelper.extractSubstring(responseData, "<sl:Info>", "</sl:Info>"));
}
-
- // 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
*/