summaryrefslogtreecommitdiff
path: root/pdf-over-gui
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-02 14:56:46 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-02 14:56:46 +0200
commit832cf5d3353a5fef867d177b32681b1295497626 (patch)
tree7fc89dddd2247933a9da569fa05df124ece46e76 /pdf-over-gui
parent9144df55ff7eac00f7633da6b8e4b58bab923d1f (diff)
downloadpdf-over-832cf5d3353a5fef867d177b32681b1295497626.tar.gz
pdf-over-832cf5d3353a5fef867d177b32681b1295497626.tar.bz2
pdf-over-832cf5d3353a5fef867d177b32681b1295497626.zip
YAGNI: SigningState setters/getters
Diffstat (limited to 'pdf-over-gui')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java10
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java10
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java4
6 files changed, 18 insertions, 22 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 2944dd07..34b53173 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
@@ -55,7 +55,7 @@ public class MobileBKUConnector implements BkuSlConnector {
@Override
public SLResponse handleSLRequest(SLRequest request) throws SignatureException {
PdfAs4SigningState signingState = this.state.getSigningState();
- signingState.setSignatureRequest(request);
+ signingState.signatureRequest = request;
MobileBKUHandler handler = this.state.handler;
@@ -112,9 +112,9 @@ public class MobileBKUConnector implements BkuSlConnector {
} while(this.state.status.errorMessage != null);
// Check if response is already available
- if (signingState.hasSignatureResponse()) {
- SLResponse response = signingState.getSignatureResponse();
- signingState.setSignatureResponse(null);
+ if (signingState.signatureResponse != null) {
+ SLResponse response = signingState.signatureResponse;
+ signingState.signatureResponse = null;
return response;
}
@@ -200,7 +200,7 @@ public class MobileBKUConnector implements BkuSlConnector {
throw new SignatureException(new IllegalStateException());
} while (this.state.status.tanTries == -2);
- return signingState.getSignatureResponse();
+ return signingState.signatureResponse;
}
private boolean consumeCancelError() {
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 d6febeaa..d0d7e50e 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
@@ -258,12 +258,12 @@ public class ATrustHandler extends MobileBKUHandler {
// credentials ok! InfoboxReadResponse
state.rememberCredentialsIfNecessary();
log.debug("Credentials accepted - Response given");
- getSigningState().setSignatureResponse(new SLResponse(responseData, getStatus().server, null, null));
+ getSigningState().signatureResponse = new SLResponse(responseData, getStatus().server, null, null);
return;
} else if (responseData.contains("undecided.aspx?sid=")) {
// skip intermediate page
log.debug("Page Undecided");
- getSigningState().setSignatureResponse(new SLResponse(responseData, getStatus().server, null, null));
+ getSigningState().signatureResponse = new SLResponse(responseData, getStatus().server, null, null);
status.errorMessage = "waiting...";
return;
}else {
@@ -339,8 +339,7 @@ public class ATrustHandler extends MobileBKUHandler {
responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) {
// success !!
- getSigningState().setSignatureResponse(
- new SLResponse(responseData, getStatus().server, null, null));
+ getSigningState().signatureResponse = new SLResponse(responseData, getStatus().server, null, null);
} else {
try {
String tries = MobileBKUHelper.extractSubstring(
@@ -465,8 +464,7 @@ public class ATrustHandler extends MobileBKUHandler {
responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) {
// success !!
- getSigningState().setSignatureResponse(
- new SLResponse(responseData, getStatus().server, null, null));
+ getSigningState().signatureResponse = new SLResponse(responseData, getStatus().server, null, null);
return true;
}
return false;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java
index bf5c865f..e908ec3c 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKHandler.java
@@ -158,8 +158,7 @@ public class IAIKHandler extends MobileBKUHandler {
if (responseData.contains("sl:InfoboxReadResponse")) {
// credentials ok! InfoboxReadResponse
- getSigningState().setSignatureResponse(
- new SLResponse(responseData, status.server, null, null));
+ getSigningState().signatureResponse = new SLResponse(responseData, status.server, null, null);
return;
}
@@ -288,8 +287,7 @@ public class IAIKHandler extends MobileBKUHandler {
status.errorMessage = null;
if (responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) {
// success
- getSigningState().setSignatureResponse(
- new SLResponse(responseData, status.server, null, null));
+ getSigningState().signatureResponse = new SLResponse(responseData, status.server, null, null);
} else {
try {
String errorMessage = MobileBKUHelper.extractContentFromTagWithParam(
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java
index ad0f1863..1d2074c7 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java
@@ -180,7 +180,7 @@ public class KSState extends State {
else if (config.getKeyStorePassStorageType() == KeyStorePassStorageType.MEMORY)
config.setKeyStoreKeyPassOverlay(keyPass);
- signingState.setKSSigner(file, alias, storePass, keyPass, type);
+ signingState.setKeystoreSigner(file, alias, storePass, keyPass, type);
} catch (SignatureException e) {
log.error("Error loading keystore", e);
if (askShouldRetry("error.KeyStore"))
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java
index 779d39c7..6e3922dc 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java
@@ -137,8 +137,8 @@ public class LocalBKUState extends State {
log.debug("SL Response: " + response);
SLResponse slResponse = new SLResponse(response, server,
userAgent, signatureLayout);
- this.signingState.setSignatureResponse(slResponse);
- this.signingState.setUseBase64Request(LocalBKUState.this.useBase64Request);
+ this.signingState.signatureResponse = slResponse;
+ this.signingState.useBase64Request = LocalBKUState.this.useBase64Request;
}
} catch (Exception e) {
log.error("SignLocalBKUThread: ", e);
@@ -175,13 +175,13 @@ public class LocalBKUState extends State {
PdfAs4SigningState signingState = status.signingState;
- if (!signingState.hasSignatureResponse()
+ if ((signingState.signatureResponse == null)
&& this.threadException == null) {
Thread t = new Thread(new SignLocalBKUThread(this, signingState));
t.start();
return;
}
- signingState.setBKUConnector(new LocalBKUConnector());
+ signingState.bkuConnector = new LocalBKUConnector();
if (this.threadException != null) {
ErrorDialog dialog = new ErrorDialog(
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 e74ba969..bb1be5d0 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
@@ -557,9 +557,9 @@ public class MobileBKUState extends State {
public void run() {
this.signingState = getStateMachine().status.signingState;
- this.signingState.setBKUConnector(new MobileBKUConnector(this));
+ this.signingState.bkuConnector = new MobileBKUConnector(this);
log.debug("Setting base64 request to " + this.handler.useBase64Request());
- this.signingState.setUseBase64Request(this.handler.useBase64Request());
+ this.signingState.useBase64Request = this.handler.useBase64Request();
if (this.threadException != null) {
displayError(this.threadException);