From 009afebd8d3b877023a0f348285e78ba28a239e7 Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Mon, 4 Nov 2019 16:08:30 +0100 Subject: sms tan button implemented --- .../asit/pdfover/gui/bku/MobileBKUConnector.java | 39 ++++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui') 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 19def107..0835ff40 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 @@ -15,6 +15,7 @@ */ package at.asit.pdfover.gui.bku; +import java.io.IOException; import java.net.URL; import org.apache.commons.httpclient.util.HttpURLConnection; @@ -92,22 +93,16 @@ public class MobileBKUConnector implements BkuSlConnector { String responseData = handler.postCredentials(); if (responseData.contains("undecided.aspx?sid=")) { //$NON-NLS-1$ - // handle polling - //this.state.showOpenAppMessage(); this.state.showOpenAppMessageWithSMSandCancel(); if (((ATrustStatus) this.state.getStatus()).isSmsTan()) { - //((ATrustStatus)this.state.getStatus()).setSmsTan(false); ATrustHandler aHandler = (ATrustHandler) handler; String response = aHandler.postSMSRequest(); aHandler.handleCredentialsResponse(response); - ((ATrustStatus)this.state.getStatus()).setIsAPPTan("sms"); //$NON-NLS-1$ - this.state.checkTAN(); } else { handler.handlePolling(responseData); } - } else { @@ -220,4 +215,36 @@ public class MobileBKUConnector implements BkuSlConnector { return signingState.getSignatureResponse(); } + + + private void handleSMSTan(MobileBKUHandler handler) throws Exception { + + if (handler instanceof ATrustHandler) { + ((ATrustStatus)this.state.getStatus()).setSmsTan(false); + ATrustHandler aHandler = (ATrustHandler) handler; + String response = aHandler.postSMSRequest(); + aHandler.handleCredentialsResponse(response); + //((ATrustStatus)this.state.getStatus()).setIsAPPTan("sms"); //$NON-NLS-1$ + this.state.checkTAN(); + + // Post TAN + try { + response = aHandler.postTAN(); + log.trace("Response from mobile BKU: " + response); //$NON-NLS-1$ + + // Now we have received some data lets check it: + aHandler.handleTANResponse(response); + + } catch (Exception ex) { + log.error("Error in PostTanThread", ex); //$NON-NLS-1$ + this.state.setThreadException(ex); + this.state.displayError(ex); + throw new SignatureException(ex); + } + // if everything went fine -> return + //return signingState.getSignatureResponse(); + } + } + + } -- cgit v1.2.3