summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java13
-rw-r--r--BKUOnline/src/main/webapp/finanzonline/iframe.html2
-rw-r--r--BKUOnline/src/main/webapp/multiHashDataInput.html37
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java111
4 files changed, 122 insertions, 41 deletions
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java
index 59766586..df338c4a 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/HashDataInputServlet.java
@@ -5,11 +5,15 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.List;
+import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -17,10 +21,12 @@ import org.apache.commons.logging.LogFactory;
import at.gv.egiz.bku.binding.BindingProcessor;
import at.gv.egiz.bku.binding.Id;
import at.gv.egiz.bku.binding.IdFactory;
+import at.gv.egiz.bku.online.applet.BKUApplet;
import at.gv.egiz.bku.slexceptions.SLRuntimeException;
import at.gv.egiz.bku.utils.StreamUtil;
import at.gv.egiz.stal.HashDataInput;
import at.gv.egiz.stal.STAL;
+import at.gv.egiz.stal.service.STALService;
import at.gv.egiz.stal.service.impl.STALRequestBroker;
import at.gv.egiz.stal.service.impl.STALRequestBrokerImpl;
import at.gv.egiz.stal.service.impl.STALServiceImpl;
@@ -30,6 +36,7 @@ public class HashDataInputServlet extends SpringBKUServlet {
private static Log log = LogFactory.getLog(HashDataInputServlet.class);
public HashDataInputServlet() {
+
}
private STALRequestBroker getSTAL(Id id) {
@@ -64,12 +71,16 @@ public class HashDataInputServlet extends SpringBKUServlet {
List<HashDataInput> hdi = rb.getHashDataInput();
log.debug("Got hashdata list with " + hdi.size() + " entries");
String param = req.getParameter("number");
+ if ((param == null) && (hdi.size() > 1)) {
+ resp.sendRedirect("multiHashDataInput.html");
+ return;
+ }
int num = 0;
if (param != null) {
log.debug("Got request for hashdata#" + num);
num = Integer.parseInt(param);
}
- if ((hdi.size() <= num) || (num < 0)){
+ if ((hdi.size() <= num) || (num < 0)) {
log.warn("Requested hashdatainput exceeds listsize");
resp.sendError(-1);
return;
diff --git a/BKUOnline/src/main/webapp/finanzonline/iframe.html b/BKUOnline/src/main/webapp/finanzonline/iframe.html
index ac2f6c93..144640ce 100644
--- a/BKUOnline/src/main/webapp/finanzonline/iframe.html
+++ b/BKUOnline/src/main/webapp/finanzonline/iframe.html
@@ -12,7 +12,7 @@
</img>
<FORM action="https://moa.brz.gv.at:443/moa-id-auth/StartAuthentication?Target=SA&OA=https://moa.brz.gv.at/finon-prod/fon/buergerkartenlogin&Template=http://moa.brz.gv.at/oa/MOAFinanzOnlineAuthentication.htm" method="POST" name="slform">
<input type="hidden" name="show" value="false">
- <input type="hidden" name="bkuURI" value="https://127.0.0.1:3496/BKUOnline-1.0-SNAPSHOT/https-security-layer-request">
+ <input type="hidden" name="bkuURI" value="https://test.gv.at:3496/https-security-layer-request">
</FORM>
</div>
<div id="tab">
diff --git a/BKUOnline/src/main/webapp/multiHashDataInput.html b/BKUOnline/src/main/webapp/multiHashDataInput.html
new file mode 100644
index 00000000..bb03f8ce
--- /dev/null
+++ b/BKUOnline/src/main/webapp/multiHashDataInput.html
@@ -0,0 +1,37 @@
+<!--
+ Copyright 2008 Federal Chancellery Austria and
+ Graz University of Technology
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Mehrere Signaturedaten</title>
+<style type="text/css">
+h1 {
+ color: red;
+ font-size: 15px;
+ font-weight: 500;
+ font-family: Helvetica, Arial, sans-serif;
+}
+</style>
+</head>
+<body>
+<div style="width:300px; padding:20px; border:5px solid #ff0000;text-align: center">
+<h1>Diese Signatur enthält mehrere Datenobjekte. <br>
+Die Anzeige dieser wird derzeit nicht unterstützt !</h1>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java
index 8ee70f1a..c453e06e 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java
@@ -1,19 +1,19 @@
/*
-* Copyright 2008 Federal Chancellery Austria and
-* Graz University of Technology
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package at.gv.egiz.bku.smccstal;
import java.util.ArrayList;
@@ -37,15 +37,19 @@ import at.gv.egiz.stal.SignRequest;
public abstract class AbstractSMCCSTAL implements STAL {
private static Log log = LogFactory.getLog(AbstractSMCCSTAL.class);
+
+ public final static int DEFAULT_MAX_RETRIES = 3;
protected Locale locale = Locale.getDefault();
-// protected SMCCHelper smccHelper = new SMCCHelper();
+ // protected SMCCHelper smccHelper = new SMCCHelper();
protected SignatureCard signatureCard = null;
protected static Map<String, SMCCSTALRequestHandler> handlerMap = new HashMap<String, SMCCSTALRequestHandler>();
+
+ protected int maxRetries = DEFAULT_MAX_RETRIES;
static {
addRequestHandler(InfoboxReadRequest.class, new InfoBoxReadRequestHandler());
-// addRequestHandler(SignRequest.class, new SignRequestHandler());
+ // addRequestHandler(SignRequest.class, new SignRequestHandler());
}
/**
@@ -58,37 +62,61 @@ public abstract class AbstractSMCCSTAL implements STAL {
protected abstract BKUGUIFacade getGUI();
@Override
- public List<STALResponse> handleRequest(
- List<STALRequest> requestList) {
+ public List<STALResponse> handleRequest(List<STALRequest> requestList) {
log.debug("Got request list containing " + requestList.size()
+ " STAL requests");
List<STALResponse> responseList = new ArrayList<STALResponse>(requestList
.size());
+
for (STALRequest request : requestList) {
log.info("Processing: " + request.getClass());
- SMCCSTALRequestHandler handler = null;
- handler = handlerMap.get(request.getClass().getSimpleName());
- if (handler != null) {
- if (handler.requireCard()) {
- if (waitForCard()) {
- responseList.add(new ErrorResponse(6001));
- break;
+ int retryCounter = 0;
+ while (retryCounter < maxRetries) {
+ log.info("Number of retries: "+retryCounter);
+ SMCCSTALRequestHandler handler = null;
+ handler = handlerMap.get(request.getClass().getSimpleName());
+ if (handler != null) {
+ if (handler.requireCard()) {
+ if (waitForCard()) {
+ responseList.add(new ErrorResponse(6001));
+ break;
+ }
}
- }
- try {
- handler = handler.newInstance();
- handler.init(signatureCard, getGUI());
- STALResponse response = handler.handleRequest(request);
- if (response != null) {
- responseList.add(response);
+ try {
+ handler = handler.newInstance();
+ handler.init(signatureCard, getGUI());
+ STALResponse response = handler.handleRequest(request);
+ if (response != null) {
+ if (response instanceof ErrorResponse) {
+ log.info("Got an error response");
+ if (++retryCounter < maxRetries) {
+ log.info("Retrying");
+ signatureCard = null;
+ } else {
+ responseList.add(response);
+ }
+ } else {
+ responseList.add(response);
+ retryCounter = Integer.MAX_VALUE;
+ break;
+ }
+ } else {
+ log.info("Got null response from handler, assuming quit");
+ retryCounter = Integer.MAX_VALUE;
+ }
+ } catch (Exception e) {
+ log.info("Error while handling STAL request:" + e);
+ if (++retryCounter < maxRetries) {
+ log.info("Retrying");
+ signatureCard = null;
+ } else {
+ responseList.add(new ErrorResponse(6000));
+ }
}
- } catch (Exception e) {
- log.info("Error while handling STAL request:" + e);
- responseList.add(new ErrorResponse(6000));
+ } else {
+ log.error("Cannot find a handler for STAL request: " + request);
+ responseList.add(new ErrorResponse());
}
- } else {
- log.error("Cannot find a handler for STAL request: " + request);
- responseList.add(new ErrorResponse());
}
}
return responseList;
@@ -112,4 +140,9 @@ public abstract class AbstractSMCCSTAL implements STAL {
}
this.locale = locale;
}
+
+ public void setMaxRetries(int maxRetries) {
+ this.maxRetries = maxRetries;
+ }
+
}