diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-09-30 13:56:31 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-09-30 13:56:31 +0200 |
commit | f5d1de1e0bd56b2c61953b1688e53b6efe249ddb (patch) | |
tree | 8353507673e1f3a82e993dcfb7232802aab7a930 | |
parent | 529e08cd21115834dc9887305a8d199ea83638d2 (diff) | |
download | pdf-over-f5d1de1e0bd56b2c61953b1688e53b6efe249ddb.tar.gz pdf-over-f5d1de1e0bd56b2c61953b1688e53b6efe249ddb.tar.bz2 pdf-over-f5d1de1e0bd56b2c61953b1688e53b6efe249ddb.zip |
remove SLResponse outright
since it's just a glorified string now
8 files changed, 15 insertions, 78 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java index f91924ad..2993ea55 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java @@ -34,7 +34,6 @@ import at.asit.pdfover.commons.Constants; import at.asit.pdfover.gui.utils.FileUploadSource;
import at.asit.pdfover.signator.BkuSlConnector;
import at.asit.pdfover.signator.SLRequest;
-import at.asit.pdfover.signator.SLResponse;
import at.asit.pdfover.signator.SignatureException;
/**
@@ -65,7 +64,7 @@ public class LocalBKUConnector implements BkuSlConnector { * @see at.asit.pdfover.signator.BkuSlConnector#handleSLRequest(java.lang.String)
*/
@Override
- public SLResponse handleSLRequest(SLRequest request) throws SignatureException {
+ public String handleSLRequest(SLRequest request) throws SignatureException {
try {
HttpClient client = BKUHelper.getHttpClient();
PostMethod method = new PostMethod(Constants.LOCAL_BKU_URL);
@@ -94,10 +93,7 @@ public class LocalBKUConnector implements BkuSlConnector { method.getResponseBodyAsString());
}
- String response = method.getResponseBodyAsString();
- log.debug("SL Response: " + response);
- SLResponse slResponse = new SLResponse(response);
- return slResponse;
+ return method.getResponseBodyAsString();
} catch (HttpException e) {
log.error("LocalBKUConnector: ", e);
throw new SignatureException(e);
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 a56b5ce7..0ee258f3 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 @@ -25,7 +25,6 @@ import at.asit.pdfover.gui.bku.mobile.ATrustStatus; import at.asit.pdfover.gui.workflow.states.MobileBKUState;
import at.asit.pdfover.signator.BkuSlConnector;
import at.asit.pdfover.signator.SLRequest;
-import at.asit.pdfover.signator.SLResponse;
import at.asit.pdfover.signator.SignatureException;
import at.asit.pdfover.signer.pdfas.PdfAs4SigningState;
@@ -52,7 +51,7 @@ public class MobileBKUConnector implements BkuSlConnector { * @see at.asit.pdfover.signator.BkuSlConnector#handleSLRequest(java.lang.String)
*/
@Override
- public SLResponse handleSLRequest(SLRequest request) throws SignatureException {
+ public String handleSLRequest(SLRequest request) throws SignatureException {
PdfAs4SigningState signingState = this.state.getSigningState();
signingState.signatureRequest = request;
@@ -111,7 +110,7 @@ public class MobileBKUConnector implements BkuSlConnector { // Check if response is already available
if (signingState.signatureResponse != null) {
- SLResponse response = signingState.signatureResponse;
+ String response = signingState.signatureResponse;
signingState.signatureResponse = null;
return response;
}
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 867bdfd6..abcc1e19 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 @@ -61,7 +61,6 @@ import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.workflow.states.LocalBKUState;
import at.asit.pdfover.gui.workflow.states.MobileBKUState;
import at.asit.pdfover.signator.SLRequest;
-import at.asit.pdfover.signator.SLResponse;
import at.asit.pdfover.signer.pdfas.PdfAs4SigningState;
/**
@@ -512,13 +511,13 @@ public class ATrustHandler { // credentials ok! InfoboxReadResponse
state.rememberCredentialsIfNecessary();
log.debug("Credentials accepted - Response given");
- getSigningState().signatureResponse = new SLResponse(responseData);
+ getSigningState().signatureResponse = responseData;
return;
} else if (responseData.contains("undecided.aspx?sid=")) {
// skip intermediate page
log.debug("Page Undecided");
- getSigningState().signatureResponse = new SLResponse(responseData);
- status.errorMessage = "waiting...";
+ getSigningState().signatureResponse = responseData;
+ status.errorMessage = "waiting..."; // TODO: this looks incorrect...?
return;
}else {
// error page
@@ -591,7 +590,7 @@ public class ATrustHandler { responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) {
// success !!
- getSigningState().signatureResponse = new SLResponse(responseData);
+ getSigningState().signatureResponse = responseData;
} else {
try {
String tries = MobileBKUHelper.extractSubstring(
@@ -701,7 +700,7 @@ public class ATrustHandler { responseData.contains("sl:CreateCMSSignatureResponse xmlns:sl")) {
// success !!
- getSigningState().signatureResponse = new SLResponse(responseData);
+ getSigningState().signatureResponse = responseData;
return true;
}
return false;
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 59274567..f1bfa5b9 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 @@ -35,7 +35,6 @@ import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; -import at.asit.pdfover.signator.SLResponse; import at.asit.pdfover.signer.pdfas.PdfAs4SigningState; /** @@ -120,8 +119,7 @@ public class LocalBKUState extends State { if ((server != null) && (server.contains("trustDeskbasic") || server.contains("asignSecurityLayer"))) LocalBKUState.this.useBase64Request = true; - String response = method.getResponseBodyAsString(); - this.signingState.signatureResponse = new SLResponse(response); + this.signingState.signatureResponse = method.getResponseBodyAsString(); this.signingState.useBase64Request = LocalBKUState.this.useBase64Request; } } catch (Exception e) { diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java index 14e54133..a4f7213b 100644 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java +++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java @@ -26,5 +26,5 @@ public interface BkuSlConnector { * @return SL Response
* @throws SignatureException
*/
- public SLResponse handleSLRequest(SLRequest request) throws SignatureException;
+ public String handleSLRequest(SLRequest request) throws SignatureException;
}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLResponse.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLResponse.java deleted file mode 100644 index 83e479ad..00000000 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.signator; - -//Imports -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Security Layer response - */ -public class SLResponse { - - /** - * SLF4J Logger instance - **/ - @SuppressWarnings("unused") - private static Logger log = LoggerFactory.getLogger(SLResponse.class); - - private String response; - - /** - * Create a new Security Layer response - * @param response the SLResponse - * @param server the server - * @param userAgent the user Agent - * @param signaturLayout the signature Layout - */ - public SLResponse(String response) { - this.response = response; - } - - /** - * Get the Security Layer response text - * @return the Security Layer response text - */ - public String getSLResponse() { - return this.response; - } -} diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java index df094718..4c87542d 100644 --- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java @@ -71,7 +71,7 @@ public class PdfAs4BKUSLConnector extends BaseSLConnector { String slRequestString = SLMarschaller.marshalToString(this.of.createInfoboxReadRequest(request)); PdfAs4SLRequest slRequest = new PdfAs4SLRequest(slRequestString, null); - String slResponse = this.connector.handleSLRequest(slRequest).getSLResponse(); + String slResponse = this.connector.handleSLRequest(slRequest); element = (JAXBElement<?>) SLMarschaller.unmarshalFromString(slResponse); } catch (JAXBException e) { @@ -116,10 +116,9 @@ public class PdfAs4BKUSLConnector extends BaseSLConnector { signatureData = PDFUtils.blackOutSignature(signatureData, pack.getByteRange()); PdfAs4SLRequest slRequest = new PdfAs4SLRequest(slRequestString, signatureData); - String slResponse = this.connector.handleSLRequest(slRequest).getSLResponse(); + String slResponse = this.connector.handleSLRequest(slRequest); - element = (JAXBElement<?>) SLMarschaller - .unmarshalFromString(slResponse); + element = (JAXBElement<?>) SLMarschaller.unmarshalFromString(slResponse); } catch (JAXBException e) { throw new PDFIOException("error.pdf.io.03", e); } catch (PdfAs4SLRequestException e) { diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java index 7d0ea318..5312e582 100644 --- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java @@ -20,7 +20,6 @@ import java.io.ByteArrayOutputStream; import at.asit.pdfover.signator.BkuSlConnector; import at.asit.pdfover.signator.SLRequest; -import at.asit.pdfover.signator.SLResponse; import at.asit.pdfover.signator.SignatureException; import at.gv.egiz.pdfas.common.exceptions.PDFASError; import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; @@ -40,7 +39,7 @@ public class PdfAs4SigningState { /** * The Signature Layer response */ - public SLResponse signatureResponse; + public String signatureResponse; /** * The Sign Parameters |