From 523a81cf86239f3c7d3bbb212dad2c779951ecba Mon Sep 17 00:00:00 2001
From: tknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>
Date: Mon, 18 Jan 2010 10:14:45 +0000
Subject: - bug fixed (new method v1.2.0 was not accepted by web verification
 connector) - minor bugs fixed in error.jsp - updating SIGNATURBLOCK.jsp (->
 v1.2.0)

git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@555 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
---
 .../java/at/knowcenter/wag/egov/egiz/PdfAS.java    |  2 +-
 .../egov/egiz/sig/connectors/ConnectorChooser.java |  8 ++---
 src/main/webapp/jsp/SIGNATURBLOCK.jsp              |  2 +-
 src/main/webapp/jsp/error.jsp                      | 38 +++++++++++++---------
 4 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
index 5f565e1..0ae2e8e 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
@@ -99,7 +99,7 @@ public abstract class PdfAS
    * The current version of the pdf-as library. This version string is logged on every invocation
    * of the api or the web application.
    */
-  public static final String PDFAS_VERSION = "3.1 (20100115)";
+  public static final String PDFAS_VERSION = "3.1 (20100118)";
   
   /**
    * The key of the strict mode setting.
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java
index 96f2311..98d336e 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java
@@ -156,9 +156,9 @@ public final class ConnectorChooser
 
       throw new ConnectorException(300, "The SIG_KZ version is 1.0.0, but SIG_ID is neither MOA nor Old base64 nor Hotfix base64 ???'");
     }
-    if (sig_kz.getVersion().equals(SignatorFactory.VERSION_1_1_0))
+    if (sig_kz.getVersion().equals(SignatorFactory.VERSION_1_1_0) || sig_kz.getVersion().equals(SignatorFactory.VERSION_1_2_0))
     {
-      log.debug("sig_kz version is 1.1.0 -> choosing detached (loc ref) connector.");
+      log.debug("sig_kz version is 1.1.0/1.2.0 -> choosing detached (loc ref) connector.");
 
       ConnectorParameters cp = new ConnectorParameters();
       cp.setProfileId(profile);
@@ -191,9 +191,9 @@ public final class ConnectorChooser
       return new EnvelopingBase64MOAConnector(cp);
     }
 
-    if (sig_kz.getVersion().equals(SignatorFactory.VERSION_1_1_0))
+    if (sig_kz.getVersion().equals(SignatorFactory.VERSION_1_1_0) || sig_kz.getVersion().equals(SignatorFactory.VERSION_1_2_0))
     {
-      log.debug("sig_kz version is 1.1.0 -> choosing detached (loc ref) connector.");
+      log.debug("sig_kz version is 1.1.0/1.2.0 -> choosing detached (loc ref) connector.");
 
       //throw new ConnectorException(370, "The MOA detached connector is not suitable for verification.");
       // TODO TR: Switch her for SwA or Detached-URL Connector
diff --git a/src/main/webapp/jsp/SIGNATURBLOCK.jsp b/src/main/webapp/jsp/SIGNATURBLOCK.jsp
index dc21f9a..336365b 100644
--- a/src/main/webapp/jsp/SIGNATURBLOCK.jsp
+++ b/src/main/webapp/jsp/SIGNATURBLOCK.jsp
@@ -86,7 +86,7 @@
 		<td class="pdfasvalue">
 			<div class="pdfasnobreak">urn:pdfsigfilter:</div>
 			<div class="pdfasnobreak">bka.gv.at:</div>
-			<div class="pdfasnobreak"><%= FormFields.VALUE_MODE_TEXTUAL.equals(mode) ? "text" : "binaer" %>:v1.1.0</div>
+			<div class="pdfasnobreak"><%= FormFields.VALUE_MODE_TEXTUAL.equals(mode) ? "text:v1.2.0" : "binaer:v1.1.0" %></div>
 		</td>
 	</tr>
 	<tr>
diff --git a/src/main/webapp/jsp/error.jsp b/src/main/webapp/jsp/error.jsp
index bcac0dc..d135f88 100644
--- a/src/main/webapp/jsp/error.jsp
+++ b/src/main/webapp/jsp/error.jsp
@@ -3,6 +3,7 @@
 <%@ page import="at.knowcenter.wag.egov.egiz.web.servlets.SignServlet" %>
 <%@ page import="at.knowcenter.wag.egov.egiz.exceptions.*" %>
 <%@ page import="at.gv.egiz.pdfas.web.SignSessionInformation" %>
+<%@ page import="at.gv.egiz.pdfas.web.VerifySessionInformation" %>
 <%@ page import="at.knowcenter.wag.egov.egiz.web.SessionAttributes" %>
 <%@ page import="org.apache.commons.httpclient.util.EncodingUtil" %>
 <%@ page import="org.apache.commons.httpclient.NameValuePair" %>
@@ -46,24 +47,29 @@
      paramInvok = true;
   }
   boolean rb = Boolean.TRUE.equals((Boolean) request.getAttribute("resourcebundle"));
-  SignSessionInformation si = (SignSessionInformation) session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION);
+  Object sessionInfo = session.getAttribute(SessionAttributes.ATTRIBUTE_SESSION_INFORMATION);
   
-  boolean isExternalInvocation = (si != null && si.exappinf != null);
-  
-  if (isExternalInvocation) {
-		String urlParams = EncodingUtil.formUrlEncode(new NameValuePair[] { new NameValuePair("error", error), new NameValuePair("cause", cause) }, "ISO8859_1");
-     if (si.exappinf.invoke_error_url == null) {
-		 // prevent circular redirect
-		 si.exappinf = null;
-  	    String redirectUrl = response.encodeRedirectURL(request.getContextPath() + "/jsp/error.jsp" + "?" + urlParams);
-		 session.setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL, redirectUrl);
-     } else {
-		String errorUrl = si.exappinf.invoke_error_url + "?" + urlParams;
-	   session.setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL, errorUrl);
+  boolean isExternalInvocation = false;
+  if (sessionInfo != null) {
+     if (sessionInfo instanceof SignSessionInformation) {
+        SignSessionInformation si = (SignSessionInformation) sessionInfo;
+		  isExternalInvocation = (si != null && si.exappinf != null);
+		  if (isExternalInvocation) {
+				String urlParams = EncodingUtil.formUrlEncode(new NameValuePair[] { new NameValuePair("error", error), new NameValuePair("cause", cause) }, "ISO8859_1");
+		     if (si.exappinf.invoke_error_url == null) {
+				 // prevent circular redirect
+				 si.exappinf = null;
+		  	    String redirectUrl = response.encodeRedirectURL(request.getContextPath() + "/jsp/error.jsp" + "?" + urlParams);
+				 session.setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL, redirectUrl);
+		     } else {
+				String errorUrl = si.exappinf.invoke_error_url + "?" + urlParams;
+			   session.setAttribute(SessionAttributes.PARENT_WEBAPP_REDIRECT_URL, errorUrl);
+		     }
+		   String redirectHelper = response.encodeRedirectURL(request.getContextPath() + "/jsp/redirect_to_parent.jsp");
+		   SignServletHelper.disableBrowserCacheForResponse(response);
+		   response.sendRedirect(redirectHelper);
+		  }
      }
-   String redirectHelper = response.encodeRedirectURL(request.getContextPath() + "/jsp/redirect_to_parent.jsp");
-   SignServletHelper.disableBrowserCacheForResponse(response);
-   response.sendRedirect(redirectHelper);
   }
 	
 %>
-- 
cgit v1.2.3