aboutsummaryrefslogtreecommitdiff
path: root/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss
diff options
context:
space:
mode:
Diffstat (limited to 'spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss')
-rw-r--r--spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/DataInfoBean.java26
-rw-r--r--spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/filters/SL2MOAFilter.java17
2 files changed, 35 insertions, 8 deletions
diff --git a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/DataInfoBean.java b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/DataInfoBean.java
index 94e3dac22..76b06605b 100644
--- a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/DataInfoBean.java
+++ b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/beans/DataInfoBean.java
@@ -25,7 +25,6 @@ import java.util.Set;
import java.util.StringTokenizer;
import javax.servlet.ServletContext;
-import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
@@ -40,6 +39,7 @@ import org.xml.sax.InputSource;
import at.gv.egovernment.moa.spss.slinterface.Constants;
import at.gv.egovernment.moa.spss.slinterface.DOMUtils;
+import at.gv.egovernment.moa.spss.slinterface.URLRewriter;
import at.gv.egovernment.moa.spss.slinterface.XPathUtils;
import at.gv.egovernment.moa.spss.slinterface.moainvoker.MOAInvoker;
@@ -79,8 +79,10 @@ public class DataInfoBean implements HttpSessionBindingListener
private static final String SLMANIFEST_TYPE_ =
"http://www.buergerkarte.at/specifications/Securitylayer/20020225#SignatureManifest";
-
ServletContext context_;
+ String contextPath_;
+ String sessionId_;
+
Properties initProps_;
/**
@@ -92,10 +94,12 @@ public class DataInfoBean implements HttpSessionBindingListener
/* ---------------------------------------------------------------------------------------------------- */
- public DataInfoBean(Document moaRequestDoc, Document moaResponseDoc, ServletContext context,
- HttpSession session) throws Exception
+ public DataInfoBean(Document moaRequestDoc, Document moaResponseDoc, String contextPath, String sessionId,
+ ServletContext context) throws Exception
{
context_ = context;
+ contextPath_ = contextPath;
+ sessionId_ = sessionId;
initProps_ = (Properties) context_.getAttribute(Constants.WSCP_INIT_PROPS_);
hashInputDataInfos_ = new ArrayList();
@@ -116,7 +120,7 @@ public class DataInfoBean implements HttpSessionBindingListener
for (int i = 0; i < hidElems.size(); i++)
{
// Open file for current hash input data
- String currHidFileNameStr = tempDir + session.getId() + "_" + System.currentTimeMillis() + "_" +
+ String currHidFileNameStr = tempDir + sessionId_ + "_" + System.currentTimeMillis() + "_" +
random.nextLong();
currHidFileNameStr = context_.getRealPath(currHidFileNameStr);
FileOutputStream currHidFOS;
@@ -162,6 +166,7 @@ public class DataInfoBean implements HttpSessionBindingListener
hashInputDataInfos_.add(new HashInputDataInfo(currHidFileNameStr));
}
+ logger_.debug("Finnished writing hash input data to files.");
// Check if hids are slxhtml documents; mark them appropriately
try
@@ -180,6 +185,7 @@ public class DataInfoBean implements HttpSessionBindingListener
logger_.error(message, e);
throw new Exception(message, e);
}
+ logger_.debug("Finnished checking hash input data for slxhtml conformity.");
}
/* ---------------------------------------------------------------------------------------------------- */
@@ -320,9 +326,17 @@ public class DataInfoBean implements HttpSessionBindingListener
Attr srcAttr = currImgElem.getAttributeNode(SRC_ATTR_);
int slashPos = currHidi.filename_.lastIndexOf('\\');
+
+// Properties initProps = (Properties) context_.getAttribute(Constants.WSCP_INIT_PROPS_);
+// String tempDir = initProps.getProperty(Constants.IP_TEMP_DIR_);
+// String newSrcAttrValue = "." + tempDir + currHidi.filename_.substring(slashPos + 1);
+
Properties initProps = (Properties) context_.getAttribute(Constants.WSCP_INIT_PROPS_);
String tempDir = initProps.getProperty(Constants.IP_TEMP_DIR_);
- String newSrcAttrValue = "." + tempDir + currHidi.filename_.substring(slashPos + 1);
+ URLRewriter urlRewriter = (URLRewriter) context_.getAttribute(Constants.WSCP_URL_REWRITER_);
+ String newSrcAttrValue = urlRewriter.rewrite(
+ contextPath_ + tempDir + currHidi.filename_.substring(slashPos + 1), sessionId_);
+
srcAttr.setNodeValue(newSrcAttrValue);
}
diff --git a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/filters/SL2MOAFilter.java b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/filters/SL2MOAFilter.java
index b67d978ad..28ceb7ac6 100644
--- a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/filters/SL2MOAFilter.java
+++ b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/filters/SL2MOAFilter.java
@@ -94,6 +94,7 @@ public class SL2MOAFilter implements Filter
// Schema validate SL request
CharArrayReader slXmlRequestCAR = new CharArrayReader(slRequest.xmlRequest_.toCharArray());
Document slXMLRequestDoc = parseSlXmlRequest(slXmlRequestCAR);
+ logger_.debug("Finnished schema validating SL request.");
// Transform SL request into a MOA SPSS request
Properties initProps = (Properties)config_.getServletContext().getAttribute(Constants.WSCP_INIT_PROPS_);
@@ -103,11 +104,13 @@ public class SL2MOAFilter implements Filter
MOAInvoker.serializeDocument(moaXMLRequestDoc, moaRequestBOS);
logger_.debug("SL request transformed into MOA request:\n" + moaRequestBOS);
ByteArrayInputStream moaRequestIS = new ByteArrayInputStream(moaRequestBOS.toByteArray());
+ logger_.debug("Finnished transforming SL request into a MOA SP request.");
// Invoke MOA SPSS
RequestWrapper requestWrapper = new RequestWrapper((HttpServletRequest) request, moaRequestIS);
ResponseWrapper responseWrapper = new ResponseWrapper((HttpServletResponse) response);
chain.doFilter(requestWrapper, responseWrapper);
+ logger_.debug("Finnished invoking MOA SP service.");
// Parse MOA response
DOMParser xmlParser = (DOMParser) config_.getServletContext().getAttribute(Constants.WSCP_XMLPARSER_);
@@ -126,12 +129,17 @@ public class SL2MOAFilter implements Filter
logger_.error(message, e);
throw new ServletException(message, e);
}
+ logger_.debug("Finnished parsing MOA SP response.");
// Create bean with info about signed data
try
{
- DataInfoBean dataInfo = new DataInfoBean(
- moaXMLRequestDoc, moaResponseDoc, config_.getServletContext(), session);
+ DataInfoBean dataInfo = new DataInfoBean(
+ moaXMLRequestDoc,
+ moaResponseDoc,
+ ((HttpServletRequest) request).getContextPath(),
+ session.getId(),
+ config_.getServletContext());
session.setAttribute("dataInfo", dataInfo);
}
catch (Exception e)
@@ -140,19 +148,23 @@ public class SL2MOAFilter implements Filter
logger_.error(message, e);
throw new ServletException(message, e);
}
+ logger_.debug("Finnished creating bean with info about signed data.");
// Transform MOA response into a SL response
Document slResponseDoc;
slResponseDoc = MOA2SL.toSlVerifyXMLSignatureResponse(moaResponseDoc);
session.setAttribute("slResponseDoc", slResponseDoc);
+ logger_.debug("Finnished transforming MOA SP response into a SL response.");
// Create bean with info about signer
SignerInfoBean signerInfo = new SignerInfoBean(slResponseDoc);
request.setAttribute("signerInfo", signerInfo);
+ logger_.debug("Finnished creating bean with info about signer.");
// Create bean with info about checks
ChecksInfoBean checksInfo = new ChecksInfoBean(slResponseDoc);
request.setAttribute("checksInfo", checksInfo);
+ logger_.debug("Finnished creating bean with info about checks.");
// Include jsp page, which writes the overview information about the verified signature
response.setContentType("text/html");
@@ -167,6 +179,7 @@ public class SL2MOAFilter implements Filter
logger_.error(message, e);
throw new ServletException(message, e);
}
+ logger_.debug("Finnished SL2MOAFilter.");
}
/* ---------------------------------------------------------------------------------------------------- */