diff options
author | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2003-12-03 12:06:46 +0000 |
---|---|---|
committer | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2003-12-03 12:06:46 +0000 |
commit | 6c801ae738cdf05c766519d3f7e16d408f1efc63 (patch) | |
tree | 389e2beb078c00c6a9ada1b43c5bde0353789c43 /spss.slinterface/WEB-INF/src/at/gv | |
parent | 907948870ba41526b076e4bb2e9861b805c0f052 (diff) | |
download | moa-id-spss-6c801ae738cdf05c766519d3f7e16d408f1efc63.tar.gz moa-id-spss-6c801ae738cdf05c766519d3f7e16d408f1efc63.tar.bz2 moa-id-spss-6c801ae738cdf05c766519d3f7e16d408f1efc63.zip |
Rudimentär getesteter Zwischenstand.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@71 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.slinterface/WEB-INF/src/at/gv')
3 files changed, 38 insertions, 18 deletions
diff --git a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/Constants.java b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/Constants.java index 1529317fa..8dd6a87ff 100644 --- a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/Constants.java +++ b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/Constants.java @@ -23,6 +23,8 @@ public class Constants public static final String IP_TEMP_DIR_ = "location.tempdir"; public static final String IP_SP_ENDPOINT_ = "service.sp.endpoint"; public static final String IP_SP_TRUSTPROFILEID_ = "service.sp.trustProfileId"; + public static final String IP_RES_SHOWETSI_ = "result.showetsi"; + public static final String IP_RES_SHOWSLMAN_ = "result.showslmanifest"; // Logging hierarchies 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 904640b71..94e3dac22 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 @@ -72,12 +72,16 @@ public class DataInfoBean implements HttpSessionBindingListener private static final String XPATH_SIG_ENV_CONTENT_ = "/" + Constants.NSPRE_MOA_12_ + ":VerifyXMLSignatureRequest/" + Constants.NSPRE_MOA_12_ + ":VerifySignatureInfo/" + Constants.NSPRE_MOA_12_ + ":VerifySignatureEnvironment/*"; - - private static final String SLXHTML_TYPE_PREFIX_ = "http://www.buergerkarte.at/specifications/" + "Security-Layer/20031113?Name=SignedImage&InstanceDocRef="; - ServletContext context_; + private static final String ETSI_TYPE_ = "http://uri.etsi.org/01903/v1.1.1#SignedProperties"; + private static final String SLMANIFEST_TYPE_ = + "http://www.buergerkarte.at/specifications/Securitylayer/20020225#SignatureManifest"; + + + ServletContext context_; + Properties initProps_; /** * Contains objects of type {@link HashInputDataInfo}. @@ -92,6 +96,7 @@ public class DataInfoBean implements HttpSessionBindingListener HttpSession session) throws Exception { context_ = context; + initProps_ = (Properties) context_.getAttribute(Constants.WSCP_INIT_PROPS_); hashInputDataInfos_ = new ArrayList(); int hashInputDataCount_ = 0; @@ -99,8 +104,7 @@ public class DataInfoBean implements HttpSessionBindingListener Element moaResponseElem = moaResponseDoc.getDocumentElement(); List hidElems = DOMUtils.getChildElems(moaResponseElem, Constants.NSURI_MOA_12_, HID_ELEM_, false); - Properties initProps = (Properties) context_.getAttribute(Constants.WSCP_INIT_PROPS_); - String tempDir = initProps.getProperty(Constants.IP_TEMP_DIR_); + String tempDir = initProps_.getProperty(Constants.IP_TEMP_DIR_); if (tempDir == null) { String message = "Init property \"" + Constants.IP_TEMP_DIR_ + "\" not set."; @@ -305,9 +309,9 @@ public class DataInfoBean implements HttpSessionBindingListener } } - // Change the src attributes of all img tags so that they refer to the temporary names if (allImgsSigned) { + // Change the src attributes of all img tags so that they refer to the temporary names for (int i = 0; i < imgTags.getLength(); i++) { Element currImgElem = (Element) imgTags.item(i); @@ -315,24 +319,21 @@ public class DataInfoBean implements HttpSessionBindingListener HashInputDataInfo currHidi = (HashInputDataInfo) signedImages.get(uri); Attr srcAttr = currImgElem.getAttributeNode(SRC_ATTR_); - int slashPos = currHidi.filename_.lastIndexOf('/'); - if (slashPos == -1) slashPos = 0; - String newSrcAttrValue = currHidi.filename_.substring(slashPos + 1); + 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); srcAttr.setNodeValue(newSrcAttrValue); } - } - - // Mark hid slxhtml document - hid.isSLXHTMLDocument_ = true; - // Serialize modified slxhtml document to temporary file location - if (allImgsSigned) - { + // Mark hid as slxhtml document + hid.isSLXHTMLDocument_ = true; + + // Serialize modified slxhtml document to temporary file location FileOutputStream slxhtmlFOS = new FileOutputStream(hid.filename_); MOAInvoker.serializeDocument(slxhtmlDoc, slxhtmlFOS); slxhtmlFOS.close(); } - } /* ---------------------------------------------------------------------------------------------------- */ @@ -366,6 +367,23 @@ public class DataInfoBean implements HttpSessionBindingListener } } + // Check signature references if they refer to etsi attributes or to a SL manifest + for (int i = 0; i < dsigRefs.getLength(); i++) + { + Element currRef = (Element) dsigRefs.item(i); + String type = currRef.getAttribute(TYPE_ATTR_); + if (type != null && type.equals(ETSI_TYPE_)) + { + HashInputDataInfo currHidi = (HashInputDataInfo)hashInputDataInfos.get(i); + currHidi.doShow_ = new Boolean(initProps_.getProperty(Constants.IP_RES_SHOWETSI_).trim()).booleanValue(); + } + if (type != null && type.equals(SLMANIFEST_TYPE_)) + { + HashInputDataInfo currHidi = (HashInputDataInfo)hashInputDataInfos.get(i); + currHidi.doShow_ = new Boolean(initProps_.getProperty(Constants.IP_RES_SHOWSLMAN_).trim()).booleanValue(); + } + } + return imgHids; } diff --git a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/servlets/HashInputDataServlet.java b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/servlets/HashInputDataServlet.java index 3a78b07f4..f7cfb7e6c 100644 --- a/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/servlets/HashInputDataServlet.java +++ b/spss.slinterface/WEB-INF/src/at/gv/egovernment/moa/spss/slinterface/servlets/HashInputDataServlet.java @@ -71,7 +71,7 @@ public class HashInputDataServlet extends HttpServlet dataInfo.setHashInputDataCount(hidCount); String hidFilename = dataInfo.getHashInputDataFilename(); - // Set response headers + // Set content type boolean isSLXHTML = dataInfo.getIsSLXHTMLDocument(); String contenType = (isSLXHTML) ? "text/html" : "application/octet-stream"; response.setContentType(contenType); |