diff options
author | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2015-02-23 15:29:35 +0100 |
---|---|---|
committer | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2015-02-23 15:29:35 +0100 |
commit | 7b6860087f50b7576c31f7aa50714d3fa7a9b228 (patch) | |
tree | c2347315c5a0e4e6565f9020d3e1d7d38d94abfe /pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow | |
parent | 72cb98966c0d631ed4741bf071c621fd36f33fd6 (diff) | |
download | mocca-7b6860087f50b7576c31f7aa50714d3fa7a9b228.tar.gz mocca-7b6860087f50b7576c31f7aa50714d3fa7a9b228.tar.bz2 mocca-7b6860087f50b7576c31f7aa50714d3fa7a9b228.zip |
BASE64 request handling
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java | 30 | ||||
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java | 10 |
2 files changed, 27 insertions, 13 deletions
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 3962d836..dd47fe9d 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 @@ -25,8 +25,8 @@ import org.eclipse.swt.SWT; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import at.asit.pdfover.gui.MainWindow.Buttons; import at.asit.pdfover.gui.Constants; +import at.asit.pdfover.gui.MainWindow.Buttons; import at.asit.pdfover.gui.MainWindowBehavior; import at.asit.pdfover.gui.bku.BKUHelper; import at.asit.pdfover.gui.bku.LocalBKUConnector; @@ -36,6 +36,7 @@ import at.asit.pdfover.gui.utils.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.signator.SigningState; /** * Logical state for performing the BKU Request to a local BKU @@ -62,10 +63,11 @@ public class LocalBKUState extends State { */ public final static String BKU_RESPONSE_HEADER_SIGNATURE_LAYOUT = "SignatureLayout"; //$NON-NLS-1$ - at.asit.pdfover.signator.SigningState signingState; - Exception threadException = null; + /** Whether to use Base64 or FileUpload Request */ + boolean useBase64Request = false; + /** * Null-Operation SL-Request */ @@ -86,13 +88,16 @@ public class LocalBKUState extends State { private final class SignLocalBKUThread implements Runnable { private LocalBKUState state; + private SigningState signingState; /** * @param localBKUState + * @param signingState */ - public SignLocalBKUThread(LocalBKUState localBKUState) { + public SignLocalBKUThread(LocalBKUState localBKUState, SigningState signingState) { this.state = localBKUState; + this.signingState = signingState; } @Override @@ -117,6 +122,10 @@ public class LocalBKUState extends State { server = getResponseHeader(method, BKU_RESPONSE_HEADER_SERVER); if (server == null) server = ""; //$NON-NLS-1$ + else + if (server.contains("trustDeskbasic")) //$NON-NLS-1$ + LocalBKUState.this.useBase64Request = true; + userAgent = getResponseHeader(method, BKU_RESPONSE_HEADER_USERAGENT); if (userAgent == null) userAgent = ""; //$NON-NLS-1$ @@ -126,7 +135,8 @@ public class LocalBKUState extends State { log.debug("SL Response: " + response); //$NON-NLS-1$ SLResponse slResponse = new SLResponse(response, server, userAgent, signatureLayout); - this.state.signingState.setSignatureResponse(slResponse); + this.signingState.setSignatureResponse(slResponse); + this.signingState.setUseBase64Request(LocalBKUState.this.useBase64Request); } } catch (Exception e) { log.error("SignLocalBKUThread: ", e); //$NON-NLS-1$ @@ -161,15 +171,15 @@ public class LocalBKUState extends State { public void run() { Status status = getStateMachine().getStatus(); - this.signingState = status.getSigningState(); + SigningState signingState = status.getSigningState(); - if (!this.signingState.hasSignatureResponse() + if (!signingState.hasSignatureResponse() && this.threadException == null) { - Thread t = new Thread(new SignLocalBKUThread(this)); + Thread t = new Thread(new SignLocalBKUThread(this, signingState)); t.start(); return; } - this.signingState.setBKUConnector(new LocalBKUConnector()); + signingState.setBKUConnector(new LocalBKUConnector()); if (this.threadException != null) { ErrorDialog dialog = new ErrorDialog( @@ -187,7 +197,7 @@ public class LocalBKUState extends State { } // OK - this.setNextState(new SigningState(getStateMachine())); + this.setNextState(new at.asit.pdfover.gui.workflow.states.SigningState(getStateMachine())); } /* 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 1df8f755..6b0d6684 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 @@ -37,6 +37,8 @@ import at.asit.pdfover.gui.controls.Dialog.BUTTONS; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.utils.Messages; import at.asit.pdfover.gui.workflow.StateMachine; +import at.asit.pdfover.gui.workflow.config.ConfigProvider; +import at.asit.pdfover.signator.SigningState; /** * Logical state for performing the BKU Request to the A-Trust Mobile BKU @@ -67,7 +69,7 @@ public class MobileBKUState extends State { private static final Logger log = LoggerFactory .getLogger(MobileBKUState.class); - at.asit.pdfover.signator.SigningState signingState; + SigningState signingState; Exception threadException = null; @@ -138,7 +140,7 @@ public class MobileBKUState extends State { /** * @return the signingState */ - public at.asit.pdfover.signator.SigningState getSigningState() { + public SigningState getSigningState() { return this.signingState; } @@ -315,6 +317,8 @@ public class MobileBKUState extends State { this.signingState = getStateMachine().getStatus().getSigningState(); this.signingState.setBKUConnector(new MobileBKUConnector(this)); + log.debug("Setting base64 request to " + this.handler.useBase64Request()); //$NON-NLS-1$ + this.signingState.setUseBase64Request(this.handler.useBase64Request()); if (this.threadException != null) { String message = Messages.getString("error.Unexpected"); //$NON-NLS-1$ @@ -335,7 +339,7 @@ public class MobileBKUState extends State { getStateMachine().getGUIProvider().display( this.getWaitingComposite()); - this.setNextState(new SigningState(getStateMachine())); + this.setNextState(new at.asit.pdfover.gui.workflow.states.SigningState(getStateMachine())); } /* |