From ece7d18cf35374bf4e26d041799cda8f791c89f8 Mon Sep 17 00:00:00 2001 From: gregor Date: Mon, 7 Jul 2003 10:58:37 +0000 Subject: Initial commit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@2 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/logging/LogMsg.java | 43 ++ .../src/at/gv/egovernment/moa/logging/Logger.java | 175 +++++ .../gv/egovernment/moa/logging/LoggingContext.java | 46 ++ .../moa/logging/LoggingContextManager.java | 56 ++ .../at/gv/egovernment/moa/util/Base64Utils.java | 109 +++ .../src/at/gv/egovernment/moa/util/BoolUtils.java | 24 + .../gv/egovernment/moa/util/CollectionUtils.java | 36 + .../src/at/gv/egovernment/moa/util/Constants.java | 218 ++++++ .../src/at/gv/egovernment/moa/util/DOMUtils.java | 806 +++++++++++++++++++++ .../at/gv/egovernment/moa/util/DateTimeUtils.java | 326 +++++++++ .../egovernment/moa/util/EntityResolverChain.java | 52 ++ .../src/at/gv/egovernment/moa/util/FileUtils.java | 87 +++ .../at/gv/egovernment/moa/util/KeyStoreUtils.java | 134 ++++ .../gv/egovernment/moa/util/MOADefaultHandler.java | 82 +++ .../gv/egovernment/moa/util/MOAEntityResolver.java | 103 +++ .../gv/egovernment/moa/util/MOAErrorHandler.java | 85 +++ .../src/at/gv/egovernment/moa/util/MOATimer.java | 110 +++ .../gv/egovernment/moa/util/MessageProvider.java | 63 ++ .../src/at/gv/egovernment/moa/util/Messages.java | 117 +++ .../egovernment/moa/util/NodeIteratorAdapter.java | 87 +++ .../gv/egovernment/moa/util/NodeListAdapter.java | 44 ++ .../egovernment/moa/util/ResourceBundleChain.java | 66 ++ .../src/at/gv/egovernment/moa/util/SSLUtils.java | 222 ++++++ .../egovernment/moa/util/StreamEntityResolver.java | 64 ++ .../at/gv/egovernment/moa/util/StreamUtils.java | 116 +++ .../src/at/gv/egovernment/moa/util/URLDecoder.java | 60 ++ .../src/at/gv/egovernment/moa/util/URLEncoder.java | 63 ++ .../at/gv/egovernment/moa/util/XPathException.java | 58 ++ .../src/at/gv/egovernment/moa/util/XPathUtils.java | 415 +++++++++++ .../src/test/at/gv/egovernment/moa/AllTests.java | 38 + .../test/at/gv/egovernment/moa/MOATestCase.java | 75 ++ .../at/gv/egovernment/moa/util/DOMUtilsTest.java | 137 ++++ .../gv/egovernment/moa/util/DateTimeUtilsTest.java | 104 +++ .../gv/egovernment/moa/util/KeyStoreUtilsTest.java | 90 +++ .../at/gv/egovernment/moa/util/SSLUtilsTest.java | 160 ++++ .../at/gv/egovernment/moa/util/URLDecoderTest.java | 29 + .../at/gv/egovernment/moa/util/URLEncoderTest.java | 43 ++ .../moa/util/XMLGrammarBuilderTest.java | 99 +++ .../at/gv/egovernment/moa/util/XPathUtilsTest.java | 51 ++ 39 files changed, 4693 insertions(+) create mode 100644 common/src/at/gv/egovernment/moa/logging/LogMsg.java create mode 100644 common/src/at/gv/egovernment/moa/logging/Logger.java create mode 100644 common/src/at/gv/egovernment/moa/logging/LoggingContext.java create mode 100644 common/src/at/gv/egovernment/moa/logging/LoggingContextManager.java create mode 100644 common/src/at/gv/egovernment/moa/util/Base64Utils.java create mode 100644 common/src/at/gv/egovernment/moa/util/BoolUtils.java create mode 100644 common/src/at/gv/egovernment/moa/util/CollectionUtils.java create mode 100644 common/src/at/gv/egovernment/moa/util/Constants.java create mode 100644 common/src/at/gv/egovernment/moa/util/DOMUtils.java create mode 100644 common/src/at/gv/egovernment/moa/util/DateTimeUtils.java create mode 100644 common/src/at/gv/egovernment/moa/util/EntityResolverChain.java create mode 100644 common/src/at/gv/egovernment/moa/util/FileUtils.java create mode 100644 common/src/at/gv/egovernment/moa/util/KeyStoreUtils.java create mode 100644 common/src/at/gv/egovernment/moa/util/MOADefaultHandler.java create mode 100644 common/src/at/gv/egovernment/moa/util/MOAEntityResolver.java create mode 100644 common/src/at/gv/egovernment/moa/util/MOAErrorHandler.java create mode 100644 common/src/at/gv/egovernment/moa/util/MOATimer.java create mode 100644 common/src/at/gv/egovernment/moa/util/MessageProvider.java create mode 100644 common/src/at/gv/egovernment/moa/util/Messages.java create mode 100644 common/src/at/gv/egovernment/moa/util/NodeIteratorAdapter.java create mode 100644 common/src/at/gv/egovernment/moa/util/NodeListAdapter.java create mode 100644 common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java create mode 100644 common/src/at/gv/egovernment/moa/util/SSLUtils.java create mode 100644 common/src/at/gv/egovernment/moa/util/StreamEntityResolver.java create mode 100644 common/src/at/gv/egovernment/moa/util/StreamUtils.java create mode 100644 common/src/at/gv/egovernment/moa/util/URLDecoder.java create mode 100644 common/src/at/gv/egovernment/moa/util/URLEncoder.java create mode 100644 common/src/at/gv/egovernment/moa/util/XPathException.java create mode 100644 common/src/at/gv/egovernment/moa/util/XPathUtils.java create mode 100644 common/src/test/at/gv/egovernment/moa/AllTests.java create mode 100644 common/src/test/at/gv/egovernment/moa/MOATestCase.java create mode 100644 common/src/test/at/gv/egovernment/moa/util/DOMUtilsTest.java create mode 100644 common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java create mode 100644 common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java create mode 100644 common/src/test/at/gv/egovernment/moa/util/SSLUtilsTest.java create mode 100644 common/src/test/at/gv/egovernment/moa/util/URLDecoderTest.java create mode 100644 common/src/test/at/gv/egovernment/moa/util/URLEncoderTest.java create mode 100644 common/src/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java create mode 100644 common/src/test/at/gv/egovernment/moa/util/XPathUtilsTest.java (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/logging/LogMsg.java b/common/src/at/gv/egovernment/moa/logging/LogMsg.java new file mode 100644 index 000000000..4d04fc72d --- /dev/null +++ b/common/src/at/gv/egovernment/moa/logging/LogMsg.java @@ -0,0 +1,43 @@ +package at.gv.egovernment.moa.logging; + +/** + * A unified message type to log messages from inside the MOA subsystem. + * + * @author Patrick Peck + * @version $Id$ + */ +public class LogMsg { + /** The message to log. */ + private Object message; + + /** + * Create a LogMsg object. + * + * @param message The actual message to log. May be null. + */ + public LogMsg(Object message) { + this.message = message; + } + + /** + * Convert this log message to a String. + * + * @return The String representation of this log message. + */ + public String toString() { + StringBuffer msg = new StringBuffer(); + LoggingContext ctx = + LoggingContextManager.getInstance().getLoggingContext(); + String tid = ctx != null ? ctx.getTransactionID() : null; + String nodeId = ctx != null ? ctx.getNodeID() : null; + + msg.append("TID="); + msg.append(tid != null ? tid : ""); + msg.append(" NID="); + msg.append(nodeId != null ? nodeId : ""); + msg.append(" MSG="); + msg.append(message != null ? message.toString() : ""); + + return msg.toString(); + } +} diff --git a/common/src/at/gv/egovernment/moa/logging/Logger.java b/common/src/at/gv/egovernment/moa/logging/Logger.java new file mode 100644 index 000000000..eb7aa5634 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/logging/Logger.java @@ -0,0 +1,175 @@ +package at.gv.egovernment.moa.logging; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * A utility class acting as a facade to the logging subsystem. + * + * Configure the logging defaultHierarchy that the Logger uses by + * calling setHierarchy once before calling any of the logging + * output functions. + * + * @author Patrick Peck + * @version $Id$ + */ +public class Logger { + + /** The default logging hierarchy. */ + private static String defaultHierarchy = ""; + + /** + * Get the Log object for the default hierarchy. + * + * @return The Log object to write log messages to. + */ + private static Log getLog() { + return LogFactory.getLog(defaultHierarchy); + } + + /** + * Get the Log object for a given hierarchy. + * + * @param hierarchy The logging hierarchy for which to return the logger. + * @return The Log object to write log messages to. + */ + private static Log getLog(String hierarchy) { + return LogFactory.getLog(hierarchy); + } + + /** + * Set the default hierarchy to which the Logger should send its + * logging output. + * @param hierarchy The logging defaultHierarchy. + */ + public static void setHierarchy(String hierarchy) { + defaultHierarchy = hierarchy; + } + + /** + * Test, if the trace log level is enabled. + * + * @return boolean true, if tracing output is enabled + * false otherwise. + */ + public static boolean isTraceEnabled() { + return getLog().isTraceEnabled(); + } + + /** + * Test, if the trace log level is enabled for a given hierarchy. + * + * @param hierarchy requested log hierarchy + * @return boolean true, if tracing output is enabled + * false otherwise. + */ + public static boolean isTraceEnabled(String hierarchy) { + return getLog(hierarchy).isTraceEnabled(); + } + + /** + * Trace a message. + * + * @param message The message to trace. + */ + public static void trace(Object message) { + getLog().trace(message); + } + + /** + * Test, if the debug log level is enabled. + * + * @return boolean true, if debug output is enabled + * false otherwise. + */ + public static boolean isDebugEnabled() { + return getLog().isDebugEnabled(); + } + + /** + * Test, if the debug log level is enabled for a given hierarchy. + * + * @param hierarchy requested log hierarchy + * @return boolean true, if debug output is enabled + * false otherwise. + */ + public static boolean isDebugEnabled(String hierarchy) { + return getLog(hierarchy).isDebugEnabled(); + } + + /** + * Log a debug message. + * + * @param message The message to log. + */ + public static void debug(Object message) { + getLog().debug(message); + } + + /** + * Log an info message. + * + * @param message The message to log. + */ + public static void info(Object message) { + getLog().info(message); + } + + /** + * Log a warning message. + * + * @param message The message to log. + */ + public static void warn(Object message) { + getLog().warn(message); + } + + /** + * Log a warning message. + * + * @param message The message to log. + * @param t An exception that may be the cause of the warning. + */ + public static void warn(Object message, Throwable t) { + getLog().warn(message, t); + } + + /** + * Log an error message. + * + * @param message The message to log. + */ + public static void error(Object message) { + getLog().error(message); + } + + /** + * Log an error message. + * + * @param message The message to log. + * @param t An exception that may be the cause of the error. + */ + public static void error(Object message, Throwable t) { + getLog().error(message, t); + } + + /** + * Log a fatal error message. + * + * @param message The message to log. + */ + public static void fatal(Object message) { + getLog().fatal(message); + } + + /** + * Log a fatal error message. + * + * @param message The message to log. + * @param t An exception that may be the cause of the error. + */ + public static void fatal(Object message, Throwable t) { + getLog().fatal(message, t); + } + +} diff --git a/common/src/at/gv/egovernment/moa/logging/LoggingContext.java b/common/src/at/gv/egovernment/moa/logging/LoggingContext.java new file mode 100644 index 000000000..42d8db06e --- /dev/null +++ b/common/src/at/gv/egovernment/moa/logging/LoggingContext.java @@ -0,0 +1,46 @@ +package at.gv.egovernment.moa.logging; + +/** + * Encapsulates contextual information (i.e. per request information) for + * logging purposes. + * + * @author Patrick Peck + * @version $Id$ + */ +public class LoggingContext { + /** The name of the node ID system property. */ + public static final String NODE_ID_PROPERTY = "moa.node-id"; + + /** The current transaction ID. */ + private String transactionID; + /** The node ID. */ + private String nodeID; + + /** + * Create a new LoggingContext. + * + * @param transactionID The transaction ID. May be null. + */ + public LoggingContext(String transactionID) { + this.transactionID = transactionID; + this.nodeID = System.getProperty(NODE_ID_PROPERTY); + } + + /** + * Return the transaction ID. + * + * @return The transaction ID. + */ + public String getTransactionID() { + return transactionID; + } + + /** + * Return the node ID. + * + * @return The node ID. + */ + public String getNodeID() { + return nodeID; + } +} diff --git a/common/src/at/gv/egovernment/moa/logging/LoggingContextManager.java b/common/src/at/gv/egovernment/moa/logging/LoggingContextManager.java new file mode 100644 index 000000000..2bbe6caa1 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/logging/LoggingContextManager.java @@ -0,0 +1,56 @@ +package at.gv.egovernment.moa.logging; + +/** + * Provides each thread with a single instance of LoggingContext. + * + * @author Patrick Peck + * @version $Id$ + */ +public class LoggingContextManager { + /** The single instance of this class. */ + private static LoggingContextManager instance = null; + + /** The LoggingContext for each thread. */ + private ThreadLocal context; + + /** + * Get the single instance of the LoggingContextManager class. + * + * @return LoggingContextManager The single instance. + */ + public static synchronized LoggingContextManager getInstance() { + if (instance == null) { + instance = new LoggingContextManager(); + } + return instance; + } + + /** + * Creates a new LoggingContextManager. + * + * Protected to disallow direct instantiation. + */ + protected LoggingContextManager() { + context = new ThreadLocal(); + } + + /** + * Set the LoggingContext context for the current thread. + * + * @param ctx The LoggingContext for the current thread. + */ + public void setLoggingContext(LoggingContext ctx) { + context.set(ctx); + } + + /** + * Return the LoggingContext for the current thread. + * + * @return LoggingContext The LoggingContext for the current + * thread, or null if none has been set. + */ + public LoggingContext getLoggingContext() { + return (LoggingContext) context.get(); + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/Base64Utils.java b/common/src/at/gv/egovernment/moa/util/Base64Utils.java new file mode 100644 index 000000000..ba2c4fb0e --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/Base64Utils.java @@ -0,0 +1,109 @@ +package at.gv.egovernment.moa.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; + +import iaik.utils.Base64InputStream; +import iaik.utils.Base64OutputStream; + +/** + * Utitility functions for encoding/decoding Base64 strings. + * + * @author Patrick Peck + * @version $Id$ + */ +public class Base64Utils { + + /** + * Read the bytes encoded in a Base64 encoded String. + * + * @param base64String The String containing the Base64 encoded + * bytes. + * @param ignoreInvalidChars Whether to ignore invalid Base64 characters. + * @return byte[] The raw bytes contained in the base64String. + * @throws IOException Failed to read the Base64 data. + */ + public static byte[] decode(String base64String, boolean ignoreInvalidChars) + throws IOException { + + Base64InputStream in = + new Base64InputStream( + new ByteArrayInputStream(base64String.getBytes("UTF-8")), + ignoreInvalidChars); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + byte[] bytes = new byte[256]; + int bytesRead; + + while ((bytesRead = in.read(bytes)) > 0) { + out.write(bytes, 0, bytesRead); + } + + return out.toByteArray(); + } + + /** + * Read the bytes encoded in a Base64 encoded String and provide + * them via an InputStream. + * + * @param base64String The String containing the Base64 encoded + * bytes. + * @param ignoreInvalidChars Whether to ignore invalid Base64 characters. + * @return The InputStream from which the binary content of the + * base64String can be read. + */ + public static InputStream decodeToStream( + String base64String, + boolean ignoreInvalidChars) { + + try { + ByteArrayInputStream bin = + new ByteArrayInputStream(base64String.getBytes("UTF-8")); + Base64InputStream in = new Base64InputStream(bin, ignoreInvalidChars); + + return in; + } catch (UnsupportedEncodingException e) { + // cannot occur, since UTF-8 is required to be supported by every JRE + return null; + } + } + + /** + * Convert a byte array to a Base64 encoded String. + * + * @param bytes The bytes to encode. + * @return String The Base64 encoded representation of the bytes. + * @throws IOException Failed to write the bytes as Base64 data. + */ + public static String encode(byte[] bytes) throws IOException { + return encode(new ByteArrayInputStream(bytes)); + } + + /** + * Convert the data contained in the given stream to a Base64 encoded + * String. + * + * @param inputStream The stream containing the data to encode. + * @return The Base64 encoded data of inputStream, as a + * String. + * @throws IOException Failed to convert the data in the stream. + */ + public static String encode(InputStream inputStream) throws IOException { + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + Base64OutputStream base64Stream = new Base64OutputStream(byteStream); + byte[] bytes = new byte[256]; + int bytesRead; + + while ((bytesRead = inputStream.read(bytes)) > 0) { + base64Stream.write(bytes, 0, bytesRead); + } + base64Stream.flush(); + base64Stream.close(); + inputStream.close(); + + return byteStream.toString("UTF-8"); + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/BoolUtils.java b/common/src/at/gv/egovernment/moa/util/BoolUtils.java new file mode 100644 index 000000000..fcd39b4dd --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/BoolUtils.java @@ -0,0 +1,24 @@ +package at.gv.egovernment.moa.util; + +/** + * Utility class for parsing XML schema boolean values. + * + * @author Patrick Peck + * @version $Id$ + */ +public class BoolUtils { + + /** + * Return the boolean value of an xsd:boolean type of DOM + * element/attribute. + * + * @param boolStr The value of the xsd:boolean element/attribute. + * @return true, if boolStr equals + * "true" or "1;". Otherwise, + * false is returned. + */ + public static boolean valueOf(String boolStr) { + return "true".equals(boolStr) || "1".equals(boolStr); + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/CollectionUtils.java b/common/src/at/gv/egovernment/moa/util/CollectionUtils.java new file mode 100644 index 000000000..5329dcbd2 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/CollectionUtils.java @@ -0,0 +1,36 @@ +package at.gv.egovernment.moa.util; + +import java.util.Iterator; +import java.util.List; + +/** + * Various utility methods for dealing with java.util.Collection + * classes. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CollectionUtils { + + /** + * Convert a List of Number objects to an + * int array. + * + * @param nums The List containing the numbers whose integer + * value to put into the result. + * @return The int values of the Numbers contained + * in nums. + */ + public static int[] toIntArray(List nums) { + int[] result = new int[nums.size()]; + Iterator iter; + int i; + + for (i = 0, iter = nums.iterator(); iter.hasNext(); i++) { + Number num = (Number) iter.next(); + result[i] = num.intValue(); + } + + return result; + } +} diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java new file mode 100644 index 000000000..681bed55b --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -0,0 +1,218 @@ +package at.gv.egovernment.moa.util; + +/** + * Contains various constants used throughout the system. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface Constants { + /** Root location of the schema files. */ + public static final String SCHEMA_ROOT = "/resources/schemas/"; + + /** URI of the MOA XML namespace. */ + public static final String MOA_NS_URI = + "http://reference.e-government.gv.at/namespace/moa/20020822#"; + + /** Prefix used for the MOA XML namespace */ + public static final String MOA_PREFIX = "moa"; + + /** Local location of the MOA XML schema definition. */ + public static final String MOA_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOA-SPSS-1.1.xsd"; + + /** URI of the MOA configuration XML namespace. */ + public static final String MOA_CONFIG_NS_URI = + "http://reference.e-government.gv.at/namespace/moaconfig/20021122#"; + + /** URI of the MOA ID configuration XML namespace. */ + public static final String MOA_ID_CONFIG_NS_URI = + "http://www.buergerkarte.at/namespaces/moaconfig#"; + + /** Prefix used for the MOA configuration XML namespace */ + public static final String MOA_CONFIG_PREFIX = "conf"; + + /** Prefix used for the MOA configuration XML namespace */ + public static final String MOA_ID_CONFIG_PREFIX = "confID"; + + /** Local location of the MOA configuration XML schema definition. */ + public static final String MOA_CONFIG_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOA-SPSS-Configuration-1.0.xsd"; + + /** Local location of the MOA ID configuration XML schema definition. */ + public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOA-ID-Configuration-1.1.xsd"; + + /** URI of the Security Layer 1.0 namespace. */ + public static final String SL10_NS_URI = + "http://www.buergerkarte.at/namespaces/securitylayer/20020225#"; + + /** Prefix used for the Security Layer 1.0 XML namespace */ + public static final String SL10_PREFIX = "sl10"; + + /** Local location of the Security Layer 1.0 XML schema definition */ + public static final String SL10_SCHEMA_LOCATION = + SCHEMA_ROOT + "Core.20020225.xsd"; + + /** URI of the Security Layer 1.1 XML namespace */ + public static final String SL11_NS_URI = + "http://www.buergerkarte.at/namespaces/securitylayer/20020831#"; + + /** Prefix used for the Security Layer 1.1 XML namespace */ + public static final String SL11_PREFIX = "sl11"; + + /** Local location of the Security Layer 1.1 XML schema definition */ + public static final String SL11_SCHEMA_LOCATION = + SCHEMA_ROOT + "Core.20020831.xsd"; + + /** URI of the ECDSA XML namespace */ + public static final String ECDSA_NS_URI = + "http://www.buergerkarte.at/namespaces/ecdsa/200206030#"; + + /** Prefix used for ECDSA namespace */ + public static final String ECDSA_PREFIX = "ecdsa"; + + /** Local location of ECDSA XML schema definition */ + public static final String ECDSA_SCHEMA_LOCATION = + SCHEMA_ROOT + "ECDSAKeyValue.xsd"; + + /** URI of the PersonData XML namespace. */ + public static final String PD_NS_URI = + "http://reference.e-government.gv.at/namespace/persondata/20020228#"; + + /** Prefix used for the PersonData XML namespace */ + public static final String PD_PREFIX = "pr"; + + /** Local location of the PersonData XML schema definition */ + public static final String PD_SCHEMA_LOCATION = + SCHEMA_ROOT + "PersonData.xsd"; + + /** URI of the SAML namespace. */ + public static final String SAML_NS_URI = + "urn:oasis:names:tc:SAML:1.0:assertion"; + + /** Prefix used for the SAML XML namespace */ + public static final String SAML_PREFIX = "saml"; + + /** Local location of the SAML XML schema definition. */ + public static final String SAML_SCHEMA_LOCATION = + SCHEMA_ROOT + "cs-sstc-schema-assertion-01.xsd"; + + /** URI of the SAML request-response protocol namespace. */ + public static final String SAMLP_NS_URI = + "urn:oasis:names:tc:SAML:1.0:protocol"; + + /** Prefix used for the SAML request-response protocol namespace */ + public static final String SAMLP_PREFIX = "samlp"; + + /** Local location of the SAML request-response protocol schema definition. */ + public static final String SAMLP_SCHEMA_LOCATION = + SCHEMA_ROOT + "cs-sstc-schema-protocol-01.xsd"; + + /** URI of the XML namespace. */ + public static final String XML_NS_URI = + "http://www.w3.org/XML/1998/namespace"; + + /** Prefix used for the XML namespace */ + public static final String XML_PREFIX = "xml"; + + /** Local location of the XML schema definition. */ + public static final String XML_SCHEMA_LOCATION = SCHEMA_ROOT + "xml.xsd"; + + /** URI of the XMLNS namespace */ + public static final String XMLNS_NS_URI = "http://www.w3.org/2000/xmlns/"; + + /** Prefix used for the XSI namespace */ + public static final String XSI_PREFIX = "xsi"; + + /** Local location of the XSI schema definition. */ + public static final String XSI_SCHEMA_LOCATION = + SCHEMA_ROOT + "XMLSchema-instance.xsd"; + + /** URI of the XSI XMLNS namespace */ + public static final String XSI_NS_URI = + "http://www.w3.org/2001/XMLSchema-instance"; + + /** URI of the XSLT XML namespace */ + public static final String XSLT_NS_URI = + "http://www.w3.org/1999/XSL/Transform"; + + /** Prefix used for the XSLT XML namespace */ + public static final String XSLT_PREFIX = "xsl"; + + /** URI of the XMLDSig XML namespace. */ + public static final String DSIG_NS_URI = "http://www.w3.org/2000/09/xmldsig#"; + + /** Prefix used for the XMLDSig XML namespace */ + public static final String DSIG_PREFIX = "dsig"; + + /** Local location of the XMLDSig XML schema. */ + public static final String DSIG_SCHEMA_LOCATION = + SCHEMA_ROOT + "xmldsig-core-schema.xsd"; + + /** URI of the XMLDSig XPath Filter XML namespace. */ + public static final String DSIG_FILTER2_NS_URI = + "http://www.w3.org/2002/06/xmldsig-filter2"; + + /** Prefix used for the XMLDSig XPath Filter XML namespace */ + public static final String DSIG_FILTER2_PREFIX = "dsig-filter2"; + + /** Local location of the XMLDSig XPath Filter XML schema definition. */ + public static final String DSIG_FILTER2_SCHEMA_LOCATION = + SCHEMA_ROOT + "xmldsig-filter2.xsd"; + + /** URI of the Exclusive Canonicalization XML namespace */ + public static final String DSIG_EC_NS_URI = + "http://www.w3.org/2001/10/xml-exc-c14n#"; + + /** Prefix used for the Exclusive Canonicalization XML namespace */ + public static final String DSIG_EC_PREFIX = "ec"; + + /** Local location of the Exclusive Canonicalizaion XML schema definition */ + public static final String DSIG_EC_SCHEMA_LOCATION = + SCHEMA_ROOT + "exclusive-canonicalization.xsd"; + + /** + * Contains all namespaces and local schema locations for XML schema + * definitions relevant for MOA. For use in validating XML parsers. + */ + public static final String ALL_SCHEMA_LOCATIONS = + (MOA_NS_URI + " " + MOA_SCHEMA_LOCATION + " ") + + (MOA_CONFIG_NS_URI + " " + MOA_CONFIG_SCHEMA_LOCATION + " ") + + (MOA_ID_CONFIG_NS_URI + " " + MOA_ID_CONFIG_SCHEMA_LOCATION + " ") + + (SL10_NS_URI + " " + SL10_SCHEMA_LOCATION + " ") + + (SL11_NS_URI + " " + SL11_SCHEMA_LOCATION + " ") + + (ECDSA_NS_URI + " " + ECDSA_SCHEMA_LOCATION + " ") + + (PD_NS_URI + " " + PD_SCHEMA_LOCATION + " ") + + (SAML_NS_URI + " " + SAML_SCHEMA_LOCATION + " ") + + (SAMLP_NS_URI + " " + SAMLP_SCHEMA_LOCATION + " ") + + (XML_NS_URI + " " + XML_SCHEMA_LOCATION + " ") + + (XSI_NS_URI + " " + XSI_SCHEMA_LOCATION + " ") + + (DSIG_NS_URI + " " + DSIG_SCHEMA_LOCATION + " ") + + (DSIG_FILTER2_NS_URI + " " + DSIG_FILTER2_SCHEMA_LOCATION + " ") + + (DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION); + + /** Security Layer manifest type URI. */ + public static final String SL_MANIFEST_TYPE_URI = + "http://www.buergerkarte.at/specifications/Security-Layer/20020225#SignatureManifest"; + + /** URI of the SHA1 digest algorithm */ + public static final String SHA1_URI = + "http://www.w3.org/2000/09/xmldsig#sha1"; + + /** URI of the Canonical XML algorithm */ + public static final String C14N_URI = + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; + + /** URI of the Canoncial XML with comments algorithm */ + public static final String C14N_WITH_COMMENTS_URI = + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"; + + /** URI of the Exclusive Canonical XML algorithm */ + public static final String EXC_C14N_URI = + "http://www.w3.org/2001/10/xml-exc-c14n#"; + + /** URI of the Exclusive Canonical XML with commments algorithm */ + public static final String EXC_C14N_WITH_COMMENTS_URI = + "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"; +} diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java new file mode 100644 index 000000000..6da99037e --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -0,0 +1,806 @@ +package at.gv.egovernment.moa.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentFragment; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import org.apache.xerces.parsers.DOMParser; +import org.apache.xerces.parsers.SAXParser; +import org.apache.xerces.parsers.XMLGrammarPreparser; +import org.apache.xerces.util.SymbolTable; +import org.apache.xerces.util.XMLGrammarPoolImpl; +import org.apache.xerces.xni.grammars.XMLGrammarDescription; +import org.apache.xerces.xni.grammars.XMLGrammarPool; +import org.apache.xerces.xni.parser.XMLInputSource; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * Various utility functions for handling XML DOM trees. + * + * The parsing methods in this class make use of some features internal to the + * Xerces DOM parser, mainly for performance reasons. As soon as JAXP + * (currently at version 1.2) is better at schema handling, it should be used as + * the parser interface. + * + * @author Patrick Peck + * @version $Id$ + */ +public class DOMUtils { + + /** Feature URI for namespace aware parsing. */ + private static final String NAMESPACES_FEATURE = + "http://xml.org/sax/features/namespaces"; + /** Feature URI for validating parsing. */ + private static final String VALIDATION_FEATURE = + "http://xml.org/sax/features/validation"; + /** Feature URI for schema validating parsing. */ + private static final String SCHEMA_VALIDATION_FEATURE = + "http://apache.org/xml/features/validation/schema"; + /** Feature URI for normalization of element/attribute values. */ + private static final String NORMALIZED_VALUE_FEATURE = + "http://apache.org/xml/features/validation/schema/normalized-value"; + /** Feature URI for parsing ignorable whitespace. */ + private static final String INCLUDE_IGNORABLE_WHITESPACE_FEATURE = + "http://apache.org/xml/features/dom/include-ignorable-whitespace"; + /** Feature URI for creating EntityReference nodes in the DOM tree. */ + private static final String CREATE_ENTITY_REF_NODES_FEATURE = + "http://apache.org/xml/features/dom/create-entity-ref-nodes"; + /** Property URI for providing external schema locations. */ + private static final String EXTERNAL_SCHEMA_LOCATION_PROPERTY = + "http://apache.org/xml/properties/schema/external-schemaLocation"; + /** Property URI for providing the external schema location for elements + * without a namespace. */ + private static final String EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY = + "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"; + /** Property URI for the Xerces grammar pool. */ + private static final String GRAMMAR_POOL = + org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX + + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; + /** A prime number for initializing the symbol table. */ + private static final int BIG_PRIME = 2039; + /** Symbol table for the grammar pool. */ + private static SymbolTable symbolTable = new SymbolTable(BIG_PRIME); + /** Xerces schema grammar pool. */ + private static XMLGrammarPool grammarPool = new XMLGrammarPoolImpl(); + + /** + * Preparse a schema and add it to the schema pool. + * + * @param inputStream An InputStream providing the contents of + * the schema. + * @param systemId The systemId to use for the schema. + * @throws IOException An error occurred reading the schema. + */ + public static void addSchemaToPool(InputStream inputStream, String systemId) + throws IOException { + XMLGrammarPreparser preparser; + + // unlock the pool so that we can add another grammar + grammarPool.unlockPool(); + + // prepare the preparser + preparser = new XMLGrammarPreparser(symbolTable); + preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); + preparser.setProperty(GRAMMAR_POOL, grammarPool); + preparser.setFeature(NAMESPACES_FEATURE, true); + preparser.setFeature(VALIDATION_FEATURE, true); + + // add the grammar to the pool + preparser.preparseGrammar( + XMLGrammarDescription.XML_SCHEMA, + new XMLInputSource(null, systemId, null, inputStream, null)); + + // lock the pool again so that schemas are not added automatically + grammarPool.lockPool(); + } + + /** + * Parse an XML document from an InputStream. + * + * @param inputStream The InputStream containing the XML + * document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @param entityResolver An EntityResolver to resolve external + * entities (schemas and DTDs). If null, it will not be set. + * @param errorHandler An ErrorHandler to decide what to do + * with parsing errors. If null, it will not be set. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocument( + InputStream inputStream, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation, + EntityResolver entityResolver, + ErrorHandler errorHandler) + throws SAXException, IOException, ParserConfigurationException { + + DOMParser parser; + + // create the DOM parser + if (symbolTable != null) { + parser = new DOMParser(symbolTable, grammarPool); + } else { + parser = new DOMParser(); + } + + // set parser features and properties + parser.setFeature(NAMESPACES_FEATURE, true); + parser.setFeature(VALIDATION_FEATURE, validating); + parser.setFeature(SCHEMA_VALIDATION_FEATURE, validating); + parser.setFeature(NORMALIZED_VALUE_FEATURE, false); + parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); + parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); + + if (validating) { + if (externalSchemaLocations != null) { + parser.setProperty( + EXTERNAL_SCHEMA_LOCATION_PROPERTY, + externalSchemaLocations); + } + if (externalNoNamespaceSchemaLocation != null) { + parser.setProperty( + EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, + externalNoNamespaceSchemaLocation); + } + } + + // set entity resolver and error handler + if (entityResolver != null) { + parser.setEntityResolver(entityResolver); + } + if (errorHandler != null) { + parser.setErrorHandler(errorHandler); + } + + // parse the document and return it + parser.parse(new InputSource(inputStream)); + + return parser.getDocument(); + } + + /** + * Parse an XML document from an InputStream. + * + * It uses a MOAEntityResolver as the EntityResolver + * and a MOAErrorHandler as the ErrorHandler. + * + * @param inputStream The InputStream containing the XML + * document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocument( + InputStream inputStream, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws SAXException, IOException, ParserConfigurationException { + + return parseDocument( + inputStream, + validating, + externalSchemaLocations, + externalNoNamespaceSchemaLocation, + new MOAEntityResolver(), + new MOAErrorHandler()); + } + + /** + * Parse an XML document from a String. + * + * It uses a MOAEntityResolver as the EntityResolver + * and a MOAErrorHandler as the ErrorHandler. + * + * @param xmlString The String containing the XML document. + * @param encoding The encoding of the XML document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocument( + String xmlString, + String encoding, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws SAXException, IOException, ParserConfigurationException { + + InputStream in = new ByteArrayInputStream(xmlString.getBytes(encoding)); + return parseDocument( + in, + validating, + externalSchemaLocations, + externalNoNamespaceSchemaLocation); + } + + /** + * Parse an UTF-8 encoded XML document from a String. + * + * @param xmlString The String containing the XML document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocument( + String xmlString, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws SAXException, IOException, ParserConfigurationException { + + return parseDocument( + xmlString, + "UTF-8", + validating, + externalSchemaLocations, + externalNoNamespaceSchemaLocation); + } + + /** + * A convenience method to parse an XML document validating. + * + * @param inputStream The InputStream containing the XML + * document. + * @return The root element of the parsed XML document. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Element parseXmlValidating(InputStream inputStream) + throws ParserConfigurationException, SAXException, IOException { + return DOMUtils + .parseDocument(inputStream, true, Constants.ALL_SCHEMA_LOCATIONS, null) + .getDocumentElement(); + } + + /** + * Schema validate a given DOM element. + * + * @param element The element to validate. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return true, if the element validates against + * the schemas declared in it. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document from its + * serialized representation. + * @throws ParserConfigurationException An error occurred configuring the XML + * @throws TransformerException An error occurred serializing the element. + */ + public static boolean validateElement( + Element element, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws + ParserConfigurationException, + IOException, + SAXException, + TransformerException { + + byte[] docBytes; + SAXParser parser; + + // create the SAX parser + if (symbolTable != null) { + parser = new SAXParser(symbolTable, grammarPool); + } else { + parser = new SAXParser(); + } + + // serialize the document + docBytes = serializeNode(element, "UTF-8"); + + // set up parser features and attributes + parser.setFeature(NAMESPACES_FEATURE, true); + parser.setFeature(VALIDATION_FEATURE, true); + parser.setFeature(SCHEMA_VALIDATION_FEATURE, true); + if (externalSchemaLocations != null) { + parser.setProperty( + EXTERNAL_SCHEMA_LOCATION_PROPERTY, + externalSchemaLocations); + } + if (externalNoNamespaceSchemaLocation != null) { + parser.setProperty( + EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, + "externalNoNamespaceSchemaLocation"); + } + + // set up entity resolver and error handler + parser.setEntityResolver(new MOAEntityResolver()); + parser.setErrorHandler(new MOAErrorHandler()); + + // parse validating + parser.parse(new InputSource(new ByteArrayInputStream(docBytes))); + return true; + } + + /** + * Serialize the given DOM node. + * + * The node will be serialized using the UTF-8 encoding. + * + * @param node The node to serialize. + * @return String The String representation of the given DOM + * node. + * @throws TransformerException An error occurred transforming the + * node to a String. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static String serializeNode(Node node) + throws TransformerException, IOException { + return new String(serializeNode(node, "UTF-8"), "UTF-8"); + } + + /** + * Serialize the given DOM node to a byte array. + * + * @param node The node to serialize. + * @param xmlEncoding The XML encoding to use. + * @return The serialized node, as a byte array. Using a compatible encoding + * this can easily be converted into a String. + * @throws TransformerException An error occurred transforming the node to a + * byte array. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static byte[] serializeNode(Node node, String xmlEncoding) + throws TransformerException, IOException { + + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(16384); + + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.ENCODING, xmlEncoding); + transformer.transform(new DOMSource(node), new StreamResult(bos)); + + bos.flush(); + bos.close(); + + return bos.toByteArray(); + } + + /** + * Return the text that a node contains. + * + * This routine: + *
    + *
  • Ignores comments and processing instructions.
  • + *
  • Concatenates TEXT nodes, CDATA nodes, and the results recursively + * processing EntityRef nodes.
  • + *
  • Ignores any element nodes in the sublist. (Other possible options are + * to recurse into element sublists or throw an exception.)
  • + *
+ * + * @param node A DOM node from which to extract text. + * @return A String representing its contents. + */ + public static String getText(Node node) { + if (!node.hasChildNodes()) { + return ""; + } + + StringBuffer result = new StringBuffer(); + NodeList list = node.getChildNodes(); + + for (int i = 0; i < list.getLength(); i++) { + Node subnode = list.item(i); + if (subnode.getNodeType() == Node.TEXT_NODE) { + result.append(subnode.getNodeValue()); + } else if (subnode.getNodeType() == Node.CDATA_SECTION_NODE) { + result.append(subnode.getNodeValue()); + } else if (subnode.getNodeType() == Node.ENTITY_REFERENCE_NODE) { + // Recurse into the subtree for text + // (and ignore comments) + result.append(getText(subnode)); + } + } + return result.toString(); + } + + /** + * Build the namespace prefix to namespace URL mapping in effect for a given + * node. + * + * @param node The context node for which build the map. + * @return The namespace prefix to namespace URL mapping ( + * a String value to String value mapping). + */ + public static Map getNamespaceDeclarations(Node node) { + Map nsDecls = new HashMap(); + int i; + + do { + if (node.hasAttributes()) { + NamedNodeMap attrs = node.getAttributes(); + + for (i = 0; i < attrs.getLength(); i++) { + Attr attr = (Attr) attrs.item(i); + + // add prefix mapping if none exists + if ("xmlns".equals(attr.getPrefix()) + || "xmlns".equals(attr.getName())) { + + String nsPrefix = + attr.getPrefix() != null ? attr.getLocalName() : ""; + + if (nsDecls.get(nsPrefix) == null) { + nsDecls.put(nsPrefix, attr.getValue()); + } + } + } + } + } while ((node = node.getParentNode()) != null); + + return nsDecls; + } + + /** + * Add all namespace declarations declared in the parent(s) of a given + * element and used in the subtree of the given element to the given element. + * + * @param context The element to which to add the namespaces. + */ + public static void localizeNamespaceDeclarations(Element context) { + Node parent = context.getParentNode(); + + if (parent != null) { + Map namespaces = getNamespaceDeclarations(context.getParentNode()); + Set nsUris = collectNamespaceURIs(context); + Iterator iter; + + for (iter = namespaces.entrySet().iterator(); iter.hasNext();) { + Map.Entry e = (Map.Entry) iter.next(); + + if (nsUris.contains(e.getValue())) { + String prefix = (String) e.getKey(); + String nsUri = (String) e.getValue(); + String nsAttrName = "".equals(prefix) ? "xmlns" : "xmlns:" + prefix; + + context.setAttributeNS(Constants.XMLNS_NS_URI, nsAttrName, nsUri); + } + } + } + } + + /** + * Collect all the namespace URIs used in the subtree of a given element. + * + * @param context The element that should be searched for namespace URIs. + * @return All namespace URIs used in the subtree of context, + * including the ones used in context itself. + */ + public static Set collectNamespaceURIs(Element context) { + Set result = new HashSet(); + + collectNamespaceURIsImpl(context, result); + return result; + } + + /** + * A recursive method to do the work of collectNamespaceURIs. + * + * @param context The context element to evaluate. + * @param result The result, passed as a parameter to avoid unnecessary + * instantiations of Set. + */ + private static void collectNamespaceURIsImpl(Element context, Set result) { + NamedNodeMap attrs = context.getAttributes(); + NodeList childNodes = context.getChildNodes(); + String nsUri; + int i; + + // add the namespace of the context element + nsUri = context.getNamespaceURI(); + if (nsUri != null && nsUri != Constants.XMLNS_NS_URI) { + result.add(nsUri); + } + + // add all namespace URIs from attributes + for (i = 0; i < attrs.getLength(); i++) { + nsUri = attrs.item(i).getNamespaceURI(); + if (nsUri != null && nsUri != Constants.XMLNS_NS_URI) { + result.add(nsUri); + } + } + + // add all namespaces from subelements + for (i = 0; i < childNodes.getLength(); i++) { + Node node = childNodes.item(i); + + if (node.getNodeType() == Node.ELEMENT_NODE) { + collectNamespaceURIsImpl((Element) node, result); + } + } + } + + /** + * Check, that each attribute node in the given NodeList has its + * parent in the NodeList as well. + * + * @param nodes The NodeList to check. + * @return true, if each attribute node in nodes + * has its parent in nodes as well. + */ + public static boolean checkAttributeParentsInNodeList(NodeList nodes) { + Set nodeSet = new HashSet(); + int i; + + // put the nodes into the nodeSet + for (i = 0; i < nodes.getLength(); i++) { + nodeSet.add(nodes.item(i)); + } + + // check that each attribute node's parent is in the node list + for (i = 0; i < nodes.getLength(); i++) { + Node n = nodes.item(i); + + if (n.getNodeType() == Node.ATTRIBUTE_NODE) { + Attr attr = (Attr) n; + Element owner = attr.getOwnerElement(); + + if (owner == null) { + if (!isNamespaceDeclaration(attr)) { + return false; + } + } + + if (!nodeSet.contains(owner) && !isNamespaceDeclaration(attr)) { + return false; + } + } + } + + return true; + } + + /** + * Convert an unstructured NodeList into a + * DocumentFragment. + * + * @param nodeList Contains the node list to be converted into a DOM + * DocumentFragment. + * @return the resulting DocumentFragment. The DocumentFragment will be + * backed by a new DOM Document, i.e. all noded of the node list will be + * cloned. + * @throws ParserConfigurationException An error occurred creating the + * DocumentFragment. + * @precondition The nodes in the node list appear in document order. + * @precondition For each Attr node in the node list, the owning Element is + * in the node list as well. + * @precondition Each Element or Attr node in the node list is namespace + * aware. + */ + public static DocumentFragment nodeList2DocumentFragment(NodeList nodeList) + throws ParserConfigurationException { + + DocumentBuilder builder = + DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = builder.newDocument(); + DocumentFragment result = doc.createDocumentFragment(); + + if (null == nodeList || nodeList.getLength() == 0) { + return result; + } + + int currPos = 0; + currPos = + nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; + + while (currPos < nodeList.getLength()) { + currPos = + nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; + } + return result; + } + + /** + * Helper method for the nodeList2DocumentFragment. + * + * @param nodeList The NodeList to convert. + * @param currPos The current position in the nodeList. + * @param result The resulting DocumentFragment. + * @param currOrgElem The current original element. + * @param currClonedElem The current cloned element. + * @return The current position. + */ + private static int nodeList2DocumentFragment( + NodeList nodeList, + int currPos, + DocumentFragment result, + Element currOrgElem, + Element currClonedElem) { + + while (currPos < nodeList.getLength()) { + Node currentNode = nodeList.item(currPos); + switch (currentNode.getNodeType()) { + case Node.COMMENT_NODE : + case Node.PROCESSING_INSTRUCTION_NODE : + case Node.TEXT_NODE : + { + // Append current node either to resulting DocumentFragment or to + // current cloned Element + if (null == currClonedElem) { + result.appendChild( + result.getOwnerDocument().importNode(currentNode, false)); + } else { + // Stop processing if current Node is not a descendant of + // current Element + if (!isAncestor(currOrgElem, currentNode)) { + return --currPos; + } + + currClonedElem.appendChild( + result.getOwnerDocument().importNode(currentNode, false)); + } + break; + } + + case Node.ELEMENT_NODE : + { + Element nextCurrOrgElem = (Element) currentNode; + Element nextCurrClonedElem = + result.getOwnerDocument().createElementNS( + nextCurrOrgElem.getNamespaceURI(), + nextCurrOrgElem.getNodeName()); + + // Append current Node either to resulting DocumentFragment or to + // current cloned Element + if (null == currClonedElem) { + result.appendChild(nextCurrClonedElem); + currOrgElem = nextCurrOrgElem; + currClonedElem = nextCurrClonedElem; + } else { + // Stop processing if current Node is not a descendant of + // current Element + if (!isAncestor(currOrgElem, currentNode)) { + return --currPos; + } + + currClonedElem.appendChild(nextCurrClonedElem); + } + + // Process current Node (of type Element) recursively + currPos = + nodeList2DocumentFragment( + nodeList, + ++currPos, + result, + nextCurrOrgElem, + nextCurrClonedElem); + + break; + } + + case Node.ATTRIBUTE_NODE : + { + Attr currAttr = (Attr) currentNode; + + // GK 20030411: Hack to overcome problems with IAIK IXSIL + if (currAttr.getOwnerElement() == null) + break; + if (currClonedElem == null) + break; + + // currClonedElem must be the owner Element of currAttr if + // preconditions are met + currClonedElem.setAttributeNS( + currAttr.getNamespaceURI(), + currAttr.getNodeName(), + currAttr.getValue()); + break; + } + + default : + { + // All other nodes will be ignored + } + } + + currPos++; + } + + return currPos; + } + + /** + * Check, if the given attribute is a namespace declaration. + * + * @param attr The attribute to check. + * @return true, if the attribute is a namespace declaration, + * false otherwise. + */ + private static boolean isNamespaceDeclaration(Attr attr) { + return Constants.XMLNS_NS_URI.equals(attr.getNamespaceURI()); + } + + /** + * Check, if a given DOM element is an ancestor of a given node. + * + * @param candAnc The DOM element to check for being the ancestor. + * @param cand The node to check for being the child. + * @return true, if candAnc is an (indirect) + * ancestor of cand; false otherwise. + */ + public static boolean isAncestor(Element candAnc, Node cand) { + Node currPar = cand.getParentNode(); + + while (currPar != null) { + if (candAnc == currPar) + return true; + currPar = currPar.getParentNode(); + } + return false; + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/DateTimeUtils.java b/common/src/at/gv/egovernment/moa/util/DateTimeUtils.java new file mode 100644 index 000000000..58cc04c4c --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/DateTimeUtils.java @@ -0,0 +1,326 @@ +package at.gv.egovernment.moa.util; + +import java.io.StringWriter; +import java.text.ParseException; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +/** + * Utility for parsing and building XML type dateTime, + * according to ISO 8601. + * + * @author Patrick Peck + * @version $Id$ + * @see http://www.w3.org/2001/XMLSchema-datatypes" + */ +public class DateTimeUtils { + /** Error messages. */ + private static MessageProvider msg = MessageProvider.getInstance(); + + /** + * Builds a dateTime value from a Calendar value. + * @param cal the Calendar value + * @return the dateTime value + */ + public static String buildDateTime(Calendar cal) { + StringWriter out = new StringWriter(); + out.write("" + cal.get(Calendar.YEAR)); + out.write("-"); + out.write(to2DigitString(cal.get(Calendar.MONTH) + 1)); + out.write("-"); + out.write(to2DigitString(cal.get(Calendar.DAY_OF_MONTH))); + out.write("T"); + out.write(to2DigitString(cal.get(Calendar.HOUR_OF_DAY))); + out.write(":"); + out.write(to2DigitString(cal.get(Calendar.MINUTE))); + out.write(":"); + out.write(to2DigitString(cal.get(Calendar.SECOND))); + int tzOffsetMilliseconds = + cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); + if (tzOffsetMilliseconds != 0) { + int tzOffsetMinutes = tzOffsetMilliseconds / (1000 * 60); + int tzOffsetHours = tzOffsetMinutes / 60; + tzOffsetMinutes -= tzOffsetHours * 60; + if (tzOffsetMilliseconds > 0) { + out.write("+"); + out.write(to2DigitString(tzOffsetHours)); + out.write(":"); + out.write(to2DigitString(tzOffsetMinutes)); + } else { + out.write("-"); + out.write(to2DigitString(-tzOffsetHours)); + out.write(":"); + out.write(to2DigitString(-tzOffsetMinutes)); + } + } + return out.toString(); + } + + /** + * Converts month, day, hour, minute, or second value + * to a 2 digit String. + * @param number the month, day, hour, minute, or second value + * @return 2 digit String + */ + private static String to2DigitString(int number) { + if (number < 10) + return "0" + number; + else + return "" + number; + } + + /** + * Parse a String containing a date and time instant, given in + * ISO 8601 format. + * + * @param dateTime The String to parse. + * @return The Date representation of the contents of + * dateTime. + * @throws ParseException Parsing the dateTime failed. + */ + public static Date parseDateTime(String dateTime) throws ParseException { + GregorianCalendar calendar; + long time; + int yearSign = 1, year, month, day; + int hour, minute, second; + double fraction = 0.0; + int tzSign = 1, tzHour = 0, tzMinute = 0; + int curPos = 0; + String fractStr; + boolean localTime = false; + char c; + + // parse year sign + ensureChars(dateTime, curPos, 1); + c = dateTime.charAt(curPos); + if (c == '+' || c == '-') { + yearSign = c == '+' ? 1 : -1; + curPos++; + } + + // parse year + year = parseInt(dateTime, curPos, 4); + curPos += 4; + + // parse '-' + ensureChar(dateTime, curPos, '-'); + curPos++; + + // parse month + month = parseInt(dateTime, curPos, 2); + ensureValue(month, 1, 12, curPos); + curPos += 2; + + // parse '-' + ensureChar(dateTime, curPos, '-'); + curPos++; + + // parse day + day = parseInt(dateTime, curPos, 2); + ensureValue(day, 1, 31, curPos); + curPos += 2; + + // parse 'T' + ensureChar(dateTime, curPos, 'T'); + curPos++; + + // parse hour + hour = parseInt(dateTime, curPos, 2); + ensureValue(hour, 0, 23, curPos); + curPos += 2; + + // parse ':' + ensureChar(dateTime, curPos, ':'); + curPos++; + + // parse minute + minute = parseInt(dateTime, curPos, 2); + ensureValue(minute, 0, 59, curPos); + curPos += 2; + + // parse ':' + ensureChar(dateTime, curPos, ':'); + curPos++; + + // parse second + second = parseInt(dateTime, curPos, 2); + ensureValue(second, 0, 59, curPos); + curPos += 2; + + // parse a fraction + if (dateTime.length() > curPos && dateTime.charAt(curPos) == '.') { + curPos++; + ensureDigits(dateTime, curPos, 1); + fractStr = "0."; + fractStr + += dateTime.substring(curPos, curPos + countDigits(dateTime, curPos)); + fraction = Double.parseDouble(fractStr); + curPos += countDigits(dateTime, curPos); + } + + // parse a time zone + if (dateTime.length() > curPos) { + c = dateTime.charAt(curPos); + if (c == 'Z') { + curPos++; + } else if (c == '+' || c == '-') { + // parse time zone sign + tzSign = c == '+' ? 1 : -1; + curPos++; + + // parse time zone hour + tzHour = parseInt(dateTime, curPos, 2); + ensureValue(tzHour, 0, 14, curPos); + curPos += 2; + + // parse ':' + ensureChar(dateTime, curPos, ':'); + curPos++; + + // parse time zone minute + tzMinute = parseInt(dateTime, curPos, 2); + ensureValue(tzMinute, 0, 59, curPos); + curPos += 2; + } + } else { + localTime = true; + } + + // if we have characters left, it's an error + if (dateTime.length() != curPos) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + + // build the Date object + year = year * yearSign; + try { + calendar = new GregorianCalendar(TimeZone.getTimeZone("GMT")); + calendar.set(year, month - 1, day, hour, minute, second); + calendar.set(Calendar.MILLISECOND, 0); + time = calendar.getTime().getTime(); + time += (long) (fraction * 1000.0); + time -= tzSign * ((tzHour * 60) + tzMinute) * 60 * 1000; + if (localTime) { + time -= TimeZone.getDefault().getRawOffset(); + } + return new Date(time); + } catch (IllegalArgumentException e) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + + } + + /** + * Parse an integer value. + * + * @param str The String containing the digits. + * @param curPos The starting position. + * @param digits The number of digist making up the integer value. + * @return int The integer representation of the digits contained in + * str. + * @throws ParseException Parsing the integer value failed. + */ + private static int parseInt(String str, int curPos, int digits) + throws ParseException { + + ensureDigits(str, curPos, digits); + return Integer.parseInt(str.substring(curPos, curPos + digits)); + } + + /** + * Count the number of digits following curPos. + * + * @param str The String in which to count digits. + * @param curPos The starting position. + * @return int The number of digits. + */ + private static int countDigits(String str, int curPos) { + int i; + + for (i = curPos; i < str.length() && Character.isDigit(str.charAt(i)); i++); + return i - curPos; + } + + /** + * Ensure that a value falls in a given min/max range. + * + * @param value The value to check. + * @param min The minimum allowed value. + * @param max The maximum allowed value. + * @param curPos To indicate the parsing position in the + * ParseException. + * @throws ParseException Thrown, if value < min || value > + * max + */ + private static void ensureValue(int value, int min, int max, int curPos) + throws ParseException { + + if (value < min || value > max) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + } + + /** + * Ensure that the given String has a number of characters left. + * + * @param str The String to check for its length. + * @param curPos The starting position. + * @param count The minimum number of characters that str must + * contain, starting at from curPos. + * @throws ParseException Thrown, if + * curPos + count > str.length(). + */ + private static void ensureChars(String str, int curPos, int count) + throws ParseException { + if (curPos + count > str.length()) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + } + + /** + * Ensure that a given String contains a certain character at a + * certain position. + * + * @param str The String in which to look up the character. + * @param curPos The position in str that must contain the + * character. + * @param c The character value that must be contained at position + * curPos. + * @throws ParseException Thrown, if the characters do not match or + * curPos is out of range. + */ + private static void ensureChar(String str, int curPos, char c) + throws ParseException { + + ensureChars(str, curPos, 1); + if (str.charAt(curPos) != c) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + } + + /** + * Ensure that a given String contains a number of digits, + * starting at a given position. + * + * @param str The String to scan for digits. + * @param curPos The starting postion. + * @param count The number of digits that must be contained in + * str, starting at curPos. + * @throws ParseException Thrown, if str is not long enough, or + * one of the characters following curPos in str is + * not a digit. + */ + private static void ensureDigits(String str, int curPos, int count) + throws ParseException { + + ensureChars(str, curPos, count); + for (int i = curPos; i < curPos + count; i++) { + if (!Character.isDigit(str.charAt(i))) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + } + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/EntityResolverChain.java b/common/src/at/gv/egovernment/moa/util/EntityResolverChain.java new file mode 100644 index 000000000..e7008a701 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/EntityResolverChain.java @@ -0,0 +1,52 @@ +package at.gv.egovernment.moa.util; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * Implementation of the org.xml.sax.EntityResolver, + * for use by a org.apache.xerces.parsers.DOMParser. + * + * @author Patrick Peck + * @version $Id$ + */ +public class EntityResolverChain implements EntityResolver { + /** The EntityResolvers in the chain. */ + private List resolvers = new ArrayList(); + + /** + * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) + */ + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException, IOException { + + Iterator iter; + + for (iter = resolvers.iterator(); iter.hasNext(); ) { + EntityResolver resolver = (EntityResolver) iter.next(); + InputSource is = resolver.resolveEntity(publicId, systemId); + + if (is != null) { + return is; + } + } + + return null; + } + + /** + * Add an EntityResolver to the chain. + * + * @param entityResolver The EntityResolver to add. + */ + public void addEntityResolver(EntityResolver entityResolver) { + resolvers.add(entityResolver); + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/FileUtils.java b/common/src/at/gv/egovernment/moa/util/FileUtils.java new file mode 100644 index 000000000..f8941568d --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/FileUtils.java @@ -0,0 +1,87 @@ +package at.gv.egovernment.moa.util; + +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +/** + * Utility for accessing files on the file system, and for reading from input streams. + * @author Paul Ivancsics + * @version $Id$ + */ +public class FileUtils { + + /** + * Reads a file, given by URL, into a byte array. + * @param urlString file URL + * @return file content + * @throws IOException on any exception thrown + */ + public static byte[] readURL(String urlString) throws IOException { + URL url = new URL(urlString); + InputStream in = new BufferedInputStream(url.openStream()); + byte[] content = StreamUtils.readStream(in); + in.close(); + return content; + } + /** + * Reads a file, given by URL, into a String. + * @param urlString file URL + * @param encoding character encoding + * @return file content + * @throws IOException on any exception thrown + */ + public static String readURL(String urlString, String encoding) throws IOException { + byte[] content = readURL(urlString); + return new String(content, encoding); + } + /** + * Reads a file, given by filename, into a byte array. + * @param filename filename + * @return file content + * @throws IOException on any exception thrown + */ + public static byte[] readFile(String filename) throws IOException { + BufferedInputStream in = new BufferedInputStream(new FileInputStream(filename)); + byte[] content = StreamUtils.readStream(in); + in.close(); + return content; + } + /** + * Reads a file, given by filename, into a String. + * @param filename filename + * @param encoding character encoding + * @return file content + * @throws IOException on any exception thrown + */ + public static String readFile(String filename, String encoding) throws IOException { + byte[] content = readFile(filename); + return new String(content, encoding); + } + /** + * Reads a file from a resource. + * @param name resource name + * @return file content as a byte array + * @throws IOException on any exception thrown + */ + public static byte[] readResource(String name) throws IOException { + ClassLoader cl = FileUtils.class.getClassLoader(); + BufferedInputStream in = new BufferedInputStream(cl.getResourceAsStream(name)); + byte[] content = StreamUtils.readStream(in); + in.close(); + return content; + } + /** + * Reads a file from a resource. + * @param name filename + * @param encoding character encoding + * @return file content + * @throws IOException on any exception thrown + */ + public static String readResource(String name, String encoding) throws IOException { + byte[] content = readResource(name); + return new String(content, encoding); + } +} diff --git a/common/src/at/gv/egovernment/moa/util/KeyStoreUtils.java b/common/src/at/gv/egovernment/moa/util/KeyStoreUtils.java new file mode 100644 index 000000000..d6a34a7b2 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/KeyStoreUtils.java @@ -0,0 +1,134 @@ +package at.gv.egovernment.moa.util; + +import iaik.x509.X509Certificate; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.cert.Certificate; + +/** + * Utility for creating and loading key stores. + * + * @author Paul Ivancsics + * @version $Id$ + */ +public class KeyStoreUtils { + + /** + * Loads a key store from file. + * + * @param keystoreType key store type + * @param urlString URL of key store + * @param password password protecting the key store + * @return key store loaded + * @throws IOException thrown while reading the key store from file + * @throws GeneralSecurityException thrown while creating the key store + */ + public static KeyStore loadKeyStore( + String keystoreType, + String urlString, + String password) + throws IOException, GeneralSecurityException { + + URL keystoreURL = new URL(urlString); + InputStream in = keystoreURL.openStream(); + return loadKeyStore(keystoreType, in, password); + } + /** + * Loads a key store from an InputStream, and + * closes the InputStream. + * + * @param keystoreType key store type + * @param in input stream + * @param password password protecting the key store + * @return key store loaded + * @throws IOException thrown while reading the key store from the stream + * @throws GeneralSecurityException thrown while creating the key store + */ + public static KeyStore loadKeyStore( + String keystoreType, + InputStream in, + String password) + throws IOException, GeneralSecurityException { + + char[] chPassword = null; + if (password != null) + chPassword = password.toCharArray(); + KeyStore ks = KeyStore.getInstance(keystoreType); + ks.load(in, chPassword); + in.close(); + return ks; + } + /** + * Creates a key store from X509 certificate files, aliasing them with + * the index in the String[], starting with "0". + * + * @param keyStoreType key store type + * @param certFilenames certificate filenames + * @return key store created + * @throws IOException thrown while reading the certificates from file + * @throws GeneralSecurityException thrown while creating the key store + */ + public static KeyStore createKeyStore( + String keyStoreType, + String[] certFilenames) + throws IOException, GeneralSecurityException { + + KeyStore ks = KeyStore.getInstance(keyStoreType); + ks.load(null, null); + for (int i = 0; i < certFilenames.length; i++) { + Certificate cert = loadCertificate(certFilenames[i]); + ks.setCertificateEntry("" + i, cert); + } + return ks; + } + /** + * Creates a key store from a directory containg X509 certificate files, + * aliasing them with the index in the String[], starting with "0". + * All the files in the directory are considered to be certificates. + * + * @param keyStoreType key store type + * @param certDirURLString file URL of directory containing certificate filenames + * @return key store created + * @throws IOException thrown while reading the certificates from file + * @throws GeneralSecurityException thrown while creating the key store + */ + public static KeyStore createKeyStoreFromCertificateDirectory( + String keyStoreType, + String certDirURLString) + throws IOException, GeneralSecurityException { + + URL certDirURL = new URL(certDirURLString); + String certDirname = certDirURL.getFile(); + File certDir = new File(certDirname); + String[] certFilenames = certDir.list(); + String separator = + (certDirname.endsWith(File.separator) ? "" : File.separator); + for (int i = 0; i < certFilenames.length; i++) { + certFilenames[i] = certDirname + separator + certFilenames[i]; + } + return createKeyStore(keyStoreType, certFilenames); + } + + /** + * Loads an X509 certificate from file. + * @param certFilename filename + * @return the certificate loaded + * @throws IOException thrown while reading the certificate from file + * @throws GeneralSecurityException thrown while creating the certificate + */ + private static Certificate loadCertificate(String certFilename) + throws IOException, GeneralSecurityException { + + FileInputStream in = new FileInputStream(certFilename); + Certificate cert = new X509Certificate(in); + in.close(); + return cert; + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/MOADefaultHandler.java b/common/src/at/gv/egovernment/moa/util/MOADefaultHandler.java new file mode 100644 index 000000000..0474d92cd --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/MOADefaultHandler.java @@ -0,0 +1,82 @@ +package at.gv.egovernment.moa.util; + +import java.io.IOException; + +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.helpers.DefaultHandler; + +/** + * A DefaultHandler that uses a MOAEntityResolver and + * a MOAErrorHandler. + * + * @author Patrick Peck + * @version $Id$ + */ +public class MOADefaultHandler extends DefaultHandler { + /** The EntityResolver to use. */ + private EntityResolver entityResolver; + /** The ErrorHandler to use. */ + private ErrorHandler errorHandler; + + /** + * Create a new MOADefaultHandler. + */ + public MOADefaultHandler() { + entityResolver = new MOAEntityResolver(); + errorHandler = new MOAErrorHandler(); + } + + /** + * Create a new MOADefaultHandler. + * + * @param entityResolver The EntityResolver to use for resolving + * external entities. + * @param errorHandler The ErrorHandler to use for reporting + * parsing errors. + */ + public MOADefaultHandler( + EntityResolver entityResolver, + ErrorHandler errorHandler) { + + this.entityResolver = entityResolver; + this.errorHandler = errorHandler; + } + + /** + * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) + */ + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException { + try { + return entityResolver.resolveEntity(publicId, systemId); + } catch (IOException e) { + return null; + } + } + + /** + * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException) + */ + public void warning(SAXParseException exception) throws SAXException { + errorHandler.warning(exception); + } + + /** + * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) + */ + public void error(SAXParseException exception) throws SAXException { + errorHandler.error(exception); + } + + /** + * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException) + */ + public void fatalError(SAXParseException exception) throws SAXException { + errorHandler.fatalError(exception); + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/MOAEntityResolver.java b/common/src/at/gv/egovernment/moa/util/MOAEntityResolver.java new file mode 100644 index 000000000..9406612e2 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/MOAEntityResolver.java @@ -0,0 +1,103 @@ +package at.gv.egovernment.moa.util; + +import java.io.InputStream; + +import org.apache.xerces.util.URI; +import org.apache.xerces.util.URI.MalformedURIException; +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; + +/** + * An EntityResolver that looks up entities stored as + * local resources. + * + *

The following DTDs are mapped to local resources: + *

    + *
  • The XMLSchema.dtd
  • + *
  • The datatypes.dtd
  • + *
+ *

+ *

For all other resources, an attempt is made to resolve them as resources, + * either absolute or relative to Constants.SCHEMA_ROOT. + * + * @author Patrick Peck + * @author Sven Aigner + */ +public class MOAEntityResolver implements EntityResolver { + + /** + * Resolve an entity. + * + * The systemId parameter is used to perform the lookup of the + * entity as a resource, either by interpreting the systemId as + * an absolute resource path, or by appending the last path component of + * systemId to Constants.SCHEMA_ROOT. + * + * @param publicId The public ID of the resource. + * @param systemId The system ID of the resource. + * @return An InputSource from which the entity can be read, or + * null, if the entity could not be found. + * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) + */ + public InputSource resolveEntity(String publicId, String systemId) { + InputStream stream; + int slashPos; + + if (Logger.isDebugEnabled()) { + Logger.debug( + new LogMsg("resolveEntity: p=" + publicId + " s=" + systemId)); + } + + if (publicId != null) { + // check if we can resolve some standard dtd's + if (publicId.equalsIgnoreCase("-//W3C//DTD XMLSchema 200102//EN")) { + return new InputSource( + getClass().getResourceAsStream( + Constants.SCHEMA_ROOT + "XMLSchema.dtd")); + } else if (publicId.equalsIgnoreCase("datatypes")) { + return new InputSource( + getClass().getResourceAsStream( + Constants.SCHEMA_ROOT + "datatypes.dtd")); + } + } else if (systemId != null) { + // get the URI path + try { + URI uri = new URI(systemId); + systemId = uri.getPath(); + if (!"file".equals(uri.getScheme()) || "".equals(systemId.trim())) { + return null; + } + } catch (MalformedURIException e) { + return null; + } + + // try to get the resource from the full path + stream = getClass().getResourceAsStream(systemId); + if (stream != null) { + InputSource source = new InputSource(stream); + + source.setSystemId(systemId); + return source; + } + + // try to get the resource from the last path component + slashPos = systemId.lastIndexOf('/'); + if (slashPos >= 0 && systemId.length() > slashPos) { + systemId = systemId.substring(slashPos + 1, systemId.length()); + stream = + getClass().getResourceAsStream(Constants.SCHEMA_ROOT + systemId); + if (stream != null) { + InputSource source = new InputSource(stream); + + source.setSystemId(systemId); + return source; + } + } + } + + return null; // nothing found - let the parser handle the entity + } +} \ No newline at end of file diff --git a/common/src/at/gv/egovernment/moa/util/MOAErrorHandler.java b/common/src/at/gv/egovernment/moa/util/MOAErrorHandler.java new file mode 100644 index 000000000..1f7757c8f --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/MOAErrorHandler.java @@ -0,0 +1,85 @@ +package at.gv.egovernment.moa.util; + +import org.apache.xml.utils.DefaultErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; + +/** + * An ErrorHandler that logs a message and throws a + * SAXException upon error and fatal + * parsing errors. + * + * @author Patrick Peck + * @author Sven Aigner + */ +public class MOAErrorHandler extends DefaultErrorHandler { + + /** + * Logs a warning message. + * + * @see org.xml.sax.ErrorHandler#warning(SAXParseException) + */ + public void warning(SAXParseException exception) throws SAXException { + warn("parser.00", messageParams(exception), null); + } + + /** + * Logs a warning and rethrows the exception. + * + * @see org.xml.sax.ErrorHandler#error(SAXParseException) + */ + public void error(SAXParseException exception) throws SAXException { + warn("parser.01", messageParams(exception), null); + throw exception; + } + + /** + * Logs a warning and rethrows the exception. + * + * @see org.xml.sax.ErrorHandler#fatalError(SAXParseException) + */ + public void fatalError(SAXParseException exception) throws SAXException { + warn("parser.02", messageParams(exception), null); + throw exception; + } + + /** + * Log a warning message. + * + * @param messageId The message ID to log. + * @param parameters Additional message parameters. + * @param t The Throwable to log; usually the cause of this + * warning. + */ + private static void warn( + String messageId, + Object[] parameters, + Throwable t) { + + MessageProvider msg = MessageProvider.getInstance(); + Logger.warn(new LogMsg(msg.getMessage(messageId, parameters)), t); + } + + /** + * Put the system id, line and column number information from the exception + * into an Object array, to provide it as a + * MessageFormat parameter. + * + * @param e The SAXParseException containing the + * source system id and line/column numbers. + * @return An array containing the system id (a String) as well + * as line/column numbers (2 Integer objects) from the + * SAXParseException. + */ + private static Object[] messageParams(SAXParseException e) { + return new Object[] { + e.getMessage(), + e.getSystemId(), + new Integer(e.getLineNumber()), + new Integer(e.getColumnNumber())}; + } + +} \ No newline at end of file diff --git a/common/src/at/gv/egovernment/moa/util/MOATimer.java b/common/src/at/gv/egovernment/moa/util/MOATimer.java new file mode 100644 index 000000000..d8bf64fc3 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/MOATimer.java @@ -0,0 +1,110 @@ +package at.gv.egovernment.moa.util; + +import java.util.Map; +import java.util.WeakHashMap; + +/** + * A timer utility for named timers. + * + * @author Sven Aigner + */ +public class MOATimer { + + /** The single instance of this class. */ + private static MOATimer instance = null; + /** The starting points of single timings. */ + private static Map timemapstart = new WeakHashMap(); + /** The end points of single timings. */ + private static Map timemapend = new WeakHashMap(); + + /** + * Return the single instance of this class. + * + * @return The single instance of this class. + */ + public static MOATimer getInstance() { + if (instance == null) { + instance = new MOATimer(); + } + return instance; + } + + /** + * Create a new MOATimer. + * + * Protected to disallow multiple instances. + */ + protected MOATimer() { + super(); + } + + /** + * Start timing a certain action. + * + * The timing belonging to the action ID is garbage collected as soon as there + * exists no other reference to the action ID. + * + * @param id The action ID. + */ + public void startTiming(Object id) { + timemapstart.put(id, new Long(System.currentTimeMillis())); + } + + /** + * Stop timing an action. + * + * @param id The action ID. + */ + public void stopTiming(Object id) { + timemapend.put(id, new Long(System.currentTimeMillis())); + } + + /** + * Get the duration of an action. + * + * @param id The action ID for which to compute the duration. + * @return long The duration in milliseconds between calls to + * startTiming() and stopTiming(). If + * only startTiming() has been called for the action, then + * current difference to the system time is returned. If no timing exists for + * the action, - 1 is returned. + */ + public long duration(Object id) { + if (timemapstart.containsKey(id)) { + long start = ((Long) timemapstart.get(id)).longValue(); + if (timemapend.containsKey(id)) { + long end = ((Long) timemapend.get(id)).longValue(); + return end - start; + } else { + return System.currentTimeMillis() - start; + } + } else + return -1; + } + + /** + * Get the duration of an action, as a nicely formatted String. + * + * @param id The action ID. + * @return String The duration() as a String. + */ + public String durationAsString(Object id) { + long dur = duration(id); + long second = dur / 1000; + long mil = (dur) - (second * 1000); + return "Duration: " + second + "." + mil + " seconds"; + } + + /** + * Remove a timing. + * + * @param id The action ID. + */ + public void clearTiming(String id) { + if (timemapstart.containsKey(id)) + timemapstart.remove(id); + if (timemapend.containsKey(id)) + timemapend.remove(id); + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/MessageProvider.java b/common/src/at/gv/egovernment/moa/util/MessageProvider.java new file mode 100644 index 000000000..f5117e390 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/MessageProvider.java @@ -0,0 +1,63 @@ +package at.gv.egovernment.moa.util; + +import java.util.Locale; + +/** + * A singleton wrapper around a Message object. + * + * Provides the messages used in the common project. + * + * @author Patrick Peck + * @version $Id$ + */ +public class MessageProvider { + /** The location of the default message resources. */ + private static final String[] DEFAULT_MESSAGE_RESOURCES = + { "resources/properties/common_messages" }; + /** The locale of the default message resources. */ + private static final Locale[] DEFAULT_MESSAGE_LOCALES = + new Locale[] { new Locale("de", "AT") }; + /** The single instance of this class. */ + private static MessageProvider instance; + + /** The messages provided by this MessageProvider. */ + private Messages messages; + + /** + * Return the single instance of the MessageProvider. + * + * Intialilizes the MessageProvider with the default message + * locations: /resources/properties/common_messages. + * + * @return The single MessageProvider. + */ + public static synchronized MessageProvider getInstance() { + if (instance == null) { + instance = + new MessageProvider(DEFAULT_MESSAGE_RESOURCES, DEFAULT_MESSAGE_LOCALES); + } + return instance; + } + + /** + * Create a MessageProvider. + * + * @param resourceNames The names of the resources containing the messages. + * @param locales The corresponding locales. + */ + protected MessageProvider(String[] resourceNames, Locale[] locales) { + this.messages = new Messages(resourceNames, locales); + } + + /** + * Get the message corresponding to a given message ID. + * + * @param messageId The ID of the message. + * @param parameters The parameters to fill in into the message arguments. + * @return The formatted message. + */ + public String getMessage(String messageId, Object[] parameters) { + return messages.getMessage(messageId, parameters); + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/Messages.java b/common/src/at/gv/egovernment/moa/util/Messages.java new file mode 100644 index 000000000..a0139ae93 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/Messages.java @@ -0,0 +1,117 @@ +package at.gv.egovernment.moa.util; + +import java.text.MessageFormat; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.PropertyResourceBundle; + +import at.gv.egovernment.moa.logging.Logger; + +/** + * Provides access to the system messages resource used for exception handling + * and logging messages. + * + * Messages must be provided as a resource bundle at the path. + * + * @author Patrick Peck + * @version $Id$ + */ +public class Messages { + /** Error message indicating that no messages are avaiable. */ + private static final String ERROR_MESSAGES_UNAVAILABLE = + "Fehler in der Server-Konfiguration. " + + "Die Fehlertexte konnten nicht geladen werden."; + /** Error message indicating that the message is not available. */ + private static final String ERROR_NO_MESSAGE = + "Keine Fehlermeldung für Fehler-Nr.={0}"; + + /** The names of the resources containing the messages. */ + private String[] resourceNames; + /** The corresponding Locales of the resources. */ + private Locale[] locales; + /** The ResourceBundles containing the messages. */ + private ResourceBundleChain messages; + + /** + * Create a new Message object containing the messages + * in the given resources. + * + * @param resourceNames The names of the resources containing the messages. + * @param locales The corresponding locales. + */ + public Messages(String[] resourceNames, Locale[] locales) { + this.resourceNames = resourceNames; + this.locales = locales; + this.messages = null; + } + + /** + * Get the message corresponding to a given message ID. + * + * @param messageId The ID of the message. + * @param parameters The parameters to fill in into the message arguments. + * @return The formatted message. + */ + public String getMessage(String messageId, Object[] parameters) { + // initialize messages + if (messages == null) { + initMessages(); + } + + // create the message + if (messages == null) { + return ERROR_MESSAGES_UNAVAILABLE; + } else { + try { + String rawMessage = messages.getString(messageId); + return MessageFormat.format(rawMessage, parameters); + } catch (MissingResourceException e2) { + // couldn't find any message -> set to default error message + return MessageFormat.format( + ERROR_NO_MESSAGE, + new Object[] { messageId }); + } + } + } + + /** + * Return the names of the resources containing the messages. + * + * @return String[] The names of the resource bundles containing the messages. + */ + private String[] getResourceNames() { + return resourceNames; + } + + /** + * Return the Locales of the resources containing the messages. + * + * @return Locale[] The Locales of the resource bundles + * containing the messages. + */ + private Locale[] getLocales() { + return locales; + } + + /** + * Initialize the messages ResourceBundle containing + * the MOA error messages. + */ + private void initMessages() { + messages = new ResourceBundleChain(); + int i; + + // initialize the message resources + for (i = 0; i < resourceNames.length; i++) { + try { + messages.addResourceBundle( + PropertyResourceBundle.getBundle( + getResourceNames()[i], + getLocales()[i])); + } catch (MissingResourceException e) { + Logger.error(ERROR_MESSAGES_UNAVAILABLE, e); + } + } + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/NodeIteratorAdapter.java b/common/src/at/gv/egovernment/moa/util/NodeIteratorAdapter.java new file mode 100644 index 000000000..f71aa472d --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/NodeIteratorAdapter.java @@ -0,0 +1,87 @@ +package at.gv.egovernment.moa.util; + +import java.util.ListIterator; + +import org.w3c.dom.DOMException; +import org.w3c.dom.Node; +import org.w3c.dom.traversal.NodeFilter; +import org.w3c.dom.traversal.NodeIterator; + +/** + * A NodeIterator implementation based on a + * ListIterator. + * + * @see java.util.ListIterator + * @see org.w3c.dom.traversal.NodeIterator + * + * @author Patrick Peck + * @version $Id$ + */ +public class NodeIteratorAdapter implements NodeIterator { + + /** The ListIterator to wrap. */ + private ListIterator nodeIterator; + + /** + * Create a new NodeIteratorAdapter. + * @param nodeIterator The ListIterator to iterate over. + */ + public NodeIteratorAdapter(ListIterator nodeIterator) { + this.nodeIterator = nodeIterator; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#getRoot() + */ + public Node getRoot() { + return null; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#getWhatToShow() + */ + public int getWhatToShow() { + return NodeFilter.SHOW_ALL; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#getFilter() + */ + public NodeFilter getFilter() { + return null; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#getExpandEntityReferences() + */ + public boolean getExpandEntityReferences() { + return false; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#nextNode() + */ + public Node nextNode() throws DOMException { + if (nodeIterator.hasNext()) { + return (Node) nodeIterator.next(); + } + return null; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#previousNode() + */ + public Node previousNode() throws DOMException { + if (nodeIterator.hasPrevious()) { + return (Node) nodeIterator.previous(); + } + return null; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#detach() + */ + public void detach() { + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/NodeListAdapter.java b/common/src/at/gv/egovernment/moa/util/NodeListAdapter.java new file mode 100644 index 000000000..7102cadca --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/NodeListAdapter.java @@ -0,0 +1,44 @@ +package at.gv.egovernment.moa.util; + +import java.util.List; + +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * A NodeList implementation based on a List. + * + * @see java.util.List + * @see org.w3c.dom.NodeList + * + * @author Patrick Peck + * @version $Id$ + */ +public class NodeListAdapter implements NodeList { + /** The List to wrap. */ + private List nodeList; + + /** + * Create a new NodeListAdapter. + * + * @param nodeList The List containing the nodes. + */ + public NodeListAdapter(List nodeList) { + this.nodeList = nodeList; + } + + /** + * @see org.w3c.dom.NodeList#item(int) + */ + public Node item(int index) { + return (Node) nodeList.get(index); + } + + /** + * @see org.w3c.dom.NodeList#getLength() + */ + public int getLength() { + return nodeList.size(); + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java b/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java new file mode 100644 index 000000000..90b28548a --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java @@ -0,0 +1,66 @@ +package at.gv.egovernment.moa.util; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * A class to chain ResourceBundles. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ResourceBundleChain { + /** Error message indicating the resource is not available. */ + private static final String ERROR_MISSING_RESOURCE = "Missing resource"; + /** The ResourceBundles contained in this chain. */ + private List resourceBundles = new ArrayList(); + + /** + * Add a ResourceBundle to the chain. + * + * @param resourceBundle The ResourceBundle to add. + */ + public void addResourceBundle(ResourceBundle resourceBundle) { + resourceBundles.add(resourceBundle); + } + + /** + * Return the value of the resource. + * + * @param key The key to access the String resource. + * @return The resource value. All the registered ResourceBundles + * are searched in the order in which they have previously been added to this + * ResourceBundleChain. + * @throws MissingResourceException The resource coult not be found in any of + * the bundles. + */ + public String getString(String key) throws MissingResourceException { + MissingResourceException lastException = null; + Iterator iter; + + // handle case where no resource bundles have been added + if (resourceBundles.size() == 0) { + throw new MissingResourceException( + ERROR_MISSING_RESOURCE, + this.getClass().getName(), + key); + } + + // try to find the resource in one of the bundles; if it cannot be found, + // return the exception thrown by the last bundle in the list + for (iter = resourceBundles.iterator(); iter.hasNext();) { + ResourceBundle resourceBundle = (ResourceBundle) iter.next(); + try { + String value = resourceBundle.getString(key); + return value; + } catch (MissingResourceException e) { + lastException = e; + } + } + throw lastException; + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/SSLUtils.java b/common/src/at/gv/egovernment/moa/util/SSLUtils.java new file mode 100644 index 000000000..621562e2d --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/SSLUtils.java @@ -0,0 +1,222 @@ +package at.gv.egovernment.moa.util; + +import java.io.IOException; +import java.io.InputStream; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import javax.net.ssl.SSLSocketFactory; + +import com.sun.net.ssl.KeyManager; +import com.sun.net.ssl.KeyManagerFactory; +import com.sun.net.ssl.SSLContext; +import com.sun.net.ssl.TrustManager; +import com.sun.net.ssl.TrustManagerFactory; + +/** + * Utility for connecting to server applications via SSL. + * + * @author Paul Ivancsics + * @version $Id$ + */ +public class SSLUtils { + + /** + * Creates an SSLSocketFactory which utilizes the given trust store. + * + * @param trustStoreType key store type of trust store + * @param trustStoreInputStream input stream for reading JKS trust store containing + * trusted server certificates; if null, the default + * trust store will be utilized + * @param trustStorePassword if provided, it will be used to check + * the integrity of the trust store; if omitted, it will not be checked + * @return SSLSocketFactory to be used by an HttpsURLConnection + * @throws IOException thrown while reading from the input stream + * @throws GeneralSecurityException thrown while creating the socket factory + */ + public static SSLSocketFactory getSSLSocketFactory( + String trustStoreType, + InputStream trustStoreInputStream, + String trustStorePassword) + throws IOException, GeneralSecurityException { + + TrustManager[] tms = getTrustManagers(trustStoreType, trustStoreInputStream, trustStorePassword); + SSLContext ctx = SSLContext.getInstance("TLS"); + ctx.init(null, tms, null); + + SSLSocketFactory sf = ctx.getSocketFactory(); + return sf; + } + /** + * Creates an SSLSocketFactory which utilizes the + * given trust store and keystore. + * + * @param trustStore trust store containing trusted server certificates; + * if null, the default trust store will be utilized + * @param clientKeyStoreType key store type of clientKeyStore + * @param clientKeyStoreURL URL of key store containing keys to be used for + * client authentication; if null, the default key store will be utilized + * @param clientKeyStorePassword if provided, it will be used to check + * the integrity of the client key store; if omitted, it will not be checked + * @return SSLSocketFactory to be used by an HttpsURLConnection + * @throws IOException thrown while reading key store file + * @throws GeneralSecurityException thrown while creating the socket factory + */ + public static SSLSocketFactory getSSLSocketFactory( + KeyStore trustStore, + String clientKeyStoreType, + String clientKeyStoreURL, + String clientKeyStorePassword) + throws IOException, GeneralSecurityException { + + SSLContext ctx = getSSLContext( + trustStore, clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); + SSLSocketFactory sf = ctx.getSocketFactory(); + return sf; + } + /** + * Creates an SSLContext initialized for the + * given trust store and keystore. + * + * @param trustStore trust store containing trusted server certificates; + * if null, the default trust store will be utilized + * @param clientKeyStoreType key store type of clientKeyStore + * @param clientKeyStoreURL URL of key store containing keys to be used for + * client authentication; if null, the default key store will be utilized + * @param clientKeyStorePassword if provided, it will be used to check + * the integrity of the client key store; if omitted, it will not be checked + * @return SSLContext to be used for creating an SSLSocketFactory + * @throws IOException thrown while reading key store file + * @throws GeneralSecurityException thrown while creating the SSL context + */ + public static SSLContext getSSLContext( + KeyStore trustStore, + String clientKeyStoreType, + String clientKeyStoreURL, + String clientKeyStorePassword) + throws IOException, GeneralSecurityException { + + //System.setProperty("javax.net.debug", "all"); + TrustManager[] tms = getTrustManagers(trustStore); + KeyManager[] kms = getKeyManagers(clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); + SSLContext ctx = SSLContext.getInstance("TLS"); + ctx.init(kms, tms, null); + return ctx; + } + /** + * Loads the trust store from an input stream and gets the + * TrustManagers from a default TrustManagerFactory, + * initialized from the given trust store. + * @param trustStoreType key store type of trust store + * @param trustStoreInputStream input stream for reading JKS trust store containing + * trusted server certificates; if null, the default + * trust store will be utilized + * @param trustStorePassword if provided, it will be used to check + * the integrity of the trust store; if omitted, it will not be checked + * @return TrustManagers to be used for creating an + * SSLSocketFactory utilizing the given trust store + * @throws IOException thrown while reading from the input stream + * @throws GeneralSecurityException thrown while initializing the + * default TrustManagerFactory + */ + protected static TrustManager[] getTrustManagers( + String trustStoreType, + InputStream trustStoreInputStream, + String trustStorePassword) + throws IOException, GeneralSecurityException { + + if (trustStoreInputStream == null) + return null; + + // Set up the TrustStore to use. We need to load the file into + // a KeyStore instance. + KeyStore trustStore = KeyStoreUtils.loadKeyStore(trustStoreType, trustStoreInputStream, trustStorePassword); + return getTrustManagers(trustStore); + } + /** + * Gets the TrustManagers from a default TrustManagerFactory, + * initialized from the given trust store. + * + * @param trustStore the trust store to use + * @param trustStorePassword password protecting the given trust store + * @return TrustManagers to be used for creating an + * SSLSocketFactory utilizing the given trust store + * @throws GeneralSecurityException thrown while initializing the + * default TrustManagerFactory + */ + protected static TrustManager[] getTrustManagers(KeyStore trustStore) + throws GeneralSecurityException { + + if (trustStore == null) + return null; + + // Initialize the default TrustManagerFactory with this KeyStore + String alg=TrustManagerFactory.getDefaultAlgorithm(); + TrustManagerFactory tmFact=TrustManagerFactory.getInstance(alg); + tmFact.init(trustStore); + + // And now get the TrustManagers + TrustManager[] tms=tmFact.getTrustManagers(); + return tms; + } + /** + * Loads the client key store from file and gets the + * KeyManagers from a default KeyManagerFactory, + * initialized from the given client key store. + * @param clientKeyStoreType key store type of clientKeyStore + * @param clientKeyStoreURL URL of key store containing keys to be used for + * client authentication; if null, the default key store will be utilized + * @param clientKeyStorePassword password used to check the integrity of the client key store; + * if null, it will not be checked + * @return KeyManagers to be used for creating an + * SSLSocketFactory utilizing the given client key store + * @throws IOException thrown while reading from the key store file + * @throws GeneralSecurityException thrown while initializing the + * default KeyManagerFactory + */ + public static KeyManager[] getKeyManagers ( + String clientKeyStoreType, + String clientKeyStoreURL, + String clientKeyStorePassword) + throws IOException, GeneralSecurityException { + + if (clientKeyStoreURL == null) + return null; + + // Set up the KeyStore to use. We need to load the file into + // a KeyStore instance. + KeyStore clientKeyStore = KeyStoreUtils.loadKeyStore( + clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); + return getKeyManagers(clientKeyStore, clientKeyStorePassword); + } + /** + * Gets the KeyManagers from a default KeyManagerFactory, + * initialized from the given client key store. + * @param clientKeyStore client key store + * @param clientKeyStorePassword if provided, it will be used to check + * the integrity of the client key store; if omitted, it will not be checked + * @return KeyManagers to be used for creating an + * SSLSocketFactory utilizing the given client key store + * @throws GeneralSecurityException thrown while initializing the + * default KeyManagerFactory + */ + public static KeyManager[] getKeyManagers ( + KeyStore clientKeyStore, + String clientKeyStorePassword) + throws GeneralSecurityException { + + if (clientKeyStore == null) + return null; + + // Now we initialize the default KeyManagerFactory with this KeyStore + String alg=KeyManagerFactory.getDefaultAlgorithm(); + KeyManagerFactory kmFact=KeyManagerFactory.getInstance(alg); + char[] password = null; + if (clientKeyStorePassword != null) + password = clientKeyStorePassword.toCharArray(); + kmFact.init(clientKeyStore, password); + + // And now get the KeyManagers + KeyManager[] kms=kmFact.getKeyManagers(); + return kms; + } +} diff --git a/common/src/at/gv/egovernment/moa/util/StreamEntityResolver.java b/common/src/at/gv/egovernment/moa/util/StreamEntityResolver.java new file mode 100644 index 000000000..38c4e863c --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/StreamEntityResolver.java @@ -0,0 +1,64 @@ +package at.gv.egovernment.moa.util; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * An EntityResolver that maps system IDs to + * InputStreams. + * + * @author Patrick Peck + * @version $Id$ + */ +public class StreamEntityResolver implements EntityResolver { + + /** A mapping from Public ID or System ID to an InputStream + * containing the entity. */ + private Map mappedEntities; + + /** + * Create a StreamEntityResolver. + * + * @param mappedEntities A mapping from public or system IDs + * (String objects) to InputStreams. + */ + public StreamEntityResolver(Map mappedEntities) { + this.mappedEntities = mappedEntities; + } + + /** + * Resolve an entity by looking it up in the mapped entities. + * + * First, the public ID is looked up in the mapping, then the system ID. + * + * @param publicId The public ID of the entity. + * @param systemId The system ID of the entity. + * @return An InputStream containing the entity or + * null if no entity could be found. + * @throws SAXException Signalling a parsing exception. + * @throws IOException Error reading the entity. + */ + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException, IOException { + + InputSource src = null; + + if (publicId != null && mappedEntities.get(publicId) != null) { + src = new InputSource((InputStream) mappedEntities.get(publicId)); + } else if (systemId != null && mappedEntities.get(systemId) != null) { + src = new InputSource((InputStream) mappedEntities.get(systemId)); + } + + if (src != null) { + src.setPublicId(publicId); + src.setSystemId(systemId); + } + + return src; + } +} diff --git a/common/src/at/gv/egovernment/moa/util/StreamUtils.java b/common/src/at/gv/egovernment/moa/util/StreamUtils.java new file mode 100644 index 000000000..88db24504 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/StreamUtils.java @@ -0,0 +1,116 @@ +package at.gv.egovernment.moa.util; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * Utility methods for streams. + * + * @author Patrick Peck + * @version $Id$ + */ +public class StreamUtils { + + /** + * Compare the contents of two InputStreams. + * + * @param is1 The 1st InputStream to compare. + * @param is2 The 2nd InputStream to compare. + * @return boolean true, if both streams contain the exactly the + * same content, false otherwise. + * @throws IOException An error occurred reading one of the streams. + */ + public static boolean compareStreams(InputStream is1, InputStream is2) + throws IOException { + + byte[] buf1 = new byte[256]; + byte[] buf2 = new byte[256]; + int length1; + int length2; + + try { + while (true) { + length1 = is1.read(buf1); + length2 = is2.read(buf2); + + if (length1 != length2) { + return false; + } + if (length1 <= 0) { + return true; + } + if (!compareBytes(buf1, buf2, length1)) { + return false; + } + } + } catch (IOException e) { + throw e; + } finally { + // close both streams + try { + is1.close(); + is2.close(); + } catch (IOException e) { + // ignore this + } + } + } + + /** + * Compare two byte arrays, up to a given maximum length. + * + * @param b1 1st byte array to compare. + * @param b2 2nd byte array to compare. + * @param length The maximum number of bytes to compare. + * @return true, if the byte arrays are equal, false + * otherwise. + */ + private static boolean compareBytes(byte[] b1, byte[] b2, int length) { + if (b1.length != b2.length) { + return false; + } + + for (int i = 0; i < b1.length && i < length; i++) { + if (b1[i] != b2[i]) { + return false; + } + } + + return true; + } + + /** + * Reads a byte array from a stream. + * @param in The InputStream to read. + * @return The bytes contained in the given InputStream. + * @throws IOException on any exception thrown + */ + public static byte[] readStream(InputStream in) throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int b; + while ((b = in.read()) >= 0) + out.write(b); + in.close(); + return out.toByteArray(); + } + + /** + * Reads a String from a stream, using given encoding. + * @param in The InputStream to read. + * @param encoding The character encoding to use for converting the bytes + * of the InputStream into a String. + * @return The content of the given InputStream converted into + * a String. + * @throws IOException on any exception thrown + */ + public static String readStream(InputStream in, String encoding) throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int b; + while ((b = in.read()) >= 0) + out.write(b); + in.close(); + return out.toString(encoding); + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/URLDecoder.java b/common/src/at/gv/egovernment/moa/util/URLDecoder.java new file mode 100644 index 000000000..a20820f7e --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/URLDecoder.java @@ -0,0 +1,60 @@ +package at.gv.egovernment.moa.util; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.StringReader; +import java.io.UnsupportedEncodingException; + +/** + * Decodes an URL encoded String using a specified character encoding. + * Provides a function missing in JDK 1.3. + * @author Paul Ivancsics + * @version $Id$ + */ +public class URLDecoder { + + /** + * Decodes an application/x-www-form-urlencoded string using a specific encoding scheme. + * @param s the string to decode + * @param encoding name of character encoding + * @return the newly decoded string + * @throws UnsupportedEncodingException if the encoding is not supported + */ + public static String decode(String s, String encoding) throws UnsupportedEncodingException { + StringReader in = new StringReader(s); + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + for (int b = read(in); b >= 0; b = read(in)) + bout.write(b); + return bout.toString(encoding); + } + /** + * Decodes the next byte from the string reader. + * @param in string reader + * @return the next byte decoded; + * -1 upon end of string, on erroneous data, and on any exception caught + * @todo syntax check on string + */ + private static int read(StringReader in) { + try { + int b = in.read(); + if (b == '+') + return ' '; + if (b == '%') { + char[] hex = new char[2]; + if (in.read(hex, 0, 2) >= 0) { + String hexString = new String(hex); + return Integer.valueOf(hexString, 16).intValue(); + } + else + return -1; + } + return b; + } + catch (IOException ex) { + return -1; + } + catch (NumberFormatException ex) { + return -1; + } + } +} diff --git a/common/src/at/gv/egovernment/moa/util/URLEncoder.java b/common/src/at/gv/egovernment/moa/util/URLEncoder.java new file mode 100644 index 000000000..840c0c3bc --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/URLEncoder.java @@ -0,0 +1,63 @@ +package at.gv.egovernment.moa.util; + +import java.io.ByteArrayInputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; + +/** + * Translates a string into mime format "x-www-form-urlencoded". + * Provides a function missing in JDK 1.3. + * @author Paul Ivancsics + * @version $Id$ + */ +public class URLEncoder { + + /** + * Translates a string into x-www-form-urlencoded format. + * @param s the string to be translated + * @param encoding the encoding to use + * @return the translated string + * @throws UnsupportedEncodingException when the desired encoding is not supported + */ + public static String encode(String s, String encoding) throws UnsupportedEncodingException { + byte[] barr = s.getBytes(encoding); + ByteArrayInputStream bin = new ByteArrayInputStream(barr); + StringWriter out = new StringWriter(); + for (int b = bin.read(); b >= 0; b = bin.read()) + encode(b, out); + return out.toString(); + } + + /** + * Encode a character. + * @param ch The character to encode. + * @param out The StringWriter containing the result. + */ + private static void encode(int ch, StringWriter out) { + if ((ch >= 'a' && ch <= 'z') + || (ch >= 'A' && ch <= 'Z') + || (ch >= '0' && ch <= '9') + || ch == '.' || ch == '-' || ch == '*' || ch == '_') + out.write(ch); + else if (ch == ' ') + out.write('+'); + else + encodeHex(ch, out); + } + + /** + * Encode a character as an escaped hex value. + * @param ch The character to encode. + * @param out The StringWriter containing the result. + */ + private static void encodeHex(int ch, StringWriter out) { + out.write('%'); + String hex = Integer.toHexString(ch).toUpperCase(); + if (hex.length() < 2) + out.write('0'); + else + out.write(hex.charAt(hex.length() - 2)); + out.write(hex.charAt(hex.length() - 1)); + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/XPathException.java b/common/src/at/gv/egovernment/moa/util/XPathException.java new file mode 100644 index 000000000..e10c882e5 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/XPathException.java @@ -0,0 +1,58 @@ +package at.gv.egovernment.moa.util; + +import java.io.PrintStream; +import java.io.PrintWriter; + +/** + * An exception occurred evaluating an XPath. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XPathException extends RuntimeException { + /** The wrapped exception. */ + private Throwable wrapped; + + /** + * Create a XPathException. + * + * @param message The exception message. + * @param wrapped The exception being the likely cause of this exception. + */ + public XPathException(String message, Throwable wrapped) { + super(message); + this.wrapped = wrapped; + } + + /** + * Return the wrapped exception. + * + * @return The wrapped exception being the likely cause of this exception. + */ + public Throwable getWrapped() { + return wrapped; + } + + /** + * @see java.lang.Throwable#printStackTrace(java.io.PrintStream) + */ + public void printStackTrace(PrintStream s) { + super.printStackTrace(s); + if (getWrapped() != null) { + s.print("Caused by: "); + getWrapped().printStackTrace(s); + } + } + + /** + * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter) + */ + public void printStackTrace(PrintWriter s) { + super.printStackTrace(s); + if (getWrapped() != null) { + s.print("Caused by: "); + getWrapped().printStackTrace(s); + } + } + +} diff --git a/common/src/at/gv/egovernment/moa/util/XPathUtils.java b/common/src/at/gv/egovernment/moa/util/XPathUtils.java new file mode 100644 index 000000000..0ed4fcda3 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/XPathUtils.java @@ -0,0 +1,415 @@ +package at.gv.egovernment.moa.util; + +import java.util.List; +import java.util.Map; + +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.traversal.NodeIterator; + +import org.jaxen.JaxenException; +import org.jaxen.NamespaceContext; +import org.jaxen.SimpleNamespaceContext; +import org.jaxen.dom.DOMXPath; +import org.jaxen.dom.DocumentNavigator; + +/** + * Utility methods to evaluate XPath expressions on DOM nodes. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XPathUtils { + + /** + * The XPath expression selecting all nodes under a given root (including the + * root node itself). + */ + public static final String ALL_NODES_XPATH = + "(.//. | .//@* | .//namespace::*)"; + + /** The DocumentNavigator to use for navigating the document. */ + private static DocumentNavigator documentNavigator = + DocumentNavigator.getInstance(); + /** The default namespace prefix to namespace URI mappings. */ + private static NamespaceContext NS_CONTEXT; + + static { + SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + ctx.addNamespace(Constants.MOA_PREFIX, Constants.MOA_NS_URI); + ctx.addNamespace(Constants.MOA_CONFIG_PREFIX, Constants.MOA_CONFIG_NS_URI); + ctx.addNamespace( + Constants.MOA_ID_CONFIG_PREFIX, + Constants.MOA_ID_CONFIG_NS_URI); + ctx.addNamespace(Constants.SL10_PREFIX, Constants.SL10_NS_URI); + ctx.addNamespace(Constants.SL11_PREFIX, Constants.SL11_NS_URI); + ctx.addNamespace(Constants.ECDSA_PREFIX, Constants.ECDSA_NS_URI); + ctx.addNamespace(Constants.PD_PREFIX, Constants.PD_NS_URI); + ctx.addNamespace(Constants.SAML_PREFIX, Constants.SAML_NS_URI); + ctx.addNamespace(Constants.SAMLP_PREFIX, Constants.SAMLP_NS_URI); + ctx.addNamespace(Constants.DSIG_PREFIX, Constants.DSIG_NS_URI); + ctx.addNamespace(Constants.XSLT_PREFIX, Constants.XSLT_NS_URI); + ctx.addNamespace(Constants.XSI_PREFIX, Constants.XSI_NS_URI); + ctx.addNamespace( + Constants.DSIG_FILTER2_PREFIX, + Constants.DSIG_FILTER2_NS_URI); + ctx.addNamespace(Constants.DSIG_EC_PREFIX, Constants.DSIG_EC_NS_URI); + NS_CONTEXT = ctx; + } + + /** + * Return a NodeIterator over the nodes matching the XPath + * expression. + * + * All namespace URIs and prefixes declared in the Constants + * interface are used for resolving namespaces. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return An iterator over the resulting nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeIterator selectNodeIterator(Node contextNode, String exp) + throws XPathException { + + return selectNodeIterator(contextNode, NS_CONTEXT, exp); + } + + /** + * Return a NodeIterator over the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceElement An element from which to build the + * namespace mapping for evaluating the XPath expression + * @param exp The XPath expression to evaluate. + * @return An iterator over the resulting nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeIterator selectNodeIterator( + Node contextNode, + Element namespaceElement, + String exp) + throws XPathException { + + try { + SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + ctx.addElementNamespaces(documentNavigator, namespaceElement); + return selectNodeIterator(contextNode, ctx, exp); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Return a NodeIterator over the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceMapping A namespace prefix to namespace URI mapping + * (String to String) for evaluating the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return An iterator over the resulting nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeIterator selectNodeIterator( + Node contextNode, + Map namespaceMapping, + String exp) + throws XPathException { + + SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); + + return selectNodeIterator(contextNode, ctx, exp); + } + + /** + * Return a NodeIterator over the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param nsContext The NamespaceContext for resolving namespace + * prefixes to namespace URIs for evaluating the XPath expression. + * @param exp The XPath expression to evaluate. + * @return An iterator over the resulting nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + private static NodeIterator selectNodeIterator( + Node contextNode, + NamespaceContext nsContext, + String exp) + throws XPathException { + + try { + DOMXPath xpath = new DOMXPath(exp); + List nodes; + + xpath.setNamespaceContext(nsContext); + nodes = xpath.selectNodes(contextNode); + return new NodeIteratorAdapter(nodes.listIterator()); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Return a NodeList of all the nodes matching the XPath + * expression. + * + * All namespace URIs and prefixes declared in the Constants + * interface are used for resolving namespaces. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return A NodeList containing the matching nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeList selectNodeList(Node contextNode, String exp) + throws XPathException { + + return selectNodeList(contextNode, NS_CONTEXT, exp); + } + + /** + * Return a NodeList of all the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceElement An element from which to build the + * namespace mapping for evaluating the XPath expression + * @param exp The XPath expression to evaluate. + * @return A NodeList containing the matching nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeList selectNodeList( + Node contextNode, + Element namespaceElement, + String exp) + throws XPathException { + + try { + SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + + ctx.addElementNamespaces(documentNavigator, namespaceElement); + return selectNodeList(contextNode, ctx, exp); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Return a NodeList of all the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceMapping A namespace prefix to namespace URI mapping + * (String to String) for evaluating the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return A NodeList containing the matching nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeList selectNodeList( + Node contextNode, + Map namespaceMapping, + String exp) + throws XPathException { + + SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); + + return selectNodeList(contextNode, ctx, exp); + } + + /** + * Return a NodeList of all the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param nsContext The NamespaceContext for resolving namespace + * prefixes to namespace URIs for evaluating the XPath expression. + * @param exp The XPath expression to evaluate. + * @return A NodeList containing the matching nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + private static NodeList selectNodeList( + Node contextNode, + NamespaceContext nsContext, + String exp) + throws XPathException { + + try { + DOMXPath xpath = new DOMXPath(exp); + List nodes; + + xpath.setNamespaceContext(nsContext); + nodes = xpath.selectNodes(contextNode); + return new NodeListAdapter(nodes); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Select the first node matching an XPath expression. + * + * All namespace URIs and prefixes declared in the Constants + * interface are used for resolving namespaces. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return Node The first node matching the XPath expression, or + * null, if no node matched. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static Node selectSingleNode(Node contextNode, String exp) + throws XPathException { + + return selectSingleNode(contextNode, NS_CONTEXT, exp); + } + + /** + * Select the first node matching an XPath expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceElement An element from which to build the + * namespace mapping for evaluating the XPath expression + * @param exp The XPath expression to evaluate. + * @return Node The first node matching the XPath expression, or + * null, if no node matched. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static Node selectSingleNode( + Node contextNode, + Element namespaceElement, + String exp) + throws XPathException { + + try { + SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + ctx.addElementNamespaces(documentNavigator, namespaceElement); + + return selectSingleNode(contextNode, ctx, exp); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Select the first node matching an XPath expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceMapping A namespace prefix to namespace URI mapping + * (String to String) for evaluating the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return Node The first node matching the XPath expression, or + * null, if no node matched. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static Node selectSingleNode( + Node contextNode, + Map namespaceMapping, + String exp) + throws XPathException { + + SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); + + return selectSingleNode(contextNode, ctx, exp); + } + + /** + * Select the first node matching an XPath expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param nsContext The NamespaceContext for resolving namespace + * prefixes to namespace URIs for evaluating the XPath expression. + * @param exp The XPath expression to evaluate. + * @return Node The first node matching the XPath expression, or + * null, if no node matched. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + private static Node selectSingleNode( + Node contextNode, + NamespaceContext nsContext, + String exp) + throws XPathException { + + try { + DOMXPath xpath = new DOMXPath(exp); + xpath.setNamespaceContext(nsContext); + return (Node) xpath.selectSingleNode(contextNode); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Return the value of a DOM element whose location is given by an XPath + * expression. + * + * @param root The root element from which to evaluate the XPath. + * @param xpath The XPath expression pointing to the element whose value + * to return. + * @param def The default value to return, if no element can be found using + * the given xpath. + * @return The element value, if it can be located using the + * xpath. Otherwise, def is returned. + */ + public static String getElementValue( + Element root, + String xpath, + String def) { + + Element elem = (Element) XPathUtils.selectSingleNode(root, xpath); + return elem != null ? DOMUtils.getText(elem) : def; + } + + /** + * Return the value of a DOM attribute whose location is given by an XPath + * expression. + * + * @param root The root element from which to evaluate the XPath. + * @param xpath The XPath expression pointing to the attribute whose value to + * return. + * @param def The default value to return, if no attribute can be found using + * the given xpath. + * @return The element value, if it can be located using the + * xpath. Otherwise, def is returned. + */ + public static String getAttributeValue( + Element root, + String xpath, + String def) { + + Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath); + return attr != null ? attr.getValue() : def; + } + +} diff --git a/common/src/test/at/gv/egovernment/moa/AllTests.java b/common/src/test/at/gv/egovernment/moa/AllTests.java new file mode 100644 index 000000000..00e2c505f --- /dev/null +++ b/common/src/test/at/gv/egovernment/moa/AllTests.java @@ -0,0 +1,38 @@ +package test.at.gv.egovernment.moa; + +import test.at.gv.egovernment.moa.util.DOMUtilsTest; +import test.at.gv.egovernment.moa.util.DateTimeUtilsTest; +import test.at.gv.egovernment.moa.util.KeyStoreUtilsTest; +import test.at.gv.egovernment.moa.util.SSLUtilsTest; +import test.at.gv.egovernment.moa.util.XPathUtilsTest; + +import junit.awtui.TestRunner; +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * @author patrick + * @version $Id$ + */ +public class AllTests { + + public static Test suite() { + TestSuite suite = new TestSuite(); + + suite.addTestSuite(DOMUtilsTest.class); + suite.addTestSuite(DateTimeUtilsTest.class); + suite.addTestSuite(XPathUtilsTest.class); + suite.addTestSuite(KeyStoreUtilsTest.class); + suite.addTestSuite(SSLUtilsTest.class); + + return suite; + } + + public static void main(String[] args) { + try { + TestRunner.run(AllTests.class); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/common/src/test/at/gv/egovernment/moa/MOATestCase.java b/common/src/test/at/gv/egovernment/moa/MOATestCase.java new file mode 100644 index 000000000..86ea2ee6c --- /dev/null +++ b/common/src/test/at/gv/egovernment/moa/MOATestCase.java @@ -0,0 +1,75 @@ +package test.at.gv.egovernment.moa; + +import java.io.FileInputStream; +import java.io.StringReader; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Document; + +import org.xml.sax.InputSource; + +import junit.framework.TestCase; + +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; + +/** + * Base class for MOA test cases. + * + * Provides some utility functions. + * + * @author Patrick Peck + * @version $Id$ + */ +public class MOATestCase extends TestCase { + + protected static final String TESTDATA_ROOT = "data/test/"; + + /** + * Constructor for MOATestCase. + * @param arg0 + */ + public MOATestCase(String name) { + super(name); + } + + /** + * Parse an XML file non-validating. + */ + public static Document parseXml(String fileName) throws Exception { + return DOMUtils.parseDocument( + new FileInputStream(fileName), + false, + null, + null); + } + + /** + * Parse an XML validating with a given file name. + * + * Uses the local schema resources. + */ + public static Document parseXmlValidating(String fileName) throws Exception { + return DOMUtils.parseDocument( + new FileInputStream(fileName), + true, + Constants.ALL_SCHEMA_LOCATIONS, + null); + } + + /** + * Parse an XML from a String. + */ + public static Document parseXmlString(String xml) throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder; + + factory.setNamespaceAware(true); + builder = factory.newDocumentBuilder(); + + return builder.parse(new InputSource(new StringReader(xml))); + } + +} diff --git a/common/src/test/at/gv/egovernment/moa/util/DOMUtilsTest.java b/common/src/test/at/gv/egovernment/moa/util/DOMUtilsTest.java new file mode 100644 index 000000000..eb3ad1a5c --- /dev/null +++ b/common/src/test/at/gv/egovernment/moa/util/DOMUtilsTest.java @@ -0,0 +1,137 @@ +package test.at.gv.egovernment.moa.util; +import java.io.FileInputStream; +import java.util.Map; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import test.at.gv.egovernment.moa.*; + +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; + +/** + * @author Patrick Peck + * @version $Id$ + */ +public class DOMUtilsTest extends MOATestCase { + private static final String TESTDATA_BASE = TESTDATA_ROOT + "xml/"; + private static boolean grammarsInitialized = false; + + /** + * Constructor for DOMUtilsTest. + * @param name + */ + public DOMUtilsTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + if (!grammarsInitialized) { + // preparse XML schema + DOMUtils.addSchemaToPool( + getClass().getResourceAsStream(Constants.XML_SCHEMA_LOCATION), + Constants.XML_NS_URI); + // preparse XMLDsig Filter2 schema + DOMUtils.addSchemaToPool( + getClass().getResourceAsStream(Constants.DSIG_FILTER2_SCHEMA_LOCATION), + Constants.DSIG_FILTER2_NS_URI); + // preparse XMLDsig schema + DOMUtils.addSchemaToPool( + getClass().getResourceAsStream(Constants.DSIG_SCHEMA_LOCATION), + Constants.DSIG_NS_URI); + // preparse MOA schema + DOMUtils.addSchemaToPool( + getClass().getResourceAsStream(Constants.MOA_SCHEMA_LOCATION), + Constants.MOA_NS_URI); + grammarsInitialized = true; + } + } + + private Document parse(String fileName) throws Exception { + return DOMUtils.parseDocument( + new FileInputStream(fileName), + true, + Constants.ALL_SCHEMA_LOCATIONS, + null); + } + + public void testParseCreateXMLSignature() throws Exception { + parse(TESTDATA_BASE + "CreateXMLSignature/TestGeneratorCX2.005.Req.xml"); + parse(TESTDATA_BASE + "CreateXMLSignature/Req000.xml"); + parse(TESTDATA_BASE + "CreateXMLSignature/Req001.xml"); + parse(TESTDATA_BASE + "CreateXMLSignature/Req002.xml"); + parse(TESTDATA_BASE + "CreateXMLSignature/Req004.xml"); + } + + public void testParseVerifyCMSSignature() throws Exception { + parse(TESTDATA_BASE + "VerifyCMSSignature/Req000.xml"); + } + + public void testParseVerifyXMLSignature() throws Exception { + parse(TESTDATA_BASE + "VerifyXMLSignature/Req000.xml"); + parse(TESTDATA_BASE + "VerifyXMLSignature/Req001.xml"); + parse(TESTDATA_BASE + "VerifyXMLSignature/Req002.xml"); + parse(TESTDATA_BASE + "VerifyXMLSignature/TestGeneratorVX.002.Req.xml"); + //parse(TESTDATA_BASE + "VerifyXMLSignature/TestGeneratorVX.006.Req.xml"); + parse(TESTDATA_BASE + "VerifyXMLSignature/VerifySAMLRequest.xml"); + } + + public void testParseInfobox() throws Exception { + parse(TESTDATA_BASE + "Infobox/InfoboxReadResponseMOA4.xml"); + parse(TESTDATA_BASE + "Infobox/InfoboxReadResponse.xml"); + } + + + private Document parsePlain(String fileName) throws Exception { + return DOMUtils.parseDocument( + new FileInputStream(fileName), + false, + null, + null); + } + + public void testValidateCreateXMLSignature() throws Exception { + Document doc; + boolean valid; + + // test a valid request + doc = parsePlain(TESTDATA_BASE + "CreateXMLSignature/Req000.xml"); + valid = + DOMUtils.validateElement( + doc.getDocumentElement(), + Constants.ALL_SCHEMA_LOCATIONS, + null); + assertTrue(valid); + + // test an invalid request + doc = parsePlain(TESTDATA_BASE + "CreateXMLSignature/invalid.xml"); + try { + valid = + DOMUtils.validateElement( + doc.getDocumentElement(), + Constants.ALL_SCHEMA_LOCATIONS, + null); + fail(); + } catch (Exception e) { + } + } + + public void testGetNamespaceDeclarations() throws Exception { + Document doc; + NodeList nl; + Element elem; + Map nsDecls; + + doc = parse(TESTDATA_BASE + "VerifyXMLSignature/Req002.xml"); + nl = doc.getElementsByTagNameNS(Constants.DSIG_NS_URI, "Reference"); + elem = (Element) nl.item(0); + nsDecls = DOMUtils.getNamespaceDeclarations(elem); + + assertEquals(2, nsDecls.size()); + assertEquals(Constants.DSIG_NS_URI, nsDecls.get("dsig")); + assertEquals(Constants.MOA_NS_URI, nsDecls.get("")); + } + +} diff --git a/common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java b/common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java new file mode 100644 index 000000000..da6b29b1c --- /dev/null +++ b/common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java @@ -0,0 +1,104 @@ +package test.at.gv.egovernment.moa.util; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +import junit.framework.TestCase; + +import at.gv.egovernment.moa.util.DateTimeUtils; + +/** + * @author Patrick Peck + * @version $Id$ + */ +public class DateTimeUtilsTest extends TestCase { + + /** + * Constructor for DateTimeUtilsTest. + * @param arg0 + */ + public DateTimeUtilsTest(String arg0) { + super(arg0); + } + + public void testParseDateTimeValid() throws Exception { + Date date; + DateFormat format = SimpleDateFormat.getDateTimeInstance(); + String dateStr; + + format.setTimeZone(TimeZone.getTimeZone("GMT")); + date = DateTimeUtils.parseDateTime("+1971-12-12T06:30:15"); + date.setTime(date.getTime() + TimeZone.getDefault().getRawOffset()); + dateStr = format.format(date); + assertEquals("12.12.1971 06:30:15", dateStr); + + date = DateTimeUtils.parseDateTime("2000-01-01T23:59:59.012Z"); + dateStr = format.format(date); + assertEquals("01.01.2000 23:59:59", dateStr); + + date = DateTimeUtils.parseDateTime("2003-05-20T12:17:30-05:00"); + dateStr = format.format(date); + assertEquals("20.05.2003 17:17:30", dateStr); + + + date = DateTimeUtils.parseDateTime("2002-02-02T02:02:02.33+04:30"); + dateStr = format.format(date); + assertEquals("01.02.2002 21:32:02", dateStr); + } + + public void testParseDateTimeInvalid() { + try { + DateTimeUtils.parseDateTime("+1971-12-12T6:30:15"); + fail(); + } catch (ParseException e) { + } + + try { + DateTimeUtils.parseDateTime("2000-01-0123:59:59.999999Z"); + fail(); + } catch (ParseException e) { + } + + try { + DateTimeUtils.parseDateTime("2003-05-20T12:17:3005:00"); + fail(); + } catch (ParseException e) { + } + + try { + DateTimeUtils.parseDateTime(" 2002-02-02T02:02:02.33+04:00"); + fail(); + } catch (ParseException e) { + } + + } + + public void testBuildDateTimeGMTMinus3() { + String should = "2002-01-01T01:01:01-03:00"; + doTestBuildDateTime(2002, 1, 1, 1, 1, 1, "GMT-03:00", should); + } + public void testBuildDateTimeMEZSommerzeit() { + String should = "2002-07-31T23:59:59+02:00"; + doTestBuildDateTime(2002, 7, 31, 23, 59, 59, "GMT+01:00", should); + } + public void testBuildDateTimeGMT() { + String should = "2002-01-01T01:01:01"; + doTestBuildDateTime(2002, 1, 1, 1, 1, 1, "GMT+00:00", should); + } + private void doTestBuildDateTime( + int year, int month, int day, + int hour, int min, int sec, + String timeZone, String dateTimeShould) { + + Calendar cal = new GregorianCalendar(TimeZone.getTimeZone(timeZone)); + cal.set(year,month, day, hour, min, sec); + cal.set(Calendar.MILLISECOND, 0); + String dateTimeBuilt = DateTimeUtils.buildDateTime(cal); + assertEquals(dateTimeShould, dateTimeBuilt); + } + +} diff --git a/common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java b/common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java new file mode 100644 index 000000000..06a72c570 --- /dev/null +++ b/common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java @@ -0,0 +1,90 @@ +package test.at.gv.egovernment.moa.util; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.math.BigInteger; +import java.security.KeyStore; +import java.security.Security; +import java.security.cert.X509Certificate; +import java.util.Enumeration; + +import at.gv.egovernment.moa.util.KeyStoreUtils; + +import junit.framework.TestCase; + +/** + * @author Paul Ivancsics + * @version $Id$ + */ +public class KeyStoreUtilsTest extends TestCase { + private String tmpDir = "tmp/KeyStoreUtilsTest"; + private String tmpDirURL = "file:" + tmpDir; + + public KeyStoreUtilsTest(String arg0) { + super(arg0); + } + + protected void setUp() throws Exception { + Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + new File(tmpDir).mkdirs(); + } + protected void tearDown() throws Exception { + new File(tmpDir).delete(); + } + public void testCreateKeyStoreJKS() throws Exception { + String[] certFilenames = new String[] { + "data/test/security/server-certs/baltimore.cer" + }; + KeyStore ks = KeyStoreUtils.createKeyStore("jks", certFilenames); + assertEquals(1, ks.size()); + X509Certificate cert = (X509Certificate)ks.getCertificate("0"); + assertEquals(3424, cert.getSerialNumber().intValue()); + } + public void testCreateKeyStorePKCS12() throws Exception { + String[] certFilenames = new String[] { + "data/test/security/server-certs/baltimore.cer" + }; + KeyStore ks = KeyStoreUtils.createKeyStore("pkcs12", certFilenames); + assertEquals(1, ks.size()); + X509Certificate cert = (X509Certificate)ks.getCertificate("0"); + assertEquals(3424, cert.getSerialNumber().intValue()); + } + public void testCreateKeyStoreFromCertificateDirectory() throws Exception { + // copy certificate files to a temporary directory, + // omitting the "CVS" directory in the source directory + copyCertificates("data/test/security/server-certs", tmpDir); + KeyStore ks = KeyStoreUtils.createKeyStoreFromCertificateDirectory("jks", tmpDirURL); + assertEquals(2, ks.size()); + X509Certificate cert0 = (X509Certificate)ks.getCertificate("0"); + X509Certificate cert1 = (X509Certificate)ks.getCertificate("1"); + assertTrue(3424 == cert0.getSerialNumber().intValue() || 3424 == cert1.getSerialNumber().intValue()); + } + private void copyCertificates(String from, String to) throws IOException { + String[] fromList = new File(from).list(); + for (int i = 0; i < fromList.length; i++) { + File fromFile = new File(from + File.separator + fromList[i]); + if (fromFile.isFile()) { + String toFile = to + "/" + fromList[i]; + FileInputStream in = new FileInputStream(fromFile); + FileOutputStream out = new FileOutputStream(toFile); + for (int ch = in.read(); ch >= 0; ch = in.read()) + out.write(ch); + out.close(); + in.close(); + } + } + + } + public void testLoadKeyStore() throws Exception { + String keyStoreURL = "file:data/test/security/client-certs/sicher-demo(buergerkarte).p12"; + KeyStore ks = KeyStoreUtils.loadKeyStore("pkcs12", keyStoreURL, "buergerkarte"); + assertEquals(1, ks.size()); + Enumeration enum = ks.aliases(); + String alias = (String)enum.nextElement(); + X509Certificate cert = (X509Certificate)ks.getCertificate(alias); + assertEquals(new BigInteger("1044289238331").intValue(), cert.getSerialNumber().intValue()); + } + +} diff --git a/common/src/test/at/gv/egovernment/moa/util/SSLUtilsTest.java b/common/src/test/at/gv/egovernment/moa/util/SSLUtilsTest.java new file mode 100644 index 000000000..7e55cb7d0 --- /dev/null +++ b/common/src/test/at/gv/egovernment/moa/util/SSLUtilsTest.java @@ -0,0 +1,160 @@ +package test.at.gv.egovernment.moa.util; + +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.security.KeyStore; +import java.security.Security; + +import javax.net.ssl.SSLException; +import javax.net.ssl.SSLSocketFactory; + +import com.sun.net.ssl.HostnameVerifier; +import com.sun.net.ssl.HttpsURLConnection; + +import at.gv.egovernment.moa.util.KeyStoreUtils; +import at.gv.egovernment.moa.util.SSLUtils; + +import junit.framework.TestCase; + +/** + * @author Paul Ivancsics + * @version $Id$ + */ +public class SSLUtilsTest extends TestCase { + + public SSLUtilsTest(String arg0) { + super(arg0); + } + + + protected void setUp() throws Exception { + //System.setProperty("javax.net.debug", "all"); + Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); + System.setProperty("https.cipherSuites", "SSL_DHE_DSS_WITH_DES_CBC_SHA,SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA,SSL_RSA_WITH_DES_CBC_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_RSA_EXPORT_WITH_RC4_40_MD5"); + } + + public void testGetSSLSocketFactoryBaltimoreOK() throws Exception { + doTestGetSSLSocketFactory( + "GET", + "https://www.baltimore.com/", + false, + "file:data/test/security/cacerts+gt_cybertrust_root", + "changeit", + true); + } + public void testGetSSLSocketFactoryBaltimoreNOK() throws Exception { + doTestGetSSLSocketFactory( + "GET", + "https://www.baltimore.com/", + false, + "file:data/test/security/cacerts", + "changeit", + false); + } + public void testGetSSLSocketFactoryVerisignOK() throws Exception { + doTestGetSSLSocketFactory( + "GET", + "https://www.verisign.com/", + false, + "file:data/test/security/cacerts", + "changeit", + true); + } + public void testGetSSLSocketFactoryVerisignNoTruststoreOK() throws Exception { + doTestGetSSLSocketFactory( + "GET", + "https://www.verisign.com/", + false, + null, + null, + true); + } + public void testGetSSLSocketFactoryLocalhostOK() throws Exception { + String urlString = "https://localhost:8443/moa-id-auth/index.jsp"; + doTestGetSSLSocketFactory( + "GET", + urlString, + true, + "file:data/test/security/server.keystore.tomcat", + "changeit", + true); + } + public void testGetSSLSocketFactoryLocalhostNOK() throws Exception { + String urlString = "https://localhost:8443/moa-id-auth/index.jsp"; + doTestGetSSLSocketFactory( + "GET", + urlString, + true, + null, + null, + false); + } + + public void doTestGetSSLSocketFactory( + String requestMethod, + String urlString, + boolean useHostnameVerifierHack, + String truststoreurl, + String trustpassword, + boolean shouldOk + ) throws Exception { + + doTestGetSSLSocketFactory( + requestMethod, urlString, useHostnameVerifierHack, truststoreurl, trustpassword, null, null, null, shouldOk); + } + public void doTestGetSSLSocketFactory( + String requestMethod, + String urlString, + boolean useHostnameVerifierHack, + String truststoreurl, + String trustpassword, + String keystoretype, + String keystoreurl, + String keypassword, + boolean shouldOk + ) throws Exception { + + KeyStore truststore = null; + if (truststoreurl != null) + truststore = KeyStoreUtils.loadKeyStore("jks", truststoreurl, trustpassword); + SSLSocketFactory sf = SSLUtils.getSSLSocketFactory( + truststore, keystoretype, keystoreurl, keypassword); + System.out.println(requestMethod + " " + urlString); + + URL url = new URL(urlString); + HttpsURLConnection conn = (HttpsURLConnection)url.openConnection(); + conn.setRequestMethod(requestMethod); + conn.setDoInput(true); + conn.setDoOutput(true); + conn.setUseCaches(false); + conn.setAllowUserInteraction(false); + conn.setSSLSocketFactory(sf); + if (useHostnameVerifierHack) + conn.setHostnameVerifier(new HostnameVerifierHack()); + try { + conn.connect(); + assertTrue(shouldOk); + assertEquals(200, conn.getResponseCode()); + conn.disconnect(); + } + catch (SSLException ex) { + assertFalse(shouldOk); + } + } + private byte[] readTruststore(String filename) throws IOException { + if (filename == null) + return null; + FileInputStream in = new FileInputStream(filename); + byte[] buffer = new byte[in.available()]; + in.read(buffer); + in.close(); + return buffer; + } + private class HostnameVerifierHack implements HostnameVerifier { + public boolean verify(String arg0, String arg1) { + return true; + } + } +} diff --git a/common/src/test/at/gv/egovernment/moa/util/URLDecoderTest.java b/common/src/test/at/gv/egovernment/moa/util/URLDecoderTest.java new file mode 100644 index 000000000..b6ea0e152 --- /dev/null +++ b/common/src/test/at/gv/egovernment/moa/util/URLDecoderTest.java @@ -0,0 +1,29 @@ +package test.at.gv.egovernment.moa.util; + +import java.net.URLEncoder; + +import at.gv.egovernment.moa.util.FileUtils; +import at.gv.egovernment.moa.util.URLDecoder; + +import junit.framework.TestCase; + +/* + * @author Paul Ivancsics + * @version $Id$ + */ +public class URLDecoderTest extends TestCase { + + public void test() throws Exception { + String s = "immerZUA0129<>%==$$%&/()@?{()=} \\\"äöüÄÖÜ?§"; + String senc = URLEncoder.encode(s); + String sdec = URLDecoder.decode(senc, "ISO-8859-1"); + assertEquals(s, sdec); + } + public void testUTF8() throws Exception { + String s = new String(FileUtils.readFile("data/test/xml/CreateXMLSignature/CreateXMLSignatureResponse.xml")); + String senc = URLEncoder.encode(s); + String sdec = URLDecoder.decode(senc, "UTF-8"); + String sutf8 = FileUtils.readFile("data/test/xml/CreateXMLSignature/CreateXMLSignatureResponse.xml", "UTF-8"); + assertEquals(sutf8, sdec); + } +} diff --git a/common/src/test/at/gv/egovernment/moa/util/URLEncoderTest.java b/common/src/test/at/gv/egovernment/moa/util/URLEncoderTest.java new file mode 100644 index 000000000..43238c51f --- /dev/null +++ b/common/src/test/at/gv/egovernment/moa/util/URLEncoderTest.java @@ -0,0 +1,43 @@ +package test.at.gv.egovernment.moa.util; + +import at.gv.egovernment.moa.util.FileUtils; +import at.gv.egovernment.moa.util.URLDecoder; +import at.gv.egovernment.moa.util.URLEncoder; +import junit.framework.TestCase; + +/* + * @author Paul Ivancsics + * @version $Id$ + */ +public class URLEncoderTest extends TestCase { + + public void testUnchangedString() throws Exception { + String s = "AZaz0123456789.-*_"; + String senc = URLEncoder.encode(s, "UTF-8"); + assertEquals(s, senc); + } + public void testAumlUTF8() throws Exception { + String s = "ä"; + String senc = URLEncoder.encode(s, "UTF-8"); + assertEquals("%C3%A4", senc); + } + public void testEncodeDecode() throws Exception { + String s = "AZaz09.-*_ <>%=$%&/()@?{}[]\\\"'äöüÄÖÜߧ"; + String senc = URLEncoder.encode(s, "UTF-8"); + String sdec = URLDecoder.decode(senc, "UTF-8"); + assertEquals(s, sdec); + } + public void testCertInfo() throws Exception { + String s = new String(FileUtils.readFile("data/test/xml/VerifyXMLSignature/CertInfoVerifyXMLSignatureRequest.xml", "UTF-8")); + String senc = URLEncoder.encode(s, "UTF-8"); + String sdec = URLDecoder.decode(senc, "UTF-8"); + assertEquals(s, sdec); + } + /*public void testJDK14() throws Exception { + String s = new String(FileUtils.readFile("data/test/xml/VerifyXMLSignature/CertInfoVerifyXMLSignatureRequest.xml", "UTF-8")); + String senc = URLEncoder.encode(s, "UTF-8"); + String senc14 = java.net.URLEncoder.encode(s, "UTF-8"); + assertEquals(senc, senc14); + }*/ + +} diff --git a/common/src/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java b/common/src/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java new file mode 100644 index 000000000..7986fe540 --- /dev/null +++ b/common/src/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java @@ -0,0 +1,99 @@ +package test.at.gv.egovernment.moa.util; +import java.io.FileInputStream; +import java.io.InputStream; + +import org.apache.xerces.parsers.DOMParser; +import org.apache.xerces.parsers.XMLGrammarPreparser; +import org.apache.xerces.util.SymbolTable; +import org.apache.xerces.util.XMLGrammarPoolImpl; +import org.apache.xerces.xni.grammars.Grammar; +import org.apache.xerces.xni.grammars.XMLGrammarDescription; +import org.apache.xerces.xni.parser.XMLInputSource; +import org.xml.sax.InputSource; + +import test.at.gv.egovernment.moa.MOATestCase; + +import at.gv.egovernment.moa.util.Constants; + + +/** + * Experimentation with Xerces grammar caching. + * + * Used the Xerces sample 'XMLGrammarBuilder' as a starting point. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLGrammarBuilderTest extends MOATestCase { + + private static final String GRAMMAR_POOL = + org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX + + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; + + protected static final String NAMESPACES_FEATURE_ID = + "http://xml.org/sax/features/namespaces"; + protected static final String VALIDATION_FEATURE_ID = + "http://xml.org/sax/features/validation"; + protected static final String SCHEMA_VALIDATION_FEATURE_ID = + "http://apache.org/xml/features/validation/schema"; + protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID = + "http://apache.org/xml/features/validation/schema-full-checking"; + + private static final int BIG_PRIME = 2039; + private SymbolTable symbolTable; + private XMLGrammarPoolImpl grammarPool; + + /** + * Constructor for XMLGrammarBuilderTest. + * @param name + */ + public XMLGrammarBuilderTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + XMLGrammarPreparser preparser; + + // set up symbol table and grammar pool + symbolTable = new SymbolTable(BIG_PRIME); + grammarPool = new XMLGrammarPoolImpl(); + preparser = new XMLGrammarPreparser(symbolTable); + preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); + preparser.setProperty(GRAMMAR_POOL, grammarPool); + preparser.setFeature(NAMESPACES_FEATURE_ID, true); + preparser.setFeature(VALIDATION_FEATURE_ID, true); + // now we can still do schema features just in case, + // so long as it's our configuraiton...... + preparser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); + preparseSchemaResource( + preparser, + Constants.DSIG_SCHEMA_LOCATION, + "/resources/schemas/xmldsig-core-schema.xsd"); + } + + private static Grammar preparseSchemaResource( + XMLGrammarPreparser preparser, + String systemId, + String resource) + throws Exception { + + InputStream is = XMLGrammarBuilderTest.class.getResourceAsStream(resource); + return preparser.preparseGrammar( + XMLGrammarDescription.XML_SCHEMA, + new XMLInputSource(null, systemId, null, is, null)); + } + + public void testParseValidating() throws Exception { + DOMParser parser = new DOMParser(symbolTable, grammarPool); + + parser.setFeature(NAMESPACES_FEATURE_ID, true); + parser.setFeature(VALIDATION_FEATURE_ID, true); + parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); + + parser.parse( + new InputSource( + new FileInputStream(TESTDATA_ROOT + "xml/dsigTransform/base64.xml"))); + parser.getDocument(); + } + +} diff --git a/common/src/test/at/gv/egovernment/moa/util/XPathUtilsTest.java b/common/src/test/at/gv/egovernment/moa/util/XPathUtilsTest.java new file mode 100644 index 000000000..559494300 --- /dev/null +++ b/common/src/test/at/gv/egovernment/moa/util/XPathUtilsTest.java @@ -0,0 +1,51 @@ +package test.at.gv.egovernment.moa.util; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; + +import test.at.gv.egovernment.moa.MOATestCase; + +import at.gv.egovernment.moa.util.XPathUtils; + + +/** + * @author Patrick Peck + * @version $Id$ + */ +public class XPathUtilsTest extends MOATestCase { + + private Document doc1; + + /** + * Constructor for XPathUtilsTest. + * @param name + */ + public XPathUtilsTest(String name) { + super(name); + } + + /** + * @see TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + doc1 = + parseXml(TESTDATA_ROOT + "xml/VerifyXMLSignature/Req000.xml"); + } + + public void testSelectNodeList() throws Exception { + NodeList nodes; + + nodes = + XPathUtils.selectNodeList( + doc1.getDocumentElement(), + doc1.getDocumentElement(), + "/VerifyXMLSignatureRequest"); + assertEquals(1, nodes.getLength()); + nodes = + XPathUtils.selectNodeList( + doc1.getDocumentElement(), + "//dsig:Signature"); + assertEquals(1, nodes.getLength()); + } + +} -- cgit v1.2.3 From b1f795dce3d7a371e018c4933423ccd00ef74eab Mon Sep 17 00:00:00 2001 From: rudolf Date: Mon, 20 Oct 2003 14:46:06 +0000 Subject: added lockPool method git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@16 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/DOMUtils.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index 6da99037e..8e6394445 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -89,6 +89,10 @@ public class DOMUtils { private static SymbolTable symbolTable = new SymbolTable(BIG_PRIME); /** Xerces schema grammar pool. */ private static XMLGrammarPool grammarPool = new XMLGrammarPoolImpl(); + + static { + grammarPool.lockPool(); + } /** * Preparse a schema and add it to the schema pool. -- cgit v1.2.3 From 69561539a64141e5ed23c4d042fc0c00a17c2bef Mon Sep 17 00:00:00 2001 From: gregor Date: Fri, 7 Nov 2003 17:58:36 +0000 Subject: Bug 19 behoben. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@41 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Constants.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index 681bed55b..df7c843d1 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -215,4 +215,19 @@ public interface Constants { /** URI of the Exclusive Canonical XML with commments algorithm */ public static final String EXC_C14N_WITH_COMMENTS_URI = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"; + + // + // Local names for elements of the MOA SPSS schema + // + + /** + * Local name of request for creating an XML signature. + */ + public static final String MOA_SPSS_CREATE_XML_REQUEST = "CreateXMLSignatureRequest"; + + /** + * Local name of request for verifying an XML signature. + */ + public static final String MOA_SPSS_VERIFY_XML_REQUEST = "VerifiyXMLSignatureRequest"; + } -- cgit v1.2.3 From bc620256eb9b4dc6a33244b1105e58773358dbe6 Mon Sep 17 00:00:00 2001 From: gregor Date: Tue, 11 Nov 2003 22:12:44 +0000 Subject: Feature 41 implementiert. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@50 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Constants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index df7c843d1..77a830c76 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -19,7 +19,7 @@ public interface Constants { /** Local location of the MOA XML schema definition. */ public static final String MOA_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-1.1.xsd"; + SCHEMA_ROOT + "MOA-SPSS-1.2.xsd"; /** URI of the MOA configuration XML namespace. */ public static final String MOA_CONFIG_NS_URI = -- cgit v1.2.3 From 55e33b147723d68223f31994125b6364cb808bb1 Mon Sep 17 00:00:00 2001 From: rudolf Date: Mon, 1 Dec 2003 10:42:06 +0000 Subject: added makeAbsoluteURI (RSCH) git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@66 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/FileUtils.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/FileUtils.java b/common/src/at/gv/egovernment/moa/util/FileUtils.java index f8941568d..bb21f4ca0 100644 --- a/common/src/at/gv/egovernment/moa/util/FileUtils.java +++ b/common/src/at/gv/egovernment/moa/util/FileUtils.java @@ -4,6 +4,8 @@ import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; /** @@ -84,4 +86,26 @@ public class FileUtils { byte[] content = readResource(name); return new String(content, encoding); } + + /** + * Returns the absolute URL of a given url which is relative to the parameter root + * @param url + * @param root + * @return String + */ + public static String makeAbsoluteURL(String url, String root) { + //if url is relative to rootConfigFileDirName make it absolute + try { + if(null == url) return null; + URI uri = new URI(url); + if (!uri.isAbsolute()) { // make it absolute to the config file + uri = new URI(root + url); + } + return uri.toString(); + } catch (URISyntaxException e) { + //if url string could not be converted to absolute URL return source url + return url; + } + } + } -- cgit v1.2.3 From 98bbfa11070a62956d7e2663a82f19fd048d1d5e Mon Sep 17 00:00:00 2001 From: rudolf Date: Thu, 18 Dec 2003 19:19:09 +0000 Subject: MOAIdentities wird von XMLLoginParameterResolver verwendet git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@77 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/FileUtils.java | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/FileUtils.java b/common/src/at/gv/egovernment/moa/util/FileUtils.java index bb21f4ca0..ae8d83834 100644 --- a/common/src/at/gv/egovernment/moa/util/FileUtils.java +++ b/common/src/at/gv/egovernment/moa/util/FileUtils.java @@ -1,11 +1,10 @@ package at.gv.egovernment.moa.util; import java.io.BufferedInputStream; +import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; import java.net.URL; /** @@ -95,17 +94,19 @@ public class FileUtils { */ public static String makeAbsoluteURL(String url, String root) { //if url is relative to rootConfigFileDirName make it absolute - try { - if(null == url) return null; - URI uri = new URI(url); - if (!uri.isAbsolute()) { // make it absolute to the config file - uri = new URI(root + url); - } - return uri.toString(); - } catch (URISyntaxException e) { - //if url string could not be converted to absolute URL return source url - return url; - } + + File keyFile; + String newURL = url; + + if(null == url) return null; + + // check if absolute - if not make it absolute + keyFile = new File(url); + if (!keyFile.isAbsolute()) { + keyFile = new File(root, url); + newURL = keyFile.getPath(); + } + return newURL; } } -- cgit v1.2.3 From 658ddc1007c023784353ee97cfc21fb886b00979 Mon Sep 17 00:00:00 2001 From: rudolf Date: Tue, 16 Mar 2004 11:24:11 +0000 Subject: update to v 1.2 of schema of MOA-ID-Configuration git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@102 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Constants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index 77a830c76..cf703eb7c 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -41,7 +41,7 @@ public interface Constants { /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.1.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.2.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = -- cgit v1.2.3 From 86b51fd16f65996db588ee4a20bfda177b2dcd2e Mon Sep 17 00:00:00 2001 From: rudolf Date: Mon, 26 Apr 2004 12:45:31 +0000 Subject: =?UTF-8?q?Namensraum=20f=C3=BCr=20XMLLoginParameterResolver=20hin?= =?UTF-8?q?zugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@105 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Constants.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index cf703eb7c..e63dbf015 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -164,7 +164,7 @@ public interface Constants { /** URI of the Exclusive Canonicalization XML namespace */ public static final String DSIG_EC_NS_URI = "http://www.w3.org/2001/10/xml-exc-c14n#"; - + /** Prefix used for the Exclusive Canonicalization XML namespace */ public static final String DSIG_EC_PREFIX = "ec"; @@ -172,6 +172,14 @@ public interface Constants { public static final String DSIG_EC_SCHEMA_LOCATION = SCHEMA_ROOT + "exclusive-canonicalization.xsd"; + /** URI of the XMLLoginParameterResolver Configuration XML namespace */ + public static final String XMLLPR_NS_URI="http://reference.e-government.gv.at/namespace/moa/20020822#/xmllpr20030814"; + + /** Local location of the XMLLoginParameterResolver Configuration XML schema definition */ + public static final String XMLLPR_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOAIdentities.xsd"; + + /** * Contains all namespaces and local schema locations for XML schema * definitions relevant for MOA. For use in validating XML parsers. @@ -190,7 +198,8 @@ public interface Constants { + (XSI_NS_URI + " " + XSI_SCHEMA_LOCATION + " ") + (DSIG_NS_URI + " " + DSIG_SCHEMA_LOCATION + " ") + (DSIG_FILTER2_NS_URI + " " + DSIG_FILTER2_SCHEMA_LOCATION + " ") - + (DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION); + + (DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION + " ") + + (XMLLPR_NS_URI + " " + XMLLPR_SCHEMA_LOCATION); /** Security Layer manifest type URI. */ public static final String SL_MANIFEST_TYPE_URI = -- cgit v1.2.3 From 6f2b4760a460ad3eeedbd5b475d7ecbfdc77179c Mon Sep 17 00:00:00 2001 From: rudolf Date: Mon, 26 Apr 2004 12:47:06 +0000 Subject: =?UTF-8?q?Debug=20logging=20des=20Dokuments=20im=20Falle=20einer?= =?UTF-8?q?=20SAXException=20wurde=20hinzugef=C3=BCgt=20(RSCH)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@106 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/DOMUtils.java | 82 ++++++++++++++-------- 1 file changed, 52 insertions(+), 30 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index 8e6394445..f44804927 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -41,6 +41,8 @@ import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; +import at.gv.egovernment.moa.logging.Logger; + /** * Various utility functions for handling XML DOM trees. * @@ -154,10 +156,22 @@ public class DOMUtils { String externalNoNamespaceSchemaLocation, EntityResolver entityResolver, ErrorHandler errorHandler) - throws SAXException, IOException, ParserConfigurationException { + throws SAXException, IOException, ParserConfigurationException { DOMParser parser; + + + //if Debug is enabled make a copy of inputStream to enable debug output in case of SAXException + byte buffer [] = null; + ByteArrayInputStream baStream = null; + if(true == Logger.isDebugEnabled()) { + int len = inputStream.available(); + buffer = new byte[len]; + inputStream.read(buffer); + baStream = new ByteArrayInputStream(buffer); + } + // create the DOM parser if (symbolTable != null) { parser = new DOMParser(symbolTable, grammarPool); @@ -166,36 +180,44 @@ public class DOMUtils { } // set parser features and properties - parser.setFeature(NAMESPACES_FEATURE, true); - parser.setFeature(VALIDATION_FEATURE, validating); - parser.setFeature(SCHEMA_VALIDATION_FEATURE, validating); - parser.setFeature(NORMALIZED_VALUE_FEATURE, false); - parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); - parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); - - if (validating) { - if (externalSchemaLocations != null) { - parser.setProperty( - EXTERNAL_SCHEMA_LOCATION_PROPERTY, - externalSchemaLocations); - } - if (externalNoNamespaceSchemaLocation != null) { - parser.setProperty( - EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, - externalNoNamespaceSchemaLocation); - } - } - - // set entity resolver and error handler - if (entityResolver != null) { - parser.setEntityResolver(entityResolver); + try { + parser.setFeature(NAMESPACES_FEATURE, true); + parser.setFeature(VALIDATION_FEATURE, validating); + parser.setFeature(SCHEMA_VALIDATION_FEATURE, validating); + parser.setFeature(NORMALIZED_VALUE_FEATURE, false); + parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); + parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); + + if (validating) { + if (externalSchemaLocations != null) { + parser.setProperty( + EXTERNAL_SCHEMA_LOCATION_PROPERTY, + externalSchemaLocations); + } + if (externalNoNamespaceSchemaLocation != null) { + parser.setProperty( + EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, + externalNoNamespaceSchemaLocation); + } + } + + // set entity resolver and error handler + if (entityResolver != null) { + parser.setEntityResolver(entityResolver); + } + if (errorHandler != null) { + parser.setErrorHandler(errorHandler); + } + + // parse the document and return it + parser.parse(new InputSource(baStream)); + } catch(SAXException e) { + if(true == Logger.isDebugEnabled() && null != buffer) { + String xmlContent = new String(buffer); + Logger.debug("SAXException in:\n" + xmlContent); + throw(e); + } } - if (errorHandler != null) { - parser.setErrorHandler(errorHandler); - } - - // parse the document and return it - parser.parse(new InputSource(inputStream)); return parser.getDocument(); } -- cgit v1.2.3 From 77f701b92244538afafc4a2df77169ee07b61388 Mon Sep 17 00:00:00 2001 From: rudolf Date: Mon, 26 Apr 2004 12:47:58 +0000 Subject: Diverse Utilfunktionen zur Ausgabe von XML Dokumenten in Dateien (RSCH) git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@107 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../at/gv/egovernment/moa/util/OutputXML2File.java | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 common/src/at/gv/egovernment/moa/util/OutputXML2File.java (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/OutputXML2File.java b/common/src/at/gv/egovernment/moa/util/OutputXML2File.java new file mode 100644 index 000000000..f9d330d41 --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/OutputXML2File.java @@ -0,0 +1,78 @@ +/* + * Created on 26.04.2004 + * + * @author rschamberger + * $ID$ + */ +package at.gv.egovernment.moa.util; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.logging.Logger; + +/** + * utility functions to write XML data to files + * @author rschamberger + * @version $Id$ + */ +public class OutputXML2File { + + /** + * writes an XML structure to file if debug is enabled in hierarchy (Encoding: UTF-8) + * + * @param filename file name + * @param rootElem root element in DOM tree + * @param hierarchy of the Logger + */ + public static void debugOutputXML2File(String filename, Element rootElem, String hierarchy) { + if (Logger.isDebugEnabled(hierarchy)) { + outputXML2File(filename, rootElem); + } + } + + /** + * writes an XML structure to file if debug is enabled in hierarchy (Encoding: UTF-8) + * + * @param filename file name + * @param xmlString XML string + * @param hierarchy of the Logger + */ + public static void debugOutputXML2File(String filename, String xmlString, String hierarchy) { + if (Logger.isDebugEnabled(hierarchy)) { + outputXML2File(filename, xmlString); + } + } + + /** + * writes an XML structure to file (Encoding: UTF-8) + * + * @param filename file name + * @param rootElem root element in DOM tree + */ + public static void outputXML2File(String filename, Element rootElem) { + try { + String xmlString = new String(DOMUtils.serializeNode(rootElem)); + outputXML2File(filename, xmlString); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + /** + * writes an XML structure to file (Encoding: UTF-8) + * + * @param filename file name + * @param xmlString XML string + */ + public static void outputXML2File(String filename, String xmlString) { + try { + java.io.OutputStream fout = new java.io.FileOutputStream(filename); + byte[] xmlData = xmlString.getBytes("UTF-8"); + fout.write(xmlData); + fout.close(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + +} -- cgit v1.2.3 From 2c72f5741e7b2a5338b41a40ee42d05ffe63f3e3 Mon Sep 17 00:00:00 2001 From: rudolf Date: Thu, 24 Jun 2004 18:31:51 +0000 Subject: fixed MalformedURLException (RSCH) git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@134 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/DOMUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index f44804927..f0e7768be 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -210,7 +210,11 @@ public class DOMUtils { } // parse the document and return it - parser.parse(new InputSource(baStream)); + // if debug is enabled: use copy of strem (baStream) else use orig stream + if(null != baStream) + parser.parse(new InputSource(baStream)); + else + parser.parse(new InputSource(inputStream)); } catch(SAXException e) { if(true == Logger.isDebugEnabled() && null != buffer) { String xmlContent = new String(buffer); -- cgit v1.2.3 From 8620f68d1d5f60b97b961f8e1691bd33e3ce0c5b Mon Sep 17 00:00:00 2001 From: gregor Date: Thu, 1 Jul 2004 13:20:12 +0000 Subject: =?UTF-8?q?Methode=20getStackTraceAsString=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@148 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/StreamUtils.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/StreamUtils.java b/common/src/at/gv/egovernment/moa/util/StreamUtils.java index 88db24504..a22f1c2a8 100644 --- a/common/src/at/gv/egovernment/moa/util/StreamUtils.java +++ b/common/src/at/gv/egovernment/moa/util/StreamUtils.java @@ -3,6 +3,7 @@ package at.gv.egovernment.moa.util; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.PrintStream; /** * Utility methods for streams. @@ -112,5 +113,16 @@ public class StreamUtils { in.close(); return out.toString(encoding); } - + + /** + * Gets the stack trace of the Throwable passed in as a string. + * @param t The Throwable. + * @return a String representing the stack trace of the Throwable. + */ + public static String getStackTraceAsString(Throwable t) + { + ByteArrayOutputStream stackTraceBIS = new ByteArrayOutputStream(); + t.printStackTrace(new PrintStream(stackTraceBIS)); + return new String(stackTraceBIS.toByteArray()); + } } -- cgit v1.2.3 From ca508dd0091a1e3736a6b98543996a47cc6a1835 Mon Sep 17 00:00:00 2001 From: gregor Date: Tue, 18 Jan 2005 11:06:28 +0000 Subject: =?UTF-8?q?Unterst=C3=BCtzung=20des=20aktuellen=20NS=20f=C3=BCr=20?= =?UTF-8?q?ECDSA-XML-Strukturen=20(dsig-more=20statt=20buergerkarte).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@220 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Constants.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index e63dbf015..0d8f19064 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -67,7 +67,15 @@ public interface Constants { /** URI of the ECDSA XML namespace */ public static final String ECDSA_NS_URI = + "http://www.w3.org/2001/04/xmldsig-more#"; + + /** Ancient URI for the ECDSA XML namespace **/ + public static final String ECDSA_NS_URI_ANCIENT = "http://www.buergerkarte.at/namespaces/ecdsa/200206030#"; + + /** Wrong URI for the ECDSA XML namespace, used by the ZMR **/ + public static final String ECDSA_NS_URI_WRONG = // TODO Entfernen, sobald ZMR umgestellt hat + "http://www.w3.org/2004/01/xmldsig-more#"; /** Prefix used for ECDSA namespace */ public static final String ECDSA_PREFIX = "ecdsa"; @@ -76,6 +84,14 @@ public interface Constants { public static final String ECDSA_SCHEMA_LOCATION = SCHEMA_ROOT + "ECDSAKeyValue.xsd"; + /** Local location of ECDSA XML schema definition (ancient version) */ + public static final String ECDSA_SCHEMA_LOCATION_ANCIENT = + SCHEMA_ROOT + "ECDSAKeyValue.ancient.xsd"; + + /** Local location of ECDSA XML schema definition (wrong ZMR version) */ + public static final String ECDSA_SCHEMA_LOCATION_WRONG = + SCHEMA_ROOT + "ECDSAKeyValue.wrong.xsd"; + /** URI of the PersonData XML namespace. */ public static final String PD_NS_URI = "http://reference.e-government.gv.at/namespace/persondata/20020228#"; -- cgit v1.2.3 From fcbbccd3c79d31bc853918353c5dc156bc5370bc Mon Sep 17 00:00:00 2001 From: gregor Date: Tue, 18 Jan 2005 14:34:37 +0000 Subject: =?UTF-8?q?Unterst=C3=BCtzung=20des=20aktuellen,=20des=20historisc?= =?UTF-8?q?hen,=20sowie=20des=20falschen=20ZMR-NS=20f=C3=BCr=20ECDSA=20XML?= =?UTF-8?q?=20eingebaut.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@225 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Constants.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index 0d8f19064..edab2b41e 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -207,6 +207,8 @@ public interface Constants { + (SL10_NS_URI + " " + SL10_SCHEMA_LOCATION + " ") + (SL11_NS_URI + " " + SL11_SCHEMA_LOCATION + " ") + (ECDSA_NS_URI + " " + ECDSA_SCHEMA_LOCATION + " ") + + (ECDSA_NS_URI_ANCIENT + " " + ECDSA_SCHEMA_LOCATION_ANCIENT + " ") + + (ECDSA_NS_URI_WRONG + " " + ECDSA_SCHEMA_LOCATION_WRONG + " ") // TODO Entfernen, sobald ZMR umgestellt hat + (PD_NS_URI + " " + PD_SCHEMA_LOCATION + " ") + (SAML_NS_URI + " " + SAML_SCHEMA_LOCATION + " ") + (SAMLP_NS_URI + " " + SAMLP_SCHEMA_LOCATION + " ") -- cgit v1.2.3 From ea8c4f9b5564ac201fffc8f3e0b0c6b71defa6ed Mon Sep 17 00:00:00 2001 From: rudolf Date: Fri, 21 Jan 2005 17:56:18 +0000 Subject: Inserted HashMap used for namespace prefix to NS mapping git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@234 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Constants.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index edab2b41e..48b633b94 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -1,5 +1,7 @@ package at.gv.egovernment.moa.util; +import java.util.HashMap; + /** * Contains various constants used throughout the system. * @@ -256,5 +258,10 @@ public interface Constants { * Local name of request for verifying an XML signature. */ public static final String MOA_SPSS_VERIFY_XML_REQUEST = "VerifiyXMLSignatureRequest"; - + + /** + * A map used to map namespace prefixes to namespace URIs + */ + public static HashMap nSMap = new HashMap(5); + } -- cgit v1.2.3 From fa8fbee356922b9445c2773b011e141bad7ea4ad Mon Sep 17 00:00:00 2001 From: gregor Date: Thu, 3 Feb 2005 09:15:45 +0000 Subject: Bug 220 korrigiert. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@271 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/DOMUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index f0e7768be..53b1a0e48 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -219,8 +219,8 @@ public class DOMUtils { if(true == Logger.isDebugEnabled() && null != buffer) { String xmlContent = new String(buffer); Logger.debug("SAXException in:\n" + xmlContent); - throw(e); } + throw(e); } return parser.getDocument(); -- cgit v1.2.3 From d040b091d0e8556a536978fe830e5db7695e5bef Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Fri, 22 Jul 2005 16:07:10 +0000 Subject: updated for MAO WID (wbPK) git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@400 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/Constants.java | 35 ++++++++++++++++++++-- .../src/at/gv/egovernment/moa/util/DOMUtils.java | 22 ++++++++++++++ .../src/at/gv/egovernment/moa/util/XPathUtils.java | 1 + 3 files changed, 56 insertions(+), 2 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index 48b633b94..99fe81065 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -43,7 +43,7 @@ public interface Constants { /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.2.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.3.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = @@ -66,7 +66,18 @@ public interface Constants { /** Local location of the Security Layer 1.1 XML schema definition */ public static final String SL11_SCHEMA_LOCATION = SCHEMA_ROOT + "Core.20020831.xsd"; + + /** URI of the Security Layer 1.2 XML namespace */ + public static final String SL12_NS_URI = + "http://www.buergerkarte.at/namespaces/securitylayer/1.2#"; + + /** Prefix used for the Security Layer 1.2 XML namespace */ + public static final String SL12_PREFIX = "sl"; + /** Local location of the Security Layer 1.2 XML schema definition */ + public static final String SL12_SCHEMA_LOCATION = + SCHEMA_ROOT + "Core-1.2.xsd"; + /** URI of the ECDSA XML namespace */ public static final String ECDSA_NS_URI = "http://www.w3.org/2001/04/xmldsig-more#"; @@ -101,9 +112,13 @@ public interface Constants { /** Prefix used for the PersonData XML namespace */ public static final String PD_PREFIX = "pr"; +// /** Local location of the PersonData XML schema definition */ +// public static final String PD_SCHEMA_LOCATION = +// SCHEMA_ROOT + "PersonData.xsd"; + /** Local location of the PersonData XML schema definition */ public static final String PD_SCHEMA_LOCATION = - SCHEMA_ROOT + "PersonData.xsd"; + SCHEMA_ROOT + "PersonData_20_en.xsd"; /** URI of the SAML namespace. */ public static final String SAML_NS_URI = @@ -208,6 +223,7 @@ public interface Constants { + (MOA_ID_CONFIG_NS_URI + " " + MOA_ID_CONFIG_SCHEMA_LOCATION + " ") + (SL10_NS_URI + " " + SL10_SCHEMA_LOCATION + " ") + (SL11_NS_URI + " " + SL11_SCHEMA_LOCATION + " ") + + (SL12_NS_URI + " " + SL12_SCHEMA_LOCATION + " ") + (ECDSA_NS_URI + " " + ECDSA_SCHEMA_LOCATION + " ") + (ECDSA_NS_URI_ANCIENT + " " + ECDSA_SCHEMA_LOCATION_ANCIENT + " ") + (ECDSA_NS_URI_WRONG + " " + ECDSA_SCHEMA_LOCATION_WRONG + " ") // TODO Entfernen, sobald ZMR umgestellt hat @@ -221,6 +237,21 @@ public interface Constants { + (DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION + " ") + (XMLLPR_NS_URI + " " + XMLLPR_SCHEMA_LOCATION); + /** URN prefix for bPK and wbPK. */ + public static final String URN_PREFIX = "urn:publicid:gv.at"; + + /** URN prefix for context dependent id. */ + public static final String URN_PREFIX_CDID = URN_PREFIX + ":cdid"; + + /** URN prefix for context dependent id (bPK). */ + public static final String URN_PREFIX_BPK = URN_PREFIX_CDID + "+bpk"; + + /** URN prefix for context dependent id (wbPK). */ + public static final String URN_PREFIX_WBPK = URN_PREFIX + ":wbpk"; + + /** URN prefix for context dependent id. */ + public static final String URN_PREFIX_BASEID = URN_PREFIX + ":baseid"; + /** Security Layer manifest type URI. */ public static final String SL_MANIFEST_TYPE_URI = "http://www.buergerkarte.at/specifications/Security-Layer/20020225#SignatureManifest"; diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index 53b1a0e48..52f6554d5 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -41,6 +41,7 @@ import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; + import at.gv.egovernment.moa.logging.Logger; /** @@ -832,5 +833,26 @@ public class DOMUtils { } return false; } + + /** + * Selects the (first) element from a node list and returns it. + * + * @param nl The NodeList to get the element from. + * @return The (first) element included in the node list or null + * if the node list is null or empty or no element is + * included in the list. + */ + public static Element getElementFromNodeList (NodeList nl) { + if ((nl == null) || (nl.getLength() == 0)) { + return null; + } + for (int i=0; i Date: Fri, 22 Jul 2005 16:07:32 +0000 Subject: added for MOA-WID (wbPK) git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@401 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../at/gv/egovernment/moa/util/StringUtils.java | 148 +++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 common/src/at/gv/egovernment/moa/util/StringUtils.java (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/StringUtils.java b/common/src/at/gv/egovernment/moa/util/StringUtils.java new file mode 100644 index 000000000..0ad5c515c --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/StringUtils.java @@ -0,0 +1,148 @@ +// Copyright (C) 2002 IAIK +// email: jce-info@iaik.tu-graz.ac.at +// +// All rights reserved. +// +// This source is provided for inspection purposes and recompilation only, +// unless specified differently in a contract with IAIK. This source has to +// be kept in strict confidence and must not be disclosed to any third party +// under any circumstances. Redistribution in source and binary forms, with +// or without modification, are permitted in any case! +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// + +package at.gv.egovernment.moa.util; + +import java.util.StringTokenizer; + +/** + * Utitility functions for string manipulations. + * + * @author Harald Bratko + */ +public class StringUtils { + + /** + * Removes all blanks and tabs from the given string. + * + * @param s The string to remove all blanks and tabs from. + * @return The input string with all blanks and tabs removed from. + */ + public static String removeBlanks(String s) { + StringTokenizer st = new StringTokenizer(s); + StringBuffer sb = new StringBuffer(s.length()); + while (st.hasMoreTokens()) { + sb.append(st.nextToken()); + } + return sb.toString(); + } + + /** + * Removes all occurences of the specified token from the the given string. + * + * @param s The string to remove all occurences of the specified token from. + * @return The input string with all occurences of the specified token removed from. + */ + public static String removeToken(String s, String token) { + StringTokenizer st = new StringTokenizer(s, token); + StringBuffer sb = new StringBuffer(s.length()); + while (st.hasMoreTokens()) { + sb.append(st.nextToken()); + } + return sb.toString(); + } + + /** + * Removes all leading zeros from the input string. + * + * @param s The string remove the leading zeros from. + * @return The input string with the leading zeros removed from. + */ + public static String deleteLeadingZeros(String s) { + StringBuffer sb = new StringBuffer(s); + int l = sb.length(); + int j = 0; + for (int i=0; is that matches the given + * search string by the given replace string. + * + * @param s The string where the replacment should take place. + * @param search The pattern that should be replaced. + * @param replace The string that should replace all each search + * string within s. + * @return A string whrer all occurrence of search are + * replaced with replace. + */ + public static String replaceAll (String s, String search, String replace) + { + StringBuffer sb = new StringBuffer(); + int i = 0, j = 0; + int len = search.length(); + while (j > -1) + { + j = s.indexOf(search, i); + + if (j > -1) + { + sb.append(s.substring(i,j)); + sb.append(replace); + i = j + len; + } + } + + sb.append(s.substring(i, s.length())); + + return sb.toString(); + } + + /** + * Changes the SecurityLayer version in the given string. + * This method usually takes as input an XML structure represented in a string + * format and changes the SecurityLayer namespaces prefixes and URIs from + * one SecurityLayer version to another. + * e.g.: code>sl10 to sl and + * http://www.buergerkarte.at/namespaces/securitylayer/20020225# + * to + * http://www.buergerkarte.at/namespaces/securitylayer/1.2# + * + * @param s The string (usally an XML structure) where the + * SecurityLayer version should be changed. + * @param slPrefixOld The SecurityLayer namespace prefix that should be + * replaced by the new one. + * @param slPrefixNew The new SecurityLayer namespace prefix that should + * replace the old one. + * @param slNSUriOld The SecurityLayer namespace URI that should be + * replaced by the new one. + * @param slNSUriNew The new SecurityLayer namespace URI that should + * replace the old one. + * @return A string where the SecurityLayer namespace prefixes + * and URIs are replaced by new ones. + */ + public static String changeSLVersion(String s, String slPrefixOld, String slPrefixNew, String slNSUriOld, String slNSUriNew) { + String retString = replaceAll(s, slPrefixOld, slPrefixNew); + retString = replaceAll(retString, slNSUriOld, slNSUriNew); + return retString ; + } + +} -- cgit v1.2.3 From 4246bab1caa15f15929fc36983641024dd9417fc Mon Sep 17 00:00:00 2001 From: gregor Date: Tue, 26 Jul 2005 20:18:41 +0000 Subject: =?UTF-8?q?Neue=20Namen=20der=20Schemata=20f=C3=BCr=20Konfiguratio?= =?UTF-8?q?n=20und=20XML-Schnittstelle=20ber=C3=BCcksichtigt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@410 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Constants.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index 99fe81065..c3379ae0e 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -21,7 +21,7 @@ public interface Constants { /** Local location of the MOA XML schema definition. */ public static final String MOA_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-1.2.xsd"; + SCHEMA_ROOT + "MOA-SPSS-1.3.xsd"; /** URI of the MOA configuration XML namespace. */ public static final String MOA_CONFIG_NS_URI = @@ -39,7 +39,7 @@ public interface Constants { /** Local location of the MOA configuration XML schema definition. */ public static final String MOA_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-Configuration-1.0.xsd"; + SCHEMA_ROOT + "MOA-SPSS-config-1.3.xsd"; /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = -- cgit v1.2.3 From 17f18fc9749c4f3a4b74a2103500bbd549de1160 Mon Sep 17 00:00:00 2001 From: rudolf Date: Thu, 11 Aug 2005 08:30:11 +0000 Subject: WRONG and ANCIENT ECDSA Schema NS wurde entfernt git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@431 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Constants.java | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index c3379ae0e..bae811c41 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -82,14 +82,6 @@ public interface Constants { public static final String ECDSA_NS_URI = "http://www.w3.org/2001/04/xmldsig-more#"; - /** Ancient URI for the ECDSA XML namespace **/ - public static final String ECDSA_NS_URI_ANCIENT = - "http://www.buergerkarte.at/namespaces/ecdsa/200206030#"; - - /** Wrong URI for the ECDSA XML namespace, used by the ZMR **/ - public static final String ECDSA_NS_URI_WRONG = // TODO Entfernen, sobald ZMR umgestellt hat - "http://www.w3.org/2004/01/xmldsig-more#"; - /** Prefix used for ECDSA namespace */ public static final String ECDSA_PREFIX = "ecdsa"; @@ -97,14 +89,6 @@ public interface Constants { public static final String ECDSA_SCHEMA_LOCATION = SCHEMA_ROOT + "ECDSAKeyValue.xsd"; - /** Local location of ECDSA XML schema definition (ancient version) */ - public static final String ECDSA_SCHEMA_LOCATION_ANCIENT = - SCHEMA_ROOT + "ECDSAKeyValue.ancient.xsd"; - - /** Local location of ECDSA XML schema definition (wrong ZMR version) */ - public static final String ECDSA_SCHEMA_LOCATION_WRONG = - SCHEMA_ROOT + "ECDSAKeyValue.wrong.xsd"; - /** URI of the PersonData XML namespace. */ public static final String PD_NS_URI = "http://reference.e-government.gv.at/namespace/persondata/20020228#"; @@ -225,8 +209,6 @@ public interface Constants { + (SL11_NS_URI + " " + SL11_SCHEMA_LOCATION + " ") + (SL12_NS_URI + " " + SL12_SCHEMA_LOCATION + " ") + (ECDSA_NS_URI + " " + ECDSA_SCHEMA_LOCATION + " ") - + (ECDSA_NS_URI_ANCIENT + " " + ECDSA_SCHEMA_LOCATION_ANCIENT + " ") - + (ECDSA_NS_URI_WRONG + " " + ECDSA_SCHEMA_LOCATION_WRONG + " ") // TODO Entfernen, sobald ZMR umgestellt hat + (PD_NS_URI + " " + PD_SCHEMA_LOCATION + " ") + (SAML_NS_URI + " " + SAML_SCHEMA_LOCATION + " ") + (SAMLP_NS_URI + " " + SAMLP_SCHEMA_LOCATION + " ") -- cgit v1.2.3 From 9c5b6686313cdaffa018f8048f0d751f11fc8c26 Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Fri, 12 Aug 2005 13:00:53 +0000 Subject: Added methods for retrieving SecurityLayer prefixes. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@440 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/XPathUtils.java | 105 +++++++++++++++++++++ 1 file changed, 105 insertions(+) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/XPathUtils.java b/common/src/at/gv/egovernment/moa/util/XPathUtils.java index 4ee160476..aa5a4fec5 100644 --- a/common/src/at/gv/egovernment/moa/util/XPathUtils.java +++ b/common/src/at/gv/egovernment/moa/util/XPathUtils.java @@ -412,5 +412,110 @@ public class XPathUtils { Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath); return attr != null ? attr.getValue() : def; } + + /** + * Return the SecurityLayer namespace prefix of the context element. + * If the context element has no prefix explicitely set (i.e. is specified + * within the default namespace), the method sets the prefix + * according to the value of the xmlns attribute of the context + * element. + * The returned prefix is needed for evaluating XPATH expressions. + * + * @param contextElement The element to get a prefix from. + * + * @return The string sl10, sl11 or sl, + * depending on the SecurityLayer namespace of the contextElement. + * + * throws XpathException If the element has no prefix or no valid SecurityLayer + * namespace is used as default namespace. + */ + public static String getSlPrefix (Element contextElement) throws XPathException { + String slPrefix = contextElement.getPrefix(); + if (slPrefix != null) { + return slPrefix; + } else { + String nameSpace = contextElement.getAttribute("xmlns"); + + if (nameSpace.equals(Constants.SL10_NS_URI)) { + slPrefix = Constants.SL10_PREFIX; + } else if (nameSpace.equals(Constants.SL12_NS_URI)) { + slPrefix = Constants.SL12_PREFIX; + } else if (nameSpace.equals(Constants.SL11_NS_URI)) { + slPrefix = Constants.SL11_PREFIX; + } else { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); + throw new XPathException(message, null); + + } + + return slPrefix; + } + } + + + /** + * Return the SecurityLayer namespace prefix of the context element. + * If the context element is not the element that lies within the + * SecurityLayer namespace. The Securitylayer namespace is derived from + * the xmlns:sl10, sl11 or sl + * attribute of the context element. + * + * The returned prefix is needed for evaluating XPATH expressions. + * + * @param contextElement The element to get a prefix for the Securitylayer namespace, + * that is used within the corresponding document. + * + * @return The string sl10, sl11 or sl, + * depending on the SecurityLayer namespace of the contextElement. + * + * throws XPathException If no (vlalid) SecurityLayer namespace prefix or namespace + * is defined. + */ + public static String getSlPrefixFromNoRoot (Element contextElement) throws XPathException { + + String slPrefix = checkSLnsDeclaration(contextElement, Constants.SL10_PREFIX, Constants.SL10_NS_URI); + if (slPrefix == null) { + slPrefix = checkSLnsDeclaration(contextElement, Constants.SL11_PREFIX, Constants.SL11_NS_URI); + } + if (slPrefix == null) { + slPrefix = checkSLnsDeclaration(contextElement, Constants.SL12_PREFIX, Constants.SL12_NS_URI); + } + + return slPrefix; + + } + + /** + * Checks if the context element has an attribute xmlns:slPrefix and + * if the prefix of that attribute corresponds with a valid SecurityLayer namespace. + * + * @param contextElement The element to be checked. + * @param slPrefix The prefix which should be checked. Must be a valid SecurityLayer + * namespace prefix. + * @param slNameSpace The SecurityLayer namespace that corresponds to the specified prefix. + * + * @return The valid SecurityLayer prefix or null if this prefix is + * not used. + * @throws XPathException + */ + private static String checkSLnsDeclaration(Element contextElement, String slPrefix, String slNameSpace) + throws XPathException + { + String nsAtt = "xmlns:" + slPrefix; + String nameSpace = contextElement.getAttribute(nsAtt); + if (nameSpace == "") { + return null; + } else { + // check if namespace is correct + if (nameSpace.equals(slNameSpace)) { + return slPrefix; + } else { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); + throw new XPathException(message, null); + } + } + } } -- cgit v1.2.3 From 6fb182ea445c864219cf15aabffe9c299a9ddc4b Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Fri, 2 Sep 2005 10:12:25 +0000 Subject: Changed name of person data schema. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@475 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Constants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index bae811c41..e0c287c8d 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -102,7 +102,7 @@ public interface Constants { /** Local location of the PersonData XML schema definition */ public static final String PD_SCHEMA_LOCATION = - SCHEMA_ROOT + "PersonData_20_en.xsd"; + SCHEMA_ROOT + "PersonData_20_en_moaWID.xsd"; /** URI of the SAML namespace. */ public static final String SAML_NS_URI = -- cgit v1.2.3 From 6551ddb13f38b3d96719f5c21f10da6ff80d5d13 Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Fri, 2 Sep 2005 10:13:32 +0000 Subject: Added method for retrieving child elments of an element. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@476 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/DOMUtils.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index 52f6554d5..fddf16944 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -7,8 +7,10 @@ import java.io.InputStream; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; +import java.util.Vector; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -854,5 +856,26 @@ public class DOMUtils { } return null; } + + /** + * Returns all child elements of the given element. + * + * @param parent The element to get the child elements from. + * + * @return A list including all child elements of the given element. + * Maybe empty if the parent element has no child elements. + */ + public static List getChildElements (Element parent) { + Vector v = new Vector(); + NodeList nl = parent.getChildNodes(); + int length = nl.getLength(); + for (int i=0; i < length; i++) { + Node node = nl.item(i); + if (node.getNodeType() == Node.ELEMENT_NODE) { + v.add((Element)node); + } + } + return v; + } } -- cgit v1.2.3 From d37622fc03b7be66998c8855104fe31c5b21f4a0 Mon Sep 17 00:00:00 2001 From: rudolf Date: Thu, 22 Sep 2005 10:33:19 +0000 Subject: Mergen von MOA-VV Constants mit bisher bestehenden Constants git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@515 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/Constants.java | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index e0c287c8d..0b441d95c 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -12,10 +12,45 @@ public interface Constants { /** Root location of the schema files. */ public static final String SCHEMA_ROOT = "/resources/schemas/"; + /** URI of the Widerrufregister XML namespace. */ + public static final String WRR_NS_URI = + "http://reference.e-government.gv.at/namespace/moavv/20041223"; + + /** Prefix used for the Widerrufregister XML namespace */ + public static final String WRR_PREFIX = "wrr"; + + /** URI of the StandardTextBlock XML namespace. */ + public static final String STB_NS_URI = + "http://reference.e-government.gv.at/namespace/standardtextblock/20041105#"; + + /** Prefix used for the Mandate XML namespace */ + public static final String STB_PREFIX = "stb"; + /** URI of the MOA XML namespace. */ public static final String MOA_NS_URI = "http://reference.e-government.gv.at/namespace/moa/20020822#"; + /** Prefix used for the Mandate XML namespace */ + public static final String MD_PREFIX = "md"; + + /** URI of the Mandate XML namespace. */ + public static final String MD_NS_URI = + "http://reference.e-government.gv.at/namespace/mandates/20040701#"; + + /** Prefix used for the Mandate XML namespace */ + public static final String MVV_PREFIX = "mvv"; + + /** URI of the Mandate XML namespace. */ + public static final String MVV_NS_URI = + "http://reference.e-government.gv.at/namespace/moavv/app2mvv/20041125"; + + /** Prefix used for the MandateCheckProfile XML namespace */ + public static final String MDP_PREFIX = "mdp"; + + /** URI of the Mandate XML namespace. */ + public static final String MDP_NS_URI = + "http://reference.e-government.gv.at/namespace/mandateprofile/20041105#"; + /** Prefix used for the MOA XML namespace */ public static final String MOA_PREFIX = "moa"; -- cgit v1.2.3 From be0e139b0e57606477ffe09b4e8169c65e3a3701 Mon Sep 17 00:00:00 2001 From: rudolf Date: Thu, 22 Sep 2005 10:41:49 +0000 Subject: Mergen von MOA-VV Code mit bisher bestehendem Code git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@516 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/XPathUtils.java | 111 +-------------------- 1 file changed, 5 insertions(+), 106 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/XPathUtils.java b/common/src/at/gv/egovernment/moa/util/XPathUtils.java index aa5a4fec5..83000d346 100644 --- a/common/src/at/gv/egovernment/moa/util/XPathUtils.java +++ b/common/src/at/gv/egovernment/moa/util/XPathUtils.java @@ -45,7 +45,6 @@ public class XPathUtils { Constants.MOA_ID_CONFIG_NS_URI); ctx.addNamespace(Constants.SL10_PREFIX, Constants.SL10_NS_URI); ctx.addNamespace(Constants.SL11_PREFIX, Constants.SL11_NS_URI); - ctx.addNamespace(Constants.SL12_PREFIX, Constants.SL12_NS_URI); ctx.addNamespace(Constants.ECDSA_PREFIX, Constants.ECDSA_NS_URI); ctx.addNamespace(Constants.PD_PREFIX, Constants.PD_NS_URI); ctx.addNamespace(Constants.SAML_PREFIX, Constants.SAML_NS_URI); @@ -57,6 +56,11 @@ public class XPathUtils { Constants.DSIG_FILTER2_PREFIX, Constants.DSIG_FILTER2_NS_URI); ctx.addNamespace(Constants.DSIG_EC_PREFIX, Constants.DSIG_EC_NS_URI); + ctx.addNamespace(Constants.MD_PREFIX, Constants.MD_NS_URI); + ctx.addNamespace(Constants.MDP_PREFIX, Constants.MDP_NS_URI); + ctx.addNamespace(Constants.MVV_PREFIX, Constants.MVV_NS_URI); + ctx.addNamespace(Constants.STB_PREFIX, Constants.STB_NS_URI); + ctx.addNamespace(Constants.WRR_PREFIX, Constants.WRR_NS_URI); NS_CONTEXT = ctx; } @@ -412,110 +416,5 @@ public class XPathUtils { Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath); return attr != null ? attr.getValue() : def; } - - /** - * Return the SecurityLayer namespace prefix of the context element. - * If the context element has no prefix explicitely set (i.e. is specified - * within the default namespace), the method sets the prefix - * according to the value of the xmlns attribute of the context - * element. - * The returned prefix is needed for evaluating XPATH expressions. - * - * @param contextElement The element to get a prefix from. - * - * @return The string sl10, sl11 or sl, - * depending on the SecurityLayer namespace of the contextElement. - * - * throws XpathException If the element has no prefix or no valid SecurityLayer - * namespace is used as default namespace. - */ - public static String getSlPrefix (Element contextElement) throws XPathException { - String slPrefix = contextElement.getPrefix(); - if (slPrefix != null) { - return slPrefix; - } else { - String nameSpace = contextElement.getAttribute("xmlns"); - - if (nameSpace.equals(Constants.SL10_NS_URI)) { - slPrefix = Constants.SL10_PREFIX; - } else if (nameSpace.equals(Constants.SL12_NS_URI)) { - slPrefix = Constants.SL12_PREFIX; - } else if (nameSpace.equals(Constants.SL11_NS_URI)) { - slPrefix = Constants.SL11_PREFIX; - } else { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); - throw new XPathException(message, null); - - } - - return slPrefix; - } - } - - - /** - * Return the SecurityLayer namespace prefix of the context element. - * If the context element is not the element that lies within the - * SecurityLayer namespace. The Securitylayer namespace is derived from - * the xmlns:sl10, sl11 or sl - * attribute of the context element. - * - * The returned prefix is needed for evaluating XPATH expressions. - * - * @param contextElement The element to get a prefix for the Securitylayer namespace, - * that is used within the corresponding document. - * - * @return The string sl10, sl11 or sl, - * depending on the SecurityLayer namespace of the contextElement. - * - * throws XPathException If no (vlalid) SecurityLayer namespace prefix or namespace - * is defined. - */ - public static String getSlPrefixFromNoRoot (Element contextElement) throws XPathException { - - String slPrefix = checkSLnsDeclaration(contextElement, Constants.SL10_PREFIX, Constants.SL10_NS_URI); - if (slPrefix == null) { - slPrefix = checkSLnsDeclaration(contextElement, Constants.SL11_PREFIX, Constants.SL11_NS_URI); - } - if (slPrefix == null) { - slPrefix = checkSLnsDeclaration(contextElement, Constants.SL12_PREFIX, Constants.SL12_NS_URI); - } - - return slPrefix; - - } - - /** - * Checks if the context element has an attribute xmlns:slPrefix and - * if the prefix of that attribute corresponds with a valid SecurityLayer namespace. - * - * @param contextElement The element to be checked. - * @param slPrefix The prefix which should be checked. Must be a valid SecurityLayer - * namespace prefix. - * @param slNameSpace The SecurityLayer namespace that corresponds to the specified prefix. - * - * @return The valid SecurityLayer prefix or null if this prefix is - * not used. - * @throws XPathException - */ - private static String checkSLnsDeclaration(Element contextElement, String slPrefix, String slNameSpace) - throws XPathException - { - String nsAtt = "xmlns:" + slPrefix; - String nameSpace = contextElement.getAttribute(nsAtt); - if (nameSpace == "") { - return null; - } else { - // check if namespace is correct - if (nameSpace.equals(slNameSpace)) { - return slPrefix; - } else { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); - throw new XPathException(message, null); - } - } - } } -- cgit v1.2.3 From 881ab81aad02923f57bca84dfaa4509abf706cd8 Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Thu, 29 Sep 2005 08:19:16 +0000 Subject: Obviously SL12-prefix and methods for selecting sl-prefix has been removed? Added them again. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@519 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/XPathUtils.java | 106 +++++++++++++++++++++ 1 file changed, 106 insertions(+) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/XPathUtils.java b/common/src/at/gv/egovernment/moa/util/XPathUtils.java index 83000d346..7c412567a 100644 --- a/common/src/at/gv/egovernment/moa/util/XPathUtils.java +++ b/common/src/at/gv/egovernment/moa/util/XPathUtils.java @@ -45,6 +45,7 @@ public class XPathUtils { Constants.MOA_ID_CONFIG_NS_URI); ctx.addNamespace(Constants.SL10_PREFIX, Constants.SL10_NS_URI); ctx.addNamespace(Constants.SL11_PREFIX, Constants.SL11_NS_URI); + ctx.addNamespace(Constants.SL12_PREFIX, Constants.SL12_NS_URI); ctx.addNamespace(Constants.ECDSA_PREFIX, Constants.ECDSA_NS_URI); ctx.addNamespace(Constants.PD_PREFIX, Constants.PD_NS_URI); ctx.addNamespace(Constants.SAML_PREFIX, Constants.SAML_NS_URI); @@ -416,5 +417,110 @@ public class XPathUtils { Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath); return attr != null ? attr.getValue() : def; } + + /** + * Return the SecurityLayer namespace prefix of the context element. + * If the context element has no prefix explicitely set (i.e. is specified + * within the default namespace), the method sets the prefix + * according to the value of the xmlns attribute of the context + * element. + * The returned prefix is needed for evaluating XPATH expressions. + * + * @param contextElement The element to get a prefix from. + * + * @return The string sl10, sl11 or sl, + * depending on the SecurityLayer namespace of the contextElement. + * + * throws XpathException If the element has no prefix or no valid SecurityLayer + * namespace is used as default namespace. + */ + public static String getSlPrefix (Element contextElement) throws XPathException { + String slPrefix = contextElement.getPrefix(); + if (slPrefix != null) { + return slPrefix; + } else { + String nameSpace = contextElement.getAttribute("xmlns"); + + if (nameSpace.equals(Constants.SL10_NS_URI)) { + slPrefix = Constants.SL10_PREFIX; + } else if (nameSpace.equals(Constants.SL12_NS_URI)) { + slPrefix = Constants.SL12_PREFIX; + } else if (nameSpace.equals(Constants.SL11_NS_URI)) { + slPrefix = Constants.SL11_PREFIX; + } else { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); + throw new XPathException(message, null); + + } + + return slPrefix; + } + } + + + /** + * Return the SecurityLayer namespace prefix of the context element. + * If the context element is not the element that lies within the + * SecurityLayer namespace. The Securitylayer namespace is derived from + * the xmlns:sl10, sl11 or sl + * attribute of the context element. + * + * The returned prefix is needed for evaluating XPATH expressions. + * + * @param contextElement The element to get a prefix for the Securitylayer namespace, + * that is used within the corresponding document. + * + * @return The string sl10, sl11 or sl, + * depending on the SecurityLayer namespace of the contextElement. + * + * throws XPathException If no (vlalid) SecurityLayer namespace prefix or namespace + * is defined. + */ + public static String getSlPrefixFromNoRoot (Element contextElement) throws XPathException { + + String slPrefix = checkSLnsDeclaration(contextElement, Constants.SL10_PREFIX, Constants.SL10_NS_URI); + if (slPrefix == null) { + slPrefix = checkSLnsDeclaration(contextElement, Constants.SL11_PREFIX, Constants.SL11_NS_URI); + } + if (slPrefix == null) { + slPrefix = checkSLnsDeclaration(contextElement, Constants.SL12_PREFIX, Constants.SL12_NS_URI); + } + + return slPrefix; + + } + + /** + * Checks if the context element has an attribute xmlns:slPrefix and + * if the prefix of that attribute corresponds with a valid SecurityLayer namespace. + * + * @param contextElement The element to be checked. + * @param slPrefix The prefix which should be checked. Must be a valid SecurityLayer + * namespace prefix. + * @param slNameSpace The SecurityLayer namespace that corresponds to the specified prefix. + * + * @return The valid SecurityLayer prefix or null if this prefix is + * not used. + * @throws XPathException + */ + private static String checkSLnsDeclaration(Element contextElement, String slPrefix, String slNameSpace) + throws XPathException + { + String nsAtt = "xmlns:" + slPrefix; + String nameSpace = contextElement.getAttribute(nsAtt); + if (nameSpace == "") { + return null; + } else { + // check if namespace is correct + if (nameSpace.equals(slNameSpace)) { + return slPrefix; + } else { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); + throw new XPathException(message, null); + } + } + } } -- cgit v1.2.3 From 38016074b0dc2c15caf1478f50c2a77d7d312534 Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Wed, 7 Dec 2005 14:19:06 +0000 Subject: changed "enum" varianle name, because it is a keyword since jdk1.5 git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@607 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common/src') diff --git a/common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java b/common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java index 06a72c570..a6d1847ce 100644 --- a/common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java +++ b/common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java @@ -81,8 +81,8 @@ public class KeyStoreUtilsTest extends TestCase { String keyStoreURL = "file:data/test/security/client-certs/sicher-demo(buergerkarte).p12"; KeyStore ks = KeyStoreUtils.loadKeyStore("pkcs12", keyStoreURL, "buergerkarte"); assertEquals(1, ks.size()); - Enumeration enum = ks.aliases(); - String alias = (String)enum.nextElement(); + Enumeration aliases = ks.aliases(); + String alias = (String)aliases.nextElement(); X509Certificate cert = (X509Certificate)ks.getCertificate(alias); assertEquals(new BigInteger("1044289238331").intValue(), cert.getSerialNumber().intValue()); } -- cgit v1.2.3 From 0eb787866e2818c65eca76dd070771e809f9bdd2 Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Tue, 28 Feb 2006 14:03:21 +0000 Subject: method makeAbsoluteURL does not work if URL starts with a protocol like "http://" or "file://". Fixed this. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@632 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/FileUtils.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/FileUtils.java b/common/src/at/gv/egovernment/moa/util/FileUtils.java index ae8d83834..a5e777c2d 100644 --- a/common/src/at/gv/egovernment/moa/util/FileUtils.java +++ b/common/src/at/gv/egovernment/moa/util/FileUtils.java @@ -99,14 +99,18 @@ public class FileUtils { String newURL = url; if(null == url) return null; - - // check if absolute - if not make it absolute - keyFile = new File(url); - if (!keyFile.isAbsolute()) { - keyFile = new File(root, url); - newURL = keyFile.getPath(); + + if (url.startsWith("http:/") || url.startsWith("https:/") || url.startsWith("file:/") || url.startsWith("ftp:/")) { + return url; + } else { + // check if absolute - if not make it absolute + keyFile = new File(url); + if (!keyFile.isAbsolute()) { + keyFile = new File(root, url); + newURL = keyFile.getPath(); + } + return newURL; } - return newURL; } } -- cgit v1.2.3 From d28ec7c9b309325d47e3cd3a99a4ae2cba269098 Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Thu, 27 Apr 2006 13:04:16 +0000 Subject: Changed method getSLPrefix to in all cases retrieve SecurityLayer namespace from the namespace uri - and not use the actual prefix if present. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@705 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/XPathUtils.java | 50 ++++++++++------------ 1 file changed, 23 insertions(+), 27 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/XPathUtils.java b/common/src/at/gv/egovernment/moa/util/XPathUtils.java index 7c412567a..dfb14697b 100644 --- a/common/src/at/gv/egovernment/moa/util/XPathUtils.java +++ b/common/src/at/gv/egovernment/moa/util/XPathUtils.java @@ -420,10 +420,14 @@ public class XPathUtils { /** * Return the SecurityLayer namespace prefix of the context element. - * If the context element has no prefix explicitely set (i.e. is specified - * within the default namespace), the method sets the prefix - * according to the value of the xmlns attribute of the context - * element. + * The method sets the prefix according to the value of the + * namespace URI of the context element: + *

    + *
  • "http://www.buergerkarte.at/namespaces/securitylayer/20020225#" = "sl10"
  • + *
  • "http://www.buergerkarte.at/namespaces/securitylayer/20020831#" = "sl11"
  • + *
  • "http://www.buergerkarte.at/namespaces/securitylayer/1.2# = "sl"
  • + *
      + * * The returned prefix is needed for evaluating XPATH expressions. * * @param contextElement The element to get a prefix from. @@ -431,34 +435,26 @@ public class XPathUtils { * @return The string sl10, sl11 or sl, * depending on the SecurityLayer namespace of the contextElement. * - * throws XpathException If the element has no prefix or no valid SecurityLayer - * namespace is used as default namespace. - */ + * throws XpathException If namespace of context element is not a valid + * SecurityLayer namespace. + */ public static String getSlPrefix (Element contextElement) throws XPathException { - String slPrefix = contextElement.getPrefix(); - if (slPrefix != null) { - return slPrefix; + String slPrefix; + String nameSpace = contextElement.getNamespaceURI(); + if (nameSpace.equals(Constants.SL10_NS_URI)) { + slPrefix = Constants.SL10_PREFIX; + } else if (nameSpace.equals(Constants.SL12_NS_URI)) { + slPrefix = Constants.SL12_PREFIX; + } else if (nameSpace.equals(Constants.SL11_NS_URI)) { + slPrefix = Constants.SL11_PREFIX; } else { - String nameSpace = contextElement.getAttribute("xmlns"); - - if (nameSpace.equals(Constants.SL10_NS_URI)) { - slPrefix = Constants.SL10_PREFIX; - } else if (nameSpace.equals(Constants.SL12_NS_URI)) { - slPrefix = Constants.SL12_PREFIX; - } else if (nameSpace.equals(Constants.SL11_NS_URI)) { - slPrefix = Constants.SL11_PREFIX; - } else { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); - throw new XPathException(message, null); - - } - - return slPrefix; + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); + throw new XPathException(message, null); } + return slPrefix; } - /** * Return the SecurityLayer namespace prefix of the context element. * If the context element is not the element that lies within the -- cgit v1.2.3 From 8f9c297d7673600ace4e71619dbf33fb7e90ce75 Mon Sep 17 00:00:00 2001 From: gregor Date: Wed, 6 Dec 2006 07:33:30 +0000 Subject: Siehe Bug 321. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@736 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/XPathUtils.java | 74 ++++++++++++---------- 1 file changed, 39 insertions(+), 35 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/XPathUtils.java b/common/src/at/gv/egovernment/moa/util/XPathUtils.java index dfb14697b..bfd91542c 100644 --- a/common/src/at/gv/egovernment/moa/util/XPathUtils.java +++ b/common/src/at/gv/egovernment/moa/util/XPathUtils.java @@ -40,9 +40,7 @@ public class XPathUtils { SimpleNamespaceContext ctx = new SimpleNamespaceContext(); ctx.addNamespace(Constants.MOA_PREFIX, Constants.MOA_NS_URI); ctx.addNamespace(Constants.MOA_CONFIG_PREFIX, Constants.MOA_CONFIG_NS_URI); - ctx.addNamespace( - Constants.MOA_ID_CONFIG_PREFIX, - Constants.MOA_ID_CONFIG_NS_URI); + ctx.addNamespace(Constants.MOA_ID_CONFIG_PREFIX, Constants.MOA_ID_CONFIG_NS_URI); ctx.addNamespace(Constants.SL10_PREFIX, Constants.SL10_NS_URI); ctx.addNamespace(Constants.SL11_PREFIX, Constants.SL11_NS_URI); ctx.addNamespace(Constants.SL12_PREFIX, Constants.SL12_NS_URI); @@ -53,9 +51,7 @@ public class XPathUtils { ctx.addNamespace(Constants.DSIG_PREFIX, Constants.DSIG_NS_URI); ctx.addNamespace(Constants.XSLT_PREFIX, Constants.XSLT_NS_URI); ctx.addNamespace(Constants.XSI_PREFIX, Constants.XSI_NS_URI); - ctx.addNamespace( - Constants.DSIG_FILTER2_PREFIX, - Constants.DSIG_FILTER2_NS_URI); + ctx.addNamespace(Constants.DSIG_FILTER2_PREFIX, Constants.DSIG_FILTER2_NS_URI); ctx.addNamespace(Constants.DSIG_EC_PREFIX, Constants.DSIG_EC_NS_URI); ctx.addNamespace(Constants.MD_PREFIX, Constants.MD_NS_URI); ctx.addNamespace(Constants.MDP_PREFIX, Constants.MDP_NS_URI); @@ -419,42 +415,50 @@ public class XPathUtils { } /** - * Return the SecurityLayer namespace prefix of the context element. - * The method sets the prefix according to the value of the - * namespace URI of the context element: - *
        - *
      • "http://www.buergerkarte.at/namespaces/securitylayer/20020225#" = "sl10"
      • - *
      • "http://www.buergerkarte.at/namespaces/securitylayer/20020831#" = "sl11"
      • - *
      • "http://www.buergerkarte.at/namespaces/securitylayer/1.2# = "sl"
      • - *
          + * Returns the namespace prefix used within XPathUtils for referring to + * the namespace of the specified (Security Layer command) element. * - * The returned prefix is needed for evaluating XPATH expressions. + * This namespace prefix can be used in various XPath expression evaluation methods + * within XPathUtils without explicitely binding it to the particular + * namespace. * - * @param contextElement The element to get a prefix from. + * @param contextElement The (Security Layer command) element. * - * @return The string sl10, sl11 or sl, - * depending on the SecurityLayer namespace of the contextElement. + * @return the namespace prefix used within XPathUtils for referring to + * the namespace of the specified (Security Layer command) element. * - * throws XpathException If namespace of context element is not a valid - * SecurityLayer namespace. - */ - public static String getSlPrefix (Element contextElement) throws XPathException { - String slPrefix; - String nameSpace = contextElement.getNamespaceURI(); - if (nameSpace.equals(Constants.SL10_NS_URI)) { - slPrefix = Constants.SL10_PREFIX; - } else if (nameSpace.equals(Constants.SL12_NS_URI)) { - slPrefix = Constants.SL12_PREFIX; - } else if (nameSpace.equals(Constants.SL11_NS_URI)) { - slPrefix = Constants.SL11_PREFIX; - } else { + * throws XpathException If the specified element has a namespace other than the ones + * known by this implementation as valid Security Layer namespaces (cf. + * @link Constants#SL10_NS_URI, @link Constants#SL11_NS_URI, @link Constants#SL12_NS_URI). + */ + public static String getSlPrefix (Element contextElement) throws XPathException + { + String sLNamespace = contextElement.getNamespaceURI(); + String sLPrefix = null; + + if (sLNamespace.equals(Constants.SL10_NS_URI)) + { + sLPrefix = Constants.SL10_PREFIX; + } + else if (sLNamespace.equals(Constants.SL11_NS_URI)) + { + sLPrefix = Constants.SL11_PREFIX; + } + else if (sLNamespace.equals(Constants.SL12_NS_URI)) + { + sLPrefix = Constants.SL12_PREFIX; + } + else + { MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); - throw new XPathException(message, null); - } - return slPrefix; + String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger Security Layer Namespace: \"" + sLNamespace + "\"."}); + throw new XPathException(message, null); + } + + return sLPrefix; } + /** * Return the SecurityLayer namespace prefix of the context element. * If the context element is not the element that lies within the -- cgit v1.2.3 From 71fc9643626231aaa0478ed2483e24c5f5738f68 Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Wed, 10 Jan 2007 15:16:12 +0000 Subject: Constants for MOA-ID 1.4 git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@760 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Constants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index 0b441d95c..23a4e7913 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -78,7 +78,7 @@ public interface Constants { /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.3.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.4.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = -- cgit v1.2.3 From aec4ccc911516648497d5edcdfdebc228dd0b025 Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Wed, 10 Jan 2007 15:17:22 +0000 Subject: Moved method removeXMLDeclaration (multiple occurrences) to StringUtils. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@761 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/StringUtils.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/StringUtils.java b/common/src/at/gv/egovernment/moa/util/StringUtils.java index 0ad5c515c..61b1a18ea 100644 --- a/common/src/at/gv/egovernment/moa/util/StringUtils.java +++ b/common/src/at/gv/egovernment/moa/util/StringUtils.java @@ -145,4 +145,20 @@ public class StringUtils { return retString ; } + /** + * Removes the XML declaration from an XML expression. + * + * @param xmlString XML expression as String + * + * @return XML expression, XML declaration removed + */ + public static String removeXMLDeclaration(String xmlString) { + if (xmlString.startsWith(" Date: Wed, 10 Jan 2007 15:27:23 +0000 Subject: Changed order of processing namespaces, because reponses from BKU are usually in sl10 or sl12-namespace. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@762 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/XPathUtils.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/XPathUtils.java b/common/src/at/gv/egovernment/moa/util/XPathUtils.java index bfd91542c..5212ed13e 100644 --- a/common/src/at/gv/egovernment/moa/util/XPathUtils.java +++ b/common/src/at/gv/egovernment/moa/util/XPathUtils.java @@ -439,14 +439,14 @@ public class XPathUtils { if (sLNamespace.equals(Constants.SL10_NS_URI)) { sLPrefix = Constants.SL10_PREFIX; - } - else if (sLNamespace.equals(Constants.SL11_NS_URI)) - { - sLPrefix = Constants.SL11_PREFIX; - } + } else if (sLNamespace.equals(Constants.SL12_NS_URI)) { sLPrefix = Constants.SL12_PREFIX; + } + else if (sLNamespace.equals(Constants.SL11_NS_URI)) + { + sLPrefix = Constants.SL11_PREFIX; } else { -- cgit v1.2.3 From c70b998681967198391c31c576c8feebad767301 Mon Sep 17 00:00:00 2001 From: "peter.danner" Date: Fri, 2 Feb 2007 00:29:31 +0000 Subject: HPI Identifikation als Alternative zu wbPK im businessService-Modus git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@804 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Constants.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java index 23a4e7913..5c1314296 100644 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/at/gv/egovernment/moa/util/Constants.java @@ -262,7 +262,10 @@ public interface Constants { /** URN prefix for context dependent id (bPK). */ public static final String URN_PREFIX_BPK = URN_PREFIX_CDID + "+bpk"; - + + /** URN prefix for context dependent id (HPI). */ + public static final String URN_PREFIX_HPI = URN_PREFIX_CDID + "+EHSP"; + /** URN prefix for context dependent id (wbPK). */ public static final String URN_PREFIX_WBPK = URN_PREFIX + ":wbpk"; -- cgit v1.2.3 From 0f7722cb0b88ab50b0e4ff22f492afae74c474b9 Mon Sep 17 00:00:00 2001 From: "peter.danner" Date: Wed, 2 May 2007 13:45:19 +0000 Subject: Added Map, that holds the NamespaceURIs of the grammarPool, to prevent multiple entries of one NamespaceURI git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@825 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/DOMUtils.java | 41 +++++++++++++--------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index fddf16944..95ee3aa4d 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -94,9 +94,13 @@ public class DOMUtils { private static SymbolTable symbolTable = new SymbolTable(BIG_PRIME); /** Xerces schema grammar pool. */ private static XMLGrammarPool grammarPool = new XMLGrammarPoolImpl(); - + /** Map, that holds the NamespaceURIs of the grammarPool, to prevent multiple + * entries of one NamespaceURI */ + private static Set grammarNamespaces; + static { grammarPool.lockPool(); + grammarNamespaces = new HashSet(); } /** @@ -111,23 +115,28 @@ public class DOMUtils { throws IOException { XMLGrammarPreparser preparser; - // unlock the pool so that we can add another grammar - grammarPool.unlockPool(); - - // prepare the preparser - preparser = new XMLGrammarPreparser(symbolTable); - preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); - preparser.setProperty(GRAMMAR_POOL, grammarPool); - preparser.setFeature(NAMESPACES_FEATURE, true); - preparser.setFeature(VALIDATION_FEATURE, true); + if (!grammarNamespaces.contains(systemId)) { - // add the grammar to the pool - preparser.preparseGrammar( + grammarNamespaces.add(systemId); + + // unlock the pool so that we can add another grammar + grammarPool.unlockPool(); + + // prepare the preparser + preparser = new XMLGrammarPreparser(symbolTable); + preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); + preparser.setProperty(GRAMMAR_POOL, grammarPool); + preparser.setFeature(NAMESPACES_FEATURE, true); + preparser.setFeature(VALIDATION_FEATURE, true); + + // add the grammar to the pool + preparser.preparseGrammar( XMLGrammarDescription.XML_SCHEMA, - new XMLInputSource(null, systemId, null, inputStream, null)); - - // lock the pool again so that schemas are not added automatically - grammarPool.lockPool(); + new XMLInputSource(null, systemId, null, inputStream, null)); + + // lock the pool again so that schemas are not added automatically + grammarPool.lockPool(); + } } /** -- cgit v1.2.3 From c6e511bd07688229e6ae0b333f60c79240e77de8 Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Fri, 4 May 2007 14:36:22 +0000 Subject: JavaDoc. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@839 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/DOMUtils.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index 95ee3aa4d..f94c8f6ff 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -94,8 +94,8 @@ public class DOMUtils { private static SymbolTable symbolTable = new SymbolTable(BIG_PRIME); /** Xerces schema grammar pool. */ private static XMLGrammarPool grammarPool = new XMLGrammarPoolImpl(); - /** Map, that holds the NamespaceURIs of the grammarPool, to prevent multiple - * entries of one NamespaceURI */ + /** Set holding the NamespaceURIs of the grammarPool, to prevent multiple + * entries of same grammars to the pool */ private static Set grammarNamespaces; static { @@ -105,10 +105,12 @@ public class DOMUtils { /** * Preparse a schema and add it to the schema pool. + * The method only adds the schema to the pool if a schema having the same + * systemId (namespace URI) is not already present in the pool. * * @param inputStream An InputStream providing the contents of * the schema. - * @param systemId The systemId to use for the schema. + * @param systemId The systemId (namespace URI) to use for the schema. * @throws IOException An error occurred reading the schema. */ public static void addSchemaToPool(InputStream inputStream, String systemId) -- cgit v1.2.3 From db86329d1cec19bcd98afe58c2810951c87e12b2 Mon Sep 17 00:00:00 2001 From: "peter.danner" Date: Fri, 27 Jul 2007 09:31:59 +0000 Subject: Extended serializing with the ability to omit the xml declaration git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@852 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/DOMUtils.java | 40 +++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index f94c8f6ff..d2e5e2195 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -443,7 +443,26 @@ public class DOMUtils { */ public static String serializeNode(Node node) throws TransformerException, IOException { - return new String(serializeNode(node, "UTF-8"), "UTF-8"); + return new String(serializeNode(node, "UTF-8", false), "UTF-8"); + } + + + /** + * Serialize the given DOM node. + * + * The node will be serialized using the UTF-8 encoding. + * + * @param node The node to serialize. + * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. + * @return String The String representation of the given DOM + * node. + * @throws TransformerException An error occurred transforming the + * node to a String. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static String serializeNode(Node node, boolean omitXmlDeclaration) + throws TransformerException, IOException { + return new String(serializeNode(node, "UTF-8", omitXmlDeclaration), "UTF-8"); } /** @@ -458,6 +477,23 @@ public class DOMUtils { * @throws IOException An IO error occurred writing the node to a byte array. */ public static byte[] serializeNode(Node node, String xmlEncoding) + throws TransformerException, IOException { + return serializeNode(node, xmlEncoding, false); + } + + /** + * Serialize the given DOM node to a byte array. + * + * @param node The node to serialize. + * @param xmlEncoding The XML encoding to use. + * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. + * @return The serialized node, as a byte array. Using a compatible encoding + * this can easily be converted into a String. + * @throws TransformerException An error occurred transforming the node to a + * byte array. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration) throws TransformerException, IOException { TransformerFactory transformerFactory = TransformerFactory.newInstance(); @@ -466,6 +502,8 @@ public class DOMUtils { transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.setOutputProperty(OutputKeys.ENCODING, xmlEncoding); + String omit = omitDeclaration ? "yes" : "no"; + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omit); transformer.transform(new DOMSource(node), new StreamResult(bos)); bos.flush(); -- cgit v1.2.3 From 750d033df14f7bdbf74edadb0c7bfbe0e4ec9a6a Mon Sep 17 00:00:00 2001 From: "peter.danner" Date: Tue, 31 Jul 2007 07:25:04 +0000 Subject: Fixed Javadoc git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@859 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/DOMUtils.java | 2 +- common/src/at/gv/egovernment/moa/util/SSLUtils.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index d2e5e2195..9987974aa 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -486,7 +486,7 @@ public class DOMUtils { * * @param node The node to serialize. * @param xmlEncoding The XML encoding to use. - * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. + * @param omitDeclaration The boolean value for omitting the XML Declaration. * @return The serialized node, as a byte array. Using a compatible encoding * this can easily be converted into a String. * @throws TransformerException An error occurred transforming the node to a diff --git a/common/src/at/gv/egovernment/moa/util/SSLUtils.java b/common/src/at/gv/egovernment/moa/util/SSLUtils.java index 621562e2d..d5266fb25 100644 --- a/common/src/at/gv/egovernment/moa/util/SSLUtils.java +++ b/common/src/at/gv/egovernment/moa/util/SSLUtils.java @@ -137,7 +137,6 @@ public class SSLUtils { * initialized from the given trust store. * * @param trustStore the trust store to use - * @param trustStorePassword password protecting the given trust store * @return TrustManagers to be used for creating an * SSLSocketFactory utilizing the given trust store * @throws GeneralSecurityException thrown while initializing the -- cgit v1.2.3 From dc176228408d0f57904f85f03fddd11311f67d76 Mon Sep 17 00:00:00 2001 From: "peter.danner" Date: Tue, 31 Jul 2007 12:31:12 +0000 Subject: Fixed Javadoc git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@860 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/DOMUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index 9987974aa..ac22b4310 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -717,10 +717,10 @@ public class DOMUtils { * cloned. * @throws ParserConfigurationException An error occurred creating the * DocumentFragment. - * @precondition The nodes in the node list appear in document order. - * @precondition For each Attr node in the node list, the owning Element is + * @precondition The nodes in the node list appear in document order + * @precondition for each Attr node in the node list, the owning Element is * in the node list as well. - * @precondition Each Element or Attr node in the node list is namespace + * @precondition each Element or Attr node in the node list is namespace * aware. */ public static DocumentFragment nodeList2DocumentFragment(NodeList nodeList) -- cgit v1.2.3 From dcc799b7a090d1a4e3a4f0ee1779bd86eedf7441 Mon Sep 17 00:00:00 2001 From: "peter.danner" Date: Wed, 1 Aug 2007 12:32:33 +0000 Subject: Changed encode() for serializeNode and #&13; problem. Now the (default) line break is \n instead of \r\n on Windows platforms git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@874 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/Base64Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/Base64Utils.java b/common/src/at/gv/egovernment/moa/util/Base64Utils.java index ba2c4fb0e..ad29180a6 100644 --- a/common/src/at/gv/egovernment/moa/util/Base64Utils.java +++ b/common/src/at/gv/egovernment/moa/util/Base64Utils.java @@ -92,7 +92,7 @@ public class Base64Utils { */ public static String encode(InputStream inputStream) throws IOException { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - Base64OutputStream base64Stream = new Base64OutputStream(byteStream); + Base64OutputStream base64Stream = new Base64OutputStream(byteStream, "\n".getBytes()); byte[] bytes = new byte[256]; int bytesRead; -- cgit v1.2.3 From 98bf749a15a9de6f63fc6324b9bba81dabafce95 Mon Sep 17 00:00:00 2001 From: "peter.danner" Date: Wed, 1 Aug 2007 12:34:54 +0000 Subject: Enhanced serializeNode to set the line-break charakter(s) to use with future Xerces versions git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@875 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/DOMUtils.java | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index ac22b4310..460658c5b 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -465,6 +465,25 @@ public class DOMUtils { return new String(serializeNode(node, "UTF-8", omitXmlDeclaration), "UTF-8"); } + /** + * Serialize the given DOM node. + * + * The node will be serialized using the UTF-8 encoding. + * + * @param node The node to serialize. + * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. + * @param lineSeperator Sets the line seperator String of the parser + * @return String The String representation of the given DOM + * node. + * @throws TransformerException An error occurred transforming the + * node to a String. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static String serializeNode(Node node, boolean omitXmlDeclaration, String lineSeperator) + throws TransformerException, IOException { + return new String(serializeNode(node, "UTF-8", omitXmlDeclaration, lineSeperator), "UTF-8"); + } + /** * Serialize the given DOM node to a byte array. * @@ -495,6 +514,25 @@ public class DOMUtils { */ public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration) throws TransformerException, IOException { + return serializeNode(node, xmlEncoding, false, null); + } + + + /** + * Serialize the given DOM node to a byte array. + * + * @param node The node to serialize. + * @param xmlEncoding The XML encoding to use. + * @param omitDeclaration The boolean value for omitting the XML Declaration. + * @param lineSeperator Sets the line seperator String of the parser + * @return The serialized node, as a byte array. Using a compatible encoding + * this can easily be converted into a String. + * @throws TransformerException An error occurred transforming the node to a + * byte array. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration, String lineSeperator) + throws TransformerException, IOException { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); @@ -504,6 +542,9 @@ public class DOMUtils { transformer.setOutputProperty(OutputKeys.ENCODING, xmlEncoding); String omit = omitDeclaration ? "yes" : "no"; transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omit); + if (null!=lineSeperator) { + transformer.setOutputProperty("{http://xml.apache.org/xalan}line-separator", lineSeperator);//does not work for xalan <= 2.5.1 + } transformer.transform(new DOMSource(node), new StreamResult(bos)); bos.flush(); -- cgit v1.2.3 From 75cd470f24c70af04921c7e5116a41b67a196f43 Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Wed, 1 Aug 2007 13:00:58 +0000 Subject: Updated for JDK1.4.* git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@880 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/SSLUtils.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/SSLUtils.java b/common/src/at/gv/egovernment/moa/util/SSLUtils.java index d5266fb25..ada21b412 100644 --- a/common/src/at/gv/egovernment/moa/util/SSLUtils.java +++ b/common/src/at/gv/egovernment/moa/util/SSLUtils.java @@ -4,13 +4,13 @@ import java.io.IOException; import java.io.InputStream; import java.security.GeneralSecurityException; import java.security.KeyStore; -import javax.net.ssl.SSLSocketFactory; -import com.sun.net.ssl.KeyManager; -import com.sun.net.ssl.KeyManagerFactory; -import com.sun.net.ssl.SSLContext; -import com.sun.net.ssl.TrustManager; -import com.sun.net.ssl.TrustManagerFactory; +import javax.net.ssl.KeyManager; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; /** * Utility for connecting to server applications via SSL. -- cgit v1.2.3 From 1d8298a27335f3d411dd06669ec97af11eb06ca6 Mon Sep 17 00:00:00 2001 From: "peter.danner" Date: Wed, 1 Aug 2007 16:58:58 +0000 Subject: fixed overloading of serializeNode git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@890 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/at/gv/egovernment/moa/util/DOMUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index 460658c5b..5be0bb500 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -514,7 +514,7 @@ public class DOMUtils { */ public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration) throws TransformerException, IOException { - return serializeNode(node, xmlEncoding, false, null); + return serializeNode(node, xmlEncoding, omitDeclaration, null); } -- cgit v1.2.3 From 43e57a42832ea8b4ceb0317f3c9028a4174ffa7b Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 8 Aug 2007 07:25:32 +0000 Subject: Adapted project directory structure to suit the new maven based build process. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@909 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/logging/LogMsg.java | 43 - .../src/at/gv/egovernment/moa/logging/Logger.java | 175 ---- .../gv/egovernment/moa/logging/LoggingContext.java | 46 - .../moa/logging/LoggingContextManager.java | 56 -- .../at/gv/egovernment/moa/util/Base64Utils.java | 109 --- .../src/at/gv/egovernment/moa/util/BoolUtils.java | 24 - .../gv/egovernment/moa/util/CollectionUtils.java | 36 - .../src/at/gv/egovernment/moa/util/Constants.java | 318 ------- .../src/at/gv/egovernment/moa/util/DOMUtils.java | 971 --------------------- .../at/gv/egovernment/moa/util/DateTimeUtils.java | 326 ------- .../egovernment/moa/util/EntityResolverChain.java | 52 -- .../src/at/gv/egovernment/moa/util/FileUtils.java | 116 --- .../at/gv/egovernment/moa/util/KeyStoreUtils.java | 134 --- .../gv/egovernment/moa/util/MOADefaultHandler.java | 82 -- .../gv/egovernment/moa/util/MOAEntityResolver.java | 103 --- .../gv/egovernment/moa/util/MOAErrorHandler.java | 85 -- .../src/at/gv/egovernment/moa/util/MOATimer.java | 110 --- .../gv/egovernment/moa/util/MessageProvider.java | 63 -- .../src/at/gv/egovernment/moa/util/Messages.java | 117 --- .../egovernment/moa/util/NodeIteratorAdapter.java | 87 -- .../gv/egovernment/moa/util/NodeListAdapter.java | 44 - .../at/gv/egovernment/moa/util/OutputXML2File.java | 78 -- .../egovernment/moa/util/ResourceBundleChain.java | 66 -- .../src/at/gv/egovernment/moa/util/SSLUtils.java | 221 ----- .../egovernment/moa/util/StreamEntityResolver.java | 64 -- .../at/gv/egovernment/moa/util/StreamUtils.java | 128 --- .../at/gv/egovernment/moa/util/StringUtils.java | 164 ---- .../src/at/gv/egovernment/moa/util/URLDecoder.java | 60 -- .../src/at/gv/egovernment/moa/util/URLEncoder.java | 63 -- .../at/gv/egovernment/moa/util/XPathException.java | 58 -- .../src/at/gv/egovernment/moa/util/XPathUtils.java | 526 ----------- .../java/at/gv/egovernment/moa/logging/LogMsg.java | 43 + .../java/at/gv/egovernment/moa/logging/Logger.java | 175 ++++ .../gv/egovernment/moa/logging/LoggingContext.java | 46 + .../moa/logging/LoggingContextManager.java | 56 ++ .../at/gv/egovernment/moa/util/Base64Utils.java | 109 +++ .../java/at/gv/egovernment/moa/util/BoolUtils.java | 24 + .../gv/egovernment/moa/util/CollectionUtils.java | 36 + .../java/at/gv/egovernment/moa/util/Constants.java | 318 +++++++ .../java/at/gv/egovernment/moa/util/DOMUtils.java | 971 +++++++++++++++++++++ .../at/gv/egovernment/moa/util/DateTimeUtils.java | 326 +++++++ .../egovernment/moa/util/EntityResolverChain.java | 52 ++ .../java/at/gv/egovernment/moa/util/FileUtils.java | 116 +++ .../at/gv/egovernment/moa/util/KeyStoreUtils.java | 134 +++ .../gv/egovernment/moa/util/MOADefaultHandler.java | 82 ++ .../gv/egovernment/moa/util/MOAEntityResolver.java | 103 +++ .../gv/egovernment/moa/util/MOAErrorHandler.java | 85 ++ .../java/at/gv/egovernment/moa/util/MOATimer.java | 110 +++ .../gv/egovernment/moa/util/MessageProvider.java | 63 ++ .../java/at/gv/egovernment/moa/util/Messages.java | 117 +++ .../egovernment/moa/util/NodeIteratorAdapter.java | 87 ++ .../gv/egovernment/moa/util/NodeListAdapter.java | 44 + .../at/gv/egovernment/moa/util/OutputXML2File.java | 78 ++ .../egovernment/moa/util/ResourceBundleChain.java | 66 ++ .../java/at/gv/egovernment/moa/util/SSLUtils.java | 221 +++++ .../egovernment/moa/util/StreamEntityResolver.java | 64 ++ .../at/gv/egovernment/moa/util/StreamUtils.java | 128 +++ .../at/gv/egovernment/moa/util/StringUtils.java | 164 ++++ .../at/gv/egovernment/moa/util/URLDecoder.java | 60 ++ .../at/gv/egovernment/moa/util/URLEncoder.java | 63 ++ .../at/gv/egovernment/moa/util/XPathException.java | 58 ++ .../at/gv/egovernment/moa/util/XPathUtils.java | 526 +++++++++++ .../src/test/at/gv/egovernment/moa/AllTests.java | 38 - .../test/at/gv/egovernment/moa/MOATestCase.java | 75 -- .../at/gv/egovernment/moa/util/DOMUtilsTest.java | 137 --- .../gv/egovernment/moa/util/DateTimeUtilsTest.java | 104 --- .../gv/egovernment/moa/util/KeyStoreUtilsTest.java | 90 -- .../at/gv/egovernment/moa/util/SSLUtilsTest.java | 160 ---- .../at/gv/egovernment/moa/util/URLDecoderTest.java | 29 - .../at/gv/egovernment/moa/util/URLEncoderTest.java | 43 - .../moa/util/XMLGrammarBuilderTest.java | 99 --- .../at/gv/egovernment/moa/util/XPathUtilsTest.java | 51 -- 72 files changed, 4525 insertions(+), 5351 deletions(-) delete mode 100644 common/src/at/gv/egovernment/moa/logging/LogMsg.java delete mode 100644 common/src/at/gv/egovernment/moa/logging/Logger.java delete mode 100644 common/src/at/gv/egovernment/moa/logging/LoggingContext.java delete mode 100644 common/src/at/gv/egovernment/moa/logging/LoggingContextManager.java delete mode 100644 common/src/at/gv/egovernment/moa/util/Base64Utils.java delete mode 100644 common/src/at/gv/egovernment/moa/util/BoolUtils.java delete mode 100644 common/src/at/gv/egovernment/moa/util/CollectionUtils.java delete mode 100644 common/src/at/gv/egovernment/moa/util/Constants.java delete mode 100644 common/src/at/gv/egovernment/moa/util/DOMUtils.java delete mode 100644 common/src/at/gv/egovernment/moa/util/DateTimeUtils.java delete mode 100644 common/src/at/gv/egovernment/moa/util/EntityResolverChain.java delete mode 100644 common/src/at/gv/egovernment/moa/util/FileUtils.java delete mode 100644 common/src/at/gv/egovernment/moa/util/KeyStoreUtils.java delete mode 100644 common/src/at/gv/egovernment/moa/util/MOADefaultHandler.java delete mode 100644 common/src/at/gv/egovernment/moa/util/MOAEntityResolver.java delete mode 100644 common/src/at/gv/egovernment/moa/util/MOAErrorHandler.java delete mode 100644 common/src/at/gv/egovernment/moa/util/MOATimer.java delete mode 100644 common/src/at/gv/egovernment/moa/util/MessageProvider.java delete mode 100644 common/src/at/gv/egovernment/moa/util/Messages.java delete mode 100644 common/src/at/gv/egovernment/moa/util/NodeIteratorAdapter.java delete mode 100644 common/src/at/gv/egovernment/moa/util/NodeListAdapter.java delete mode 100644 common/src/at/gv/egovernment/moa/util/OutputXML2File.java delete mode 100644 common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java delete mode 100644 common/src/at/gv/egovernment/moa/util/SSLUtils.java delete mode 100644 common/src/at/gv/egovernment/moa/util/StreamEntityResolver.java delete mode 100644 common/src/at/gv/egovernment/moa/util/StreamUtils.java delete mode 100644 common/src/at/gv/egovernment/moa/util/StringUtils.java delete mode 100644 common/src/at/gv/egovernment/moa/util/URLDecoder.java delete mode 100644 common/src/at/gv/egovernment/moa/util/URLEncoder.java delete mode 100644 common/src/at/gv/egovernment/moa/util/XPathException.java delete mode 100644 common/src/at/gv/egovernment/moa/util/XPathUtils.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/logging/Logger.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/Constants.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/Messages.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/URLDecoder.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/XPathException.java create mode 100644 common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java delete mode 100644 common/src/test/at/gv/egovernment/moa/AllTests.java delete mode 100644 common/src/test/at/gv/egovernment/moa/MOATestCase.java delete mode 100644 common/src/test/at/gv/egovernment/moa/util/DOMUtilsTest.java delete mode 100644 common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java delete mode 100644 common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java delete mode 100644 common/src/test/at/gv/egovernment/moa/util/SSLUtilsTest.java delete mode 100644 common/src/test/at/gv/egovernment/moa/util/URLDecoderTest.java delete mode 100644 common/src/test/at/gv/egovernment/moa/util/URLEncoderTest.java delete mode 100644 common/src/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java delete mode 100644 common/src/test/at/gv/egovernment/moa/util/XPathUtilsTest.java (limited to 'common/src') diff --git a/common/src/at/gv/egovernment/moa/logging/LogMsg.java b/common/src/at/gv/egovernment/moa/logging/LogMsg.java deleted file mode 100644 index 4d04fc72d..000000000 --- a/common/src/at/gv/egovernment/moa/logging/LogMsg.java +++ /dev/null @@ -1,43 +0,0 @@ -package at.gv.egovernment.moa.logging; - -/** - * A unified message type to log messages from inside the MOA subsystem. - * - * @author Patrick Peck - * @version $Id$ - */ -public class LogMsg { - /** The message to log. */ - private Object message; - - /** - * Create a LogMsg object. - * - * @param message The actual message to log. May be null. - */ - public LogMsg(Object message) { - this.message = message; - } - - /** - * Convert this log message to a String. - * - * @return The String representation of this log message. - */ - public String toString() { - StringBuffer msg = new StringBuffer(); - LoggingContext ctx = - LoggingContextManager.getInstance().getLoggingContext(); - String tid = ctx != null ? ctx.getTransactionID() : null; - String nodeId = ctx != null ? ctx.getNodeID() : null; - - msg.append("TID="); - msg.append(tid != null ? tid : ""); - msg.append(" NID="); - msg.append(nodeId != null ? nodeId : ""); - msg.append(" MSG="); - msg.append(message != null ? message.toString() : ""); - - return msg.toString(); - } -} diff --git a/common/src/at/gv/egovernment/moa/logging/Logger.java b/common/src/at/gv/egovernment/moa/logging/Logger.java deleted file mode 100644 index eb7aa5634..000000000 --- a/common/src/at/gv/egovernment/moa/logging/Logger.java +++ /dev/null @@ -1,175 +0,0 @@ -package at.gv.egovernment.moa.logging; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * A utility class acting as a facade to the logging subsystem. - * - * Configure the logging defaultHierarchy that the Logger uses by - * calling setHierarchy once before calling any of the logging - * output functions. - * - * @author Patrick Peck - * @version $Id$ - */ -public class Logger { - - /** The default logging hierarchy. */ - private static String defaultHierarchy = ""; - - /** - * Get the Log object for the default hierarchy. - * - * @return The Log object to write log messages to. - */ - private static Log getLog() { - return LogFactory.getLog(defaultHierarchy); - } - - /** - * Get the Log object for a given hierarchy. - * - * @param hierarchy The logging hierarchy for which to return the logger. - * @return The Log object to write log messages to. - */ - private static Log getLog(String hierarchy) { - return LogFactory.getLog(hierarchy); - } - - /** - * Set the default hierarchy to which the Logger should send its - * logging output. - * @param hierarchy The logging defaultHierarchy. - */ - public static void setHierarchy(String hierarchy) { - defaultHierarchy = hierarchy; - } - - /** - * Test, if the trace log level is enabled. - * - * @return boolean true, if tracing output is enabled - * false otherwise. - */ - public static boolean isTraceEnabled() { - return getLog().isTraceEnabled(); - } - - /** - * Test, if the trace log level is enabled for a given hierarchy. - * - * @param hierarchy requested log hierarchy - * @return boolean true, if tracing output is enabled - * false otherwise. - */ - public static boolean isTraceEnabled(String hierarchy) { - return getLog(hierarchy).isTraceEnabled(); - } - - /** - * Trace a message. - * - * @param message The message to trace. - */ - public static void trace(Object message) { - getLog().trace(message); - } - - /** - * Test, if the debug log level is enabled. - * - * @return boolean true, if debug output is enabled - * false otherwise. - */ - public static boolean isDebugEnabled() { - return getLog().isDebugEnabled(); - } - - /** - * Test, if the debug log level is enabled for a given hierarchy. - * - * @param hierarchy requested log hierarchy - * @return boolean true, if debug output is enabled - * false otherwise. - */ - public static boolean isDebugEnabled(String hierarchy) { - return getLog(hierarchy).isDebugEnabled(); - } - - /** - * Log a debug message. - * - * @param message The message to log. - */ - public static void debug(Object message) { - getLog().debug(message); - } - - /** - * Log an info message. - * - * @param message The message to log. - */ - public static void info(Object message) { - getLog().info(message); - } - - /** - * Log a warning message. - * - * @param message The message to log. - */ - public static void warn(Object message) { - getLog().warn(message); - } - - /** - * Log a warning message. - * - * @param message The message to log. - * @param t An exception that may be the cause of the warning. - */ - public static void warn(Object message, Throwable t) { - getLog().warn(message, t); - } - - /** - * Log an error message. - * - * @param message The message to log. - */ - public static void error(Object message) { - getLog().error(message); - } - - /** - * Log an error message. - * - * @param message The message to log. - * @param t An exception that may be the cause of the error. - */ - public static void error(Object message, Throwable t) { - getLog().error(message, t); - } - - /** - * Log a fatal error message. - * - * @param message The message to log. - */ - public static void fatal(Object message) { - getLog().fatal(message); - } - - /** - * Log a fatal error message. - * - * @param message The message to log. - * @param t An exception that may be the cause of the error. - */ - public static void fatal(Object message, Throwable t) { - getLog().fatal(message, t); - } - -} diff --git a/common/src/at/gv/egovernment/moa/logging/LoggingContext.java b/common/src/at/gv/egovernment/moa/logging/LoggingContext.java deleted file mode 100644 index 42d8db06e..000000000 --- a/common/src/at/gv/egovernment/moa/logging/LoggingContext.java +++ /dev/null @@ -1,46 +0,0 @@ -package at.gv.egovernment.moa.logging; - -/** - * Encapsulates contextual information (i.e. per request information) for - * logging purposes. - * - * @author Patrick Peck - * @version $Id$ - */ -public class LoggingContext { - /** The name of the node ID system property. */ - public static final String NODE_ID_PROPERTY = "moa.node-id"; - - /** The current transaction ID. */ - private String transactionID; - /** The node ID. */ - private String nodeID; - - /** - * Create a new LoggingContext. - * - * @param transactionID The transaction ID. May be null. - */ - public LoggingContext(String transactionID) { - this.transactionID = transactionID; - this.nodeID = System.getProperty(NODE_ID_PROPERTY); - } - - /** - * Return the transaction ID. - * - * @return The transaction ID. - */ - public String getTransactionID() { - return transactionID; - } - - /** - * Return the node ID. - * - * @return The node ID. - */ - public String getNodeID() { - return nodeID; - } -} diff --git a/common/src/at/gv/egovernment/moa/logging/LoggingContextManager.java b/common/src/at/gv/egovernment/moa/logging/LoggingContextManager.java deleted file mode 100644 index 2bbe6caa1..000000000 --- a/common/src/at/gv/egovernment/moa/logging/LoggingContextManager.java +++ /dev/null @@ -1,56 +0,0 @@ -package at.gv.egovernment.moa.logging; - -/** - * Provides each thread with a single instance of LoggingContext. - * - * @author Patrick Peck - * @version $Id$ - */ -public class LoggingContextManager { - /** The single instance of this class. */ - private static LoggingContextManager instance = null; - - /** The LoggingContext for each thread. */ - private ThreadLocal context; - - /** - * Get the single instance of the LoggingContextManager class. - * - * @return LoggingContextManager The single instance. - */ - public static synchronized LoggingContextManager getInstance() { - if (instance == null) { - instance = new LoggingContextManager(); - } - return instance; - } - - /** - * Creates a new LoggingContextManager. - * - * Protected to disallow direct instantiation. - */ - protected LoggingContextManager() { - context = new ThreadLocal(); - } - - /** - * Set the LoggingContext context for the current thread. - * - * @param ctx The LoggingContext for the current thread. - */ - public void setLoggingContext(LoggingContext ctx) { - context.set(ctx); - } - - /** - * Return the LoggingContext for the current thread. - * - * @return LoggingContext The LoggingContext for the current - * thread, or null if none has been set. - */ - public LoggingContext getLoggingContext() { - return (LoggingContext) context.get(); - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/Base64Utils.java b/common/src/at/gv/egovernment/moa/util/Base64Utils.java deleted file mode 100644 index ad29180a6..000000000 --- a/common/src/at/gv/egovernment/moa/util/Base64Utils.java +++ /dev/null @@ -1,109 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; - -import iaik.utils.Base64InputStream; -import iaik.utils.Base64OutputStream; - -/** - * Utitility functions for encoding/decoding Base64 strings. - * - * @author Patrick Peck - * @version $Id$ - */ -public class Base64Utils { - - /** - * Read the bytes encoded in a Base64 encoded String. - * - * @param base64String The String containing the Base64 encoded - * bytes. - * @param ignoreInvalidChars Whether to ignore invalid Base64 characters. - * @return byte[] The raw bytes contained in the base64String. - * @throws IOException Failed to read the Base64 data. - */ - public static byte[] decode(String base64String, boolean ignoreInvalidChars) - throws IOException { - - Base64InputStream in = - new Base64InputStream( - new ByteArrayInputStream(base64String.getBytes("UTF-8")), - ignoreInvalidChars); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - byte[] bytes = new byte[256]; - int bytesRead; - - while ((bytesRead = in.read(bytes)) > 0) { - out.write(bytes, 0, bytesRead); - } - - return out.toByteArray(); - } - - /** - * Read the bytes encoded in a Base64 encoded String and provide - * them via an InputStream. - * - * @param base64String The String containing the Base64 encoded - * bytes. - * @param ignoreInvalidChars Whether to ignore invalid Base64 characters. - * @return The InputStream from which the binary content of the - * base64String can be read. - */ - public static InputStream decodeToStream( - String base64String, - boolean ignoreInvalidChars) { - - try { - ByteArrayInputStream bin = - new ByteArrayInputStream(base64String.getBytes("UTF-8")); - Base64InputStream in = new Base64InputStream(bin, ignoreInvalidChars); - - return in; - } catch (UnsupportedEncodingException e) { - // cannot occur, since UTF-8 is required to be supported by every JRE - return null; - } - } - - /** - * Convert a byte array to a Base64 encoded String. - * - * @param bytes The bytes to encode. - * @return String The Base64 encoded representation of the bytes. - * @throws IOException Failed to write the bytes as Base64 data. - */ - public static String encode(byte[] bytes) throws IOException { - return encode(new ByteArrayInputStream(bytes)); - } - - /** - * Convert the data contained in the given stream to a Base64 encoded - * String. - * - * @param inputStream The stream containing the data to encode. - * @return The Base64 encoded data of inputStream, as a - * String. - * @throws IOException Failed to convert the data in the stream. - */ - public static String encode(InputStream inputStream) throws IOException { - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - Base64OutputStream base64Stream = new Base64OutputStream(byteStream, "\n".getBytes()); - byte[] bytes = new byte[256]; - int bytesRead; - - while ((bytesRead = inputStream.read(bytes)) > 0) { - base64Stream.write(bytes, 0, bytesRead); - } - base64Stream.flush(); - base64Stream.close(); - inputStream.close(); - - return byteStream.toString("UTF-8"); - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/BoolUtils.java b/common/src/at/gv/egovernment/moa/util/BoolUtils.java deleted file mode 100644 index fcd39b4dd..000000000 --- a/common/src/at/gv/egovernment/moa/util/BoolUtils.java +++ /dev/null @@ -1,24 +0,0 @@ -package at.gv.egovernment.moa.util; - -/** - * Utility class for parsing XML schema boolean values. - * - * @author Patrick Peck - * @version $Id$ - */ -public class BoolUtils { - - /** - * Return the boolean value of an xsd:boolean type of DOM - * element/attribute. - * - * @param boolStr The value of the xsd:boolean element/attribute. - * @return true, if boolStr equals - * "true" or "1;". Otherwise, - * false is returned. - */ - public static boolean valueOf(String boolStr) { - return "true".equals(boolStr) || "1".equals(boolStr); - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/CollectionUtils.java b/common/src/at/gv/egovernment/moa/util/CollectionUtils.java deleted file mode 100644 index 5329dcbd2..000000000 --- a/common/src/at/gv/egovernment/moa/util/CollectionUtils.java +++ /dev/null @@ -1,36 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.util.Iterator; -import java.util.List; - -/** - * Various utility methods for dealing with java.util.Collection - * classes. - * - * @author Patrick Peck - * @version $Id$ - */ -public class CollectionUtils { - - /** - * Convert a List of Number objects to an - * int array. - * - * @param nums The List containing the numbers whose integer - * value to put into the result. - * @return The int values of the Numbers contained - * in nums. - */ - public static int[] toIntArray(List nums) { - int[] result = new int[nums.size()]; - Iterator iter; - int i; - - for (i = 0, iter = nums.iterator(); iter.hasNext(); i++) { - Number num = (Number) iter.next(); - result[i] = num.intValue(); - } - - return result; - } -} diff --git a/common/src/at/gv/egovernment/moa/util/Constants.java b/common/src/at/gv/egovernment/moa/util/Constants.java deleted file mode 100644 index 5c1314296..000000000 --- a/common/src/at/gv/egovernment/moa/util/Constants.java +++ /dev/null @@ -1,318 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.util.HashMap; - -/** - * Contains various constants used throughout the system. - * - * @author Patrick Peck - * @version $Id$ - */ -public interface Constants { - /** Root location of the schema files. */ - public static final String SCHEMA_ROOT = "/resources/schemas/"; - - /** URI of the Widerrufregister XML namespace. */ - public static final String WRR_NS_URI = - "http://reference.e-government.gv.at/namespace/moavv/20041223"; - - /** Prefix used for the Widerrufregister XML namespace */ - public static final String WRR_PREFIX = "wrr"; - - /** URI of the StandardTextBlock XML namespace. */ - public static final String STB_NS_URI = - "http://reference.e-government.gv.at/namespace/standardtextblock/20041105#"; - - /** Prefix used for the Mandate XML namespace */ - public static final String STB_PREFIX = "stb"; - - /** URI of the MOA XML namespace. */ - public static final String MOA_NS_URI = - "http://reference.e-government.gv.at/namespace/moa/20020822#"; - - /** Prefix used for the Mandate XML namespace */ - public static final String MD_PREFIX = "md"; - - /** URI of the Mandate XML namespace. */ - public static final String MD_NS_URI = - "http://reference.e-government.gv.at/namespace/mandates/20040701#"; - - /** Prefix used for the Mandate XML namespace */ - public static final String MVV_PREFIX = "mvv"; - - /** URI of the Mandate XML namespace. */ - public static final String MVV_NS_URI = - "http://reference.e-government.gv.at/namespace/moavv/app2mvv/20041125"; - - /** Prefix used for the MandateCheckProfile XML namespace */ - public static final String MDP_PREFIX = "mdp"; - - /** URI of the Mandate XML namespace. */ - public static final String MDP_NS_URI = - "http://reference.e-government.gv.at/namespace/mandateprofile/20041105#"; - - /** Prefix used for the MOA XML namespace */ - public static final String MOA_PREFIX = "moa"; - - /** Local location of the MOA XML schema definition. */ - public static final String MOA_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-1.3.xsd"; - - /** URI of the MOA configuration XML namespace. */ - public static final String MOA_CONFIG_NS_URI = - "http://reference.e-government.gv.at/namespace/moaconfig/20021122#"; - - /** URI of the MOA ID configuration XML namespace. */ - public static final String MOA_ID_CONFIG_NS_URI = - "http://www.buergerkarte.at/namespaces/moaconfig#"; - - /** Prefix used for the MOA configuration XML namespace */ - public static final String MOA_CONFIG_PREFIX = "conf"; - - /** Prefix used for the MOA configuration XML namespace */ - public static final String MOA_ID_CONFIG_PREFIX = "confID"; - - /** Local location of the MOA configuration XML schema definition. */ - public static final String MOA_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-config-1.3.xsd"; - - /** Local location of the MOA ID configuration XML schema definition. */ - public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.4.xsd"; - - /** URI of the Security Layer 1.0 namespace. */ - public static final String SL10_NS_URI = - "http://www.buergerkarte.at/namespaces/securitylayer/20020225#"; - - /** Prefix used for the Security Layer 1.0 XML namespace */ - public static final String SL10_PREFIX = "sl10"; - - /** Local location of the Security Layer 1.0 XML schema definition */ - public static final String SL10_SCHEMA_LOCATION = - SCHEMA_ROOT + "Core.20020225.xsd"; - - /** URI of the Security Layer 1.1 XML namespace */ - public static final String SL11_NS_URI = - "http://www.buergerkarte.at/namespaces/securitylayer/20020831#"; - - /** Prefix used for the Security Layer 1.1 XML namespace */ - public static final String SL11_PREFIX = "sl11"; - - /** Local location of the Security Layer 1.1 XML schema definition */ - public static final String SL11_SCHEMA_LOCATION = - SCHEMA_ROOT + "Core.20020831.xsd"; - - /** URI of the Security Layer 1.2 XML namespace */ - public static final String SL12_NS_URI = - "http://www.buergerkarte.at/namespaces/securitylayer/1.2#"; - - /** Prefix used for the Security Layer 1.2 XML namespace */ - public static final String SL12_PREFIX = "sl"; - - /** Local location of the Security Layer 1.2 XML schema definition */ - public static final String SL12_SCHEMA_LOCATION = - SCHEMA_ROOT + "Core-1.2.xsd"; - - /** URI of the ECDSA XML namespace */ - public static final String ECDSA_NS_URI = - "http://www.w3.org/2001/04/xmldsig-more#"; - - /** Prefix used for ECDSA namespace */ - public static final String ECDSA_PREFIX = "ecdsa"; - - /** Local location of ECDSA XML schema definition */ - public static final String ECDSA_SCHEMA_LOCATION = - SCHEMA_ROOT + "ECDSAKeyValue.xsd"; - - /** URI of the PersonData XML namespace. */ - public static final String PD_NS_URI = - "http://reference.e-government.gv.at/namespace/persondata/20020228#"; - - /** Prefix used for the PersonData XML namespace */ - public static final String PD_PREFIX = "pr"; - -// /** Local location of the PersonData XML schema definition */ -// public static final String PD_SCHEMA_LOCATION = -// SCHEMA_ROOT + "PersonData.xsd"; - - /** Local location of the PersonData XML schema definition */ - public static final String PD_SCHEMA_LOCATION = - SCHEMA_ROOT + "PersonData_20_en_moaWID.xsd"; - - /** URI of the SAML namespace. */ - public static final String SAML_NS_URI = - "urn:oasis:names:tc:SAML:1.0:assertion"; - - /** Prefix used for the SAML XML namespace */ - public static final String SAML_PREFIX = "saml"; - - /** Local location of the SAML XML schema definition. */ - public static final String SAML_SCHEMA_LOCATION = - SCHEMA_ROOT + "cs-sstc-schema-assertion-01.xsd"; - - /** URI of the SAML request-response protocol namespace. */ - public static final String SAMLP_NS_URI = - "urn:oasis:names:tc:SAML:1.0:protocol"; - - /** Prefix used for the SAML request-response protocol namespace */ - public static final String SAMLP_PREFIX = "samlp"; - - /** Local location of the SAML request-response protocol schema definition. */ - public static final String SAMLP_SCHEMA_LOCATION = - SCHEMA_ROOT + "cs-sstc-schema-protocol-01.xsd"; - - /** URI of the XML namespace. */ - public static final String XML_NS_URI = - "http://www.w3.org/XML/1998/namespace"; - - /** Prefix used for the XML namespace */ - public static final String XML_PREFIX = "xml"; - - /** Local location of the XML schema definition. */ - public static final String XML_SCHEMA_LOCATION = SCHEMA_ROOT + "xml.xsd"; - - /** URI of the XMLNS namespace */ - public static final String XMLNS_NS_URI = "http://www.w3.org/2000/xmlns/"; - - /** Prefix used for the XSI namespace */ - public static final String XSI_PREFIX = "xsi"; - - /** Local location of the XSI schema definition. */ - public static final String XSI_SCHEMA_LOCATION = - SCHEMA_ROOT + "XMLSchema-instance.xsd"; - - /** URI of the XSI XMLNS namespace */ - public static final String XSI_NS_URI = - "http://www.w3.org/2001/XMLSchema-instance"; - - /** URI of the XSLT XML namespace */ - public static final String XSLT_NS_URI = - "http://www.w3.org/1999/XSL/Transform"; - - /** Prefix used for the XSLT XML namespace */ - public static final String XSLT_PREFIX = "xsl"; - - /** URI of the XMLDSig XML namespace. */ - public static final String DSIG_NS_URI = "http://www.w3.org/2000/09/xmldsig#"; - - /** Prefix used for the XMLDSig XML namespace */ - public static final String DSIG_PREFIX = "dsig"; - - /** Local location of the XMLDSig XML schema. */ - public static final String DSIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "xmldsig-core-schema.xsd"; - - /** URI of the XMLDSig XPath Filter XML namespace. */ - public static final String DSIG_FILTER2_NS_URI = - "http://www.w3.org/2002/06/xmldsig-filter2"; - - /** Prefix used for the XMLDSig XPath Filter XML namespace */ - public static final String DSIG_FILTER2_PREFIX = "dsig-filter2"; - - /** Local location of the XMLDSig XPath Filter XML schema definition. */ - public static final String DSIG_FILTER2_SCHEMA_LOCATION = - SCHEMA_ROOT + "xmldsig-filter2.xsd"; - - /** URI of the Exclusive Canonicalization XML namespace */ - public static final String DSIG_EC_NS_URI = - "http://www.w3.org/2001/10/xml-exc-c14n#"; - - /** Prefix used for the Exclusive Canonicalization XML namespace */ - public static final String DSIG_EC_PREFIX = "ec"; - - /** Local location of the Exclusive Canonicalizaion XML schema definition */ - public static final String DSIG_EC_SCHEMA_LOCATION = - SCHEMA_ROOT + "exclusive-canonicalization.xsd"; - - /** URI of the XMLLoginParameterResolver Configuration XML namespace */ - public static final String XMLLPR_NS_URI="http://reference.e-government.gv.at/namespace/moa/20020822#/xmllpr20030814"; - - /** Local location of the XMLLoginParameterResolver Configuration XML schema definition */ - public static final String XMLLPR_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOAIdentities.xsd"; - - - /** - * Contains all namespaces and local schema locations for XML schema - * definitions relevant for MOA. For use in validating XML parsers. - */ - public static final String ALL_SCHEMA_LOCATIONS = - (MOA_NS_URI + " " + MOA_SCHEMA_LOCATION + " ") - + (MOA_CONFIG_NS_URI + " " + MOA_CONFIG_SCHEMA_LOCATION + " ") - + (MOA_ID_CONFIG_NS_URI + " " + MOA_ID_CONFIG_SCHEMA_LOCATION + " ") - + (SL10_NS_URI + " " + SL10_SCHEMA_LOCATION + " ") - + (SL11_NS_URI + " " + SL11_SCHEMA_LOCATION + " ") - + (SL12_NS_URI + " " + SL12_SCHEMA_LOCATION + " ") - + (ECDSA_NS_URI + " " + ECDSA_SCHEMA_LOCATION + " ") - + (PD_NS_URI + " " + PD_SCHEMA_LOCATION + " ") - + (SAML_NS_URI + " " + SAML_SCHEMA_LOCATION + " ") - + (SAMLP_NS_URI + " " + SAMLP_SCHEMA_LOCATION + " ") - + (XML_NS_URI + " " + XML_SCHEMA_LOCATION + " ") - + (XSI_NS_URI + " " + XSI_SCHEMA_LOCATION + " ") - + (DSIG_NS_URI + " " + DSIG_SCHEMA_LOCATION + " ") - + (DSIG_FILTER2_NS_URI + " " + DSIG_FILTER2_SCHEMA_LOCATION + " ") - + (DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION + " ") - + (XMLLPR_NS_URI + " " + XMLLPR_SCHEMA_LOCATION); - - /** URN prefix for bPK and wbPK. */ - public static final String URN_PREFIX = "urn:publicid:gv.at"; - - /** URN prefix for context dependent id. */ - public static final String URN_PREFIX_CDID = URN_PREFIX + ":cdid"; - - /** URN prefix for context dependent id (bPK). */ - public static final String URN_PREFIX_BPK = URN_PREFIX_CDID + "+bpk"; - - /** URN prefix for context dependent id (HPI). */ - public static final String URN_PREFIX_HPI = URN_PREFIX_CDID + "+EHSP"; - - /** URN prefix for context dependent id (wbPK). */ - public static final String URN_PREFIX_WBPK = URN_PREFIX + ":wbpk"; - - /** URN prefix for context dependent id. */ - public static final String URN_PREFIX_BASEID = URN_PREFIX + ":baseid"; - - /** Security Layer manifest type URI. */ - public static final String SL_MANIFEST_TYPE_URI = - "http://www.buergerkarte.at/specifications/Security-Layer/20020225#SignatureManifest"; - - /** URI of the SHA1 digest algorithm */ - public static final String SHA1_URI = - "http://www.w3.org/2000/09/xmldsig#sha1"; - - /** URI of the Canonical XML algorithm */ - public static final String C14N_URI = - "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; - - /** URI of the Canoncial XML with comments algorithm */ - public static final String C14N_WITH_COMMENTS_URI = - "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"; - - /** URI of the Exclusive Canonical XML algorithm */ - public static final String EXC_C14N_URI = - "http://www.w3.org/2001/10/xml-exc-c14n#"; - - /** URI of the Exclusive Canonical XML with commments algorithm */ - public static final String EXC_C14N_WITH_COMMENTS_URI = - "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"; - - // - // Local names for elements of the MOA SPSS schema - // - - /** - * Local name of request for creating an XML signature. - */ - public static final String MOA_SPSS_CREATE_XML_REQUEST = "CreateXMLSignatureRequest"; - - /** - * Local name of request for verifying an XML signature. - */ - public static final String MOA_SPSS_VERIFY_XML_REQUEST = "VerifiyXMLSignatureRequest"; - - /** - * A map used to map namespace prefixes to namespace URIs - */ - public static HashMap nSMap = new HashMap(5); - -} diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java deleted file mode 100644 index 5be0bb500..000000000 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ /dev/null @@ -1,971 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Vector; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentFragment; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import org.apache.xerces.parsers.DOMParser; -import org.apache.xerces.parsers.SAXParser; -import org.apache.xerces.parsers.XMLGrammarPreparser; -import org.apache.xerces.util.SymbolTable; -import org.apache.xerces.util.XMLGrammarPoolImpl; -import org.apache.xerces.xni.grammars.XMLGrammarDescription; -import org.apache.xerces.xni.grammars.XMLGrammarPool; -import org.apache.xerces.xni.parser.XMLInputSource; -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - - -import at.gv.egovernment.moa.logging.Logger; - -/** - * Various utility functions for handling XML DOM trees. - * - * The parsing methods in this class make use of some features internal to the - * Xerces DOM parser, mainly for performance reasons. As soon as JAXP - * (currently at version 1.2) is better at schema handling, it should be used as - * the parser interface. - * - * @author Patrick Peck - * @version $Id$ - */ -public class DOMUtils { - - /** Feature URI for namespace aware parsing. */ - private static final String NAMESPACES_FEATURE = - "http://xml.org/sax/features/namespaces"; - /** Feature URI for validating parsing. */ - private static final String VALIDATION_FEATURE = - "http://xml.org/sax/features/validation"; - /** Feature URI for schema validating parsing. */ - private static final String SCHEMA_VALIDATION_FEATURE = - "http://apache.org/xml/features/validation/schema"; - /** Feature URI for normalization of element/attribute values. */ - private static final String NORMALIZED_VALUE_FEATURE = - "http://apache.org/xml/features/validation/schema/normalized-value"; - /** Feature URI for parsing ignorable whitespace. */ - private static final String INCLUDE_IGNORABLE_WHITESPACE_FEATURE = - "http://apache.org/xml/features/dom/include-ignorable-whitespace"; - /** Feature URI for creating EntityReference nodes in the DOM tree. */ - private static final String CREATE_ENTITY_REF_NODES_FEATURE = - "http://apache.org/xml/features/dom/create-entity-ref-nodes"; - /** Property URI for providing external schema locations. */ - private static final String EXTERNAL_SCHEMA_LOCATION_PROPERTY = - "http://apache.org/xml/properties/schema/external-schemaLocation"; - /** Property URI for providing the external schema location for elements - * without a namespace. */ - private static final String EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY = - "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"; - /** Property URI for the Xerces grammar pool. */ - private static final String GRAMMAR_POOL = - org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX - + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; - /** A prime number for initializing the symbol table. */ - private static final int BIG_PRIME = 2039; - /** Symbol table for the grammar pool. */ - private static SymbolTable symbolTable = new SymbolTable(BIG_PRIME); - /** Xerces schema grammar pool. */ - private static XMLGrammarPool grammarPool = new XMLGrammarPoolImpl(); - /** Set holding the NamespaceURIs of the grammarPool, to prevent multiple - * entries of same grammars to the pool */ - private static Set grammarNamespaces; - - static { - grammarPool.lockPool(); - grammarNamespaces = new HashSet(); - } - - /** - * Preparse a schema and add it to the schema pool. - * The method only adds the schema to the pool if a schema having the same - * systemId (namespace URI) is not already present in the pool. - * - * @param inputStream An InputStream providing the contents of - * the schema. - * @param systemId The systemId (namespace URI) to use for the schema. - * @throws IOException An error occurred reading the schema. - */ - public static void addSchemaToPool(InputStream inputStream, String systemId) - throws IOException { - XMLGrammarPreparser preparser; - - if (!grammarNamespaces.contains(systemId)) { - - grammarNamespaces.add(systemId); - - // unlock the pool so that we can add another grammar - grammarPool.unlockPool(); - - // prepare the preparser - preparser = new XMLGrammarPreparser(symbolTable); - preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); - preparser.setProperty(GRAMMAR_POOL, grammarPool); - preparser.setFeature(NAMESPACES_FEATURE, true); - preparser.setFeature(VALIDATION_FEATURE, true); - - // add the grammar to the pool - preparser.preparseGrammar( - XMLGrammarDescription.XML_SCHEMA, - new XMLInputSource(null, systemId, null, inputStream, null)); - - // lock the pool again so that schemas are not added automatically - grammarPool.lockPool(); - } - } - - /** - * Parse an XML document from an InputStream. - * - * @param inputStream The InputStream containing the XML - * document. - * @param validating If true, parse validating. - * @param externalSchemaLocations A String containing namespace - * URI to schema location pairs, the same way it is accepted by the xsi: - * schemaLocation attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * xsi:noNamespaceSchemaLocation attribute. - * @param entityResolver An EntityResolver to resolve external - * entities (schemas and DTDs). If null, it will not be set. - * @param errorHandler An ErrorHandler to decide what to do - * with parsing errors. If null, it will not be set. - * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. - * @throws ParserConfigurationException An error occurred configuring the XML - * parser. - */ - public static Document parseDocument( - InputStream inputStream, - boolean validating, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation, - EntityResolver entityResolver, - ErrorHandler errorHandler) - throws SAXException, IOException, ParserConfigurationException { - - DOMParser parser; - - - - //if Debug is enabled make a copy of inputStream to enable debug output in case of SAXException - byte buffer [] = null; - ByteArrayInputStream baStream = null; - if(true == Logger.isDebugEnabled()) { - int len = inputStream.available(); - buffer = new byte[len]; - inputStream.read(buffer); - baStream = new ByteArrayInputStream(buffer); - } - - // create the DOM parser - if (symbolTable != null) { - parser = new DOMParser(symbolTable, grammarPool); - } else { - parser = new DOMParser(); - } - - // set parser features and properties - try { - parser.setFeature(NAMESPACES_FEATURE, true); - parser.setFeature(VALIDATION_FEATURE, validating); - parser.setFeature(SCHEMA_VALIDATION_FEATURE, validating); - parser.setFeature(NORMALIZED_VALUE_FEATURE, false); - parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); - parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); - - if (validating) { - if (externalSchemaLocations != null) { - parser.setProperty( - EXTERNAL_SCHEMA_LOCATION_PROPERTY, - externalSchemaLocations); - } - if (externalNoNamespaceSchemaLocation != null) { - parser.setProperty( - EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, - externalNoNamespaceSchemaLocation); - } - } - - // set entity resolver and error handler - if (entityResolver != null) { - parser.setEntityResolver(entityResolver); - } - if (errorHandler != null) { - parser.setErrorHandler(errorHandler); - } - - // parse the document and return it - // if debug is enabled: use copy of strem (baStream) else use orig stream - if(null != baStream) - parser.parse(new InputSource(baStream)); - else - parser.parse(new InputSource(inputStream)); - } catch(SAXException e) { - if(true == Logger.isDebugEnabled() && null != buffer) { - String xmlContent = new String(buffer); - Logger.debug("SAXException in:\n" + xmlContent); - } - throw(e); - } - - return parser.getDocument(); - } - - /** - * Parse an XML document from an InputStream. - * - * It uses a MOAEntityResolver as the EntityResolver - * and a MOAErrorHandler as the ErrorHandler. - * - * @param inputStream The InputStream containing the XML - * document. - * @param validating If true, parse validating. - * @param externalSchemaLocations A String containing namespace - * URI to schema location pairs, the same way it is accepted by the xsi: - * schemaLocation attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * xsi:noNamespaceSchemaLocation attribute. - * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. - * @throws ParserConfigurationException An error occurred configuring the XML - * parser. - */ - public static Document parseDocument( - InputStream inputStream, - boolean validating, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation) - throws SAXException, IOException, ParserConfigurationException { - - return parseDocument( - inputStream, - validating, - externalSchemaLocations, - externalNoNamespaceSchemaLocation, - new MOAEntityResolver(), - new MOAErrorHandler()); - } - - /** - * Parse an XML document from a String. - * - * It uses a MOAEntityResolver as the EntityResolver - * and a MOAErrorHandler as the ErrorHandler. - * - * @param xmlString The String containing the XML document. - * @param encoding The encoding of the XML document. - * @param validating If true, parse validating. - * @param externalSchemaLocations A String containing namespace - * URI to schema location pairs, the same way it is accepted by the xsi: - * schemaLocation attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * xsi:noNamespaceSchemaLocation attribute. - * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. - * @throws ParserConfigurationException An error occurred configuring the XML - * parser. - */ - public static Document parseDocument( - String xmlString, - String encoding, - boolean validating, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation) - throws SAXException, IOException, ParserConfigurationException { - - InputStream in = new ByteArrayInputStream(xmlString.getBytes(encoding)); - return parseDocument( - in, - validating, - externalSchemaLocations, - externalNoNamespaceSchemaLocation); - } - - /** - * Parse an UTF-8 encoded XML document from a String. - * - * @param xmlString The String containing the XML document. - * @param validating If true, parse validating. - * @param externalSchemaLocations A String containing namespace - * URI to schema location pairs, the same way it is accepted by the xsi: - * schemaLocation attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * xsi:noNamespaceSchemaLocation attribute. - * @return The parsed XML document as a DOM tree. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. - * @throws ParserConfigurationException An error occurred configuring the XML - * parser. - */ - public static Document parseDocument( - String xmlString, - boolean validating, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation) - throws SAXException, IOException, ParserConfigurationException { - - return parseDocument( - xmlString, - "UTF-8", - validating, - externalSchemaLocations, - externalNoNamespaceSchemaLocation); - } - - /** - * A convenience method to parse an XML document validating. - * - * @param inputStream The InputStream containing the XML - * document. - * @return The root element of the parsed XML document. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document. - * @throws ParserConfigurationException An error occurred configuring the XML - * parser. - */ - public static Element parseXmlValidating(InputStream inputStream) - throws ParserConfigurationException, SAXException, IOException { - return DOMUtils - .parseDocument(inputStream, true, Constants.ALL_SCHEMA_LOCATIONS, null) - .getDocumentElement(); - } - - /** - * Schema validate a given DOM element. - * - * @param element The element to validate. - * @param externalSchemaLocations A String containing namespace - * URI to schema location pairs, the same way it is accepted by the xsi: - * schemaLocation attribute. - * @param externalNoNamespaceSchemaLocation The schema location of the - * schema for elements without a namespace, the same way it is accepted by the - * xsi:noNamespaceSchemaLocation attribute. - * @return true, if the element validates against - * the schemas declared in it. - * @throws SAXException An error occurred parsing the document. - * @throws IOException An error occurred reading the document from its - * serialized representation. - * @throws ParserConfigurationException An error occurred configuring the XML - * @throws TransformerException An error occurred serializing the element. - */ - public static boolean validateElement( - Element element, - String externalSchemaLocations, - String externalNoNamespaceSchemaLocation) - throws - ParserConfigurationException, - IOException, - SAXException, - TransformerException { - - byte[] docBytes; - SAXParser parser; - - // create the SAX parser - if (symbolTable != null) { - parser = new SAXParser(symbolTable, grammarPool); - } else { - parser = new SAXParser(); - } - - // serialize the document - docBytes = serializeNode(element, "UTF-8"); - - // set up parser features and attributes - parser.setFeature(NAMESPACES_FEATURE, true); - parser.setFeature(VALIDATION_FEATURE, true); - parser.setFeature(SCHEMA_VALIDATION_FEATURE, true); - if (externalSchemaLocations != null) { - parser.setProperty( - EXTERNAL_SCHEMA_LOCATION_PROPERTY, - externalSchemaLocations); - } - if (externalNoNamespaceSchemaLocation != null) { - parser.setProperty( - EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, - "externalNoNamespaceSchemaLocation"); - } - - // set up entity resolver and error handler - parser.setEntityResolver(new MOAEntityResolver()); - parser.setErrorHandler(new MOAErrorHandler()); - - // parse validating - parser.parse(new InputSource(new ByteArrayInputStream(docBytes))); - return true; - } - - /** - * Serialize the given DOM node. - * - * The node will be serialized using the UTF-8 encoding. - * - * @param node The node to serialize. - * @return String The String representation of the given DOM - * node. - * @throws TransformerException An error occurred transforming the - * node to a String. - * @throws IOException An IO error occurred writing the node to a byte array. - */ - public static String serializeNode(Node node) - throws TransformerException, IOException { - return new String(serializeNode(node, "UTF-8", false), "UTF-8"); - } - - - /** - * Serialize the given DOM node. - * - * The node will be serialized using the UTF-8 encoding. - * - * @param node The node to serialize. - * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. - * @return String The String representation of the given DOM - * node. - * @throws TransformerException An error occurred transforming the - * node to a String. - * @throws IOException An IO error occurred writing the node to a byte array. - */ - public static String serializeNode(Node node, boolean omitXmlDeclaration) - throws TransformerException, IOException { - return new String(serializeNode(node, "UTF-8", omitXmlDeclaration), "UTF-8"); - } - - /** - * Serialize the given DOM node. - * - * The node will be serialized using the UTF-8 encoding. - * - * @param node The node to serialize. - * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. - * @param lineSeperator Sets the line seperator String of the parser - * @return String The String representation of the given DOM - * node. - * @throws TransformerException An error occurred transforming the - * node to a String. - * @throws IOException An IO error occurred writing the node to a byte array. - */ - public static String serializeNode(Node node, boolean omitXmlDeclaration, String lineSeperator) - throws TransformerException, IOException { - return new String(serializeNode(node, "UTF-8", omitXmlDeclaration, lineSeperator), "UTF-8"); - } - - /** - * Serialize the given DOM node to a byte array. - * - * @param node The node to serialize. - * @param xmlEncoding The XML encoding to use. - * @return The serialized node, as a byte array. Using a compatible encoding - * this can easily be converted into a String. - * @throws TransformerException An error occurred transforming the node to a - * byte array. - * @throws IOException An IO error occurred writing the node to a byte array. - */ - public static byte[] serializeNode(Node node, String xmlEncoding) - throws TransformerException, IOException { - return serializeNode(node, xmlEncoding, false); - } - - /** - * Serialize the given DOM node to a byte array. - * - * @param node The node to serialize. - * @param xmlEncoding The XML encoding to use. - * @param omitDeclaration The boolean value for omitting the XML Declaration. - * @return The serialized node, as a byte array. Using a compatible encoding - * this can easily be converted into a String. - * @throws TransformerException An error occurred transforming the node to a - * byte array. - * @throws IOException An IO error occurred writing the node to a byte array. - */ - public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration) - throws TransformerException, IOException { - return serializeNode(node, xmlEncoding, omitDeclaration, null); - } - - - /** - * Serialize the given DOM node to a byte array. - * - * @param node The node to serialize. - * @param xmlEncoding The XML encoding to use. - * @param omitDeclaration The boolean value for omitting the XML Declaration. - * @param lineSeperator Sets the line seperator String of the parser - * @return The serialized node, as a byte array. Using a compatible encoding - * this can easily be converted into a String. - * @throws TransformerException An error occurred transforming the node to a - * byte array. - * @throws IOException An IO error occurred writing the node to a byte array. - */ - public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration, String lineSeperator) - throws TransformerException, IOException { - - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer = transformerFactory.newTransformer(); - ByteArrayOutputStream bos = new ByteArrayOutputStream(16384); - - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); - transformer.setOutputProperty(OutputKeys.ENCODING, xmlEncoding); - String omit = omitDeclaration ? "yes" : "no"; - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omit); - if (null!=lineSeperator) { - transformer.setOutputProperty("{http://xml.apache.org/xalan}line-separator", lineSeperator);//does not work for xalan <= 2.5.1 - } - transformer.transform(new DOMSource(node), new StreamResult(bos)); - - bos.flush(); - bos.close(); - - return bos.toByteArray(); - } - - /** - * Return the text that a node contains. - * - * This routine: - *
            - *
          • Ignores comments and processing instructions.
          • - *
          • Concatenates TEXT nodes, CDATA nodes, and the results recursively - * processing EntityRef nodes.
          • - *
          • Ignores any element nodes in the sublist. (Other possible options are - * to recurse into element sublists or throw an exception.)
          • - *
          - * - * @param node A DOM node from which to extract text. - * @return A String representing its contents. - */ - public static String getText(Node node) { - if (!node.hasChildNodes()) { - return ""; - } - - StringBuffer result = new StringBuffer(); - NodeList list = node.getChildNodes(); - - for (int i = 0; i < list.getLength(); i++) { - Node subnode = list.item(i); - if (subnode.getNodeType() == Node.TEXT_NODE) { - result.append(subnode.getNodeValue()); - } else if (subnode.getNodeType() == Node.CDATA_SECTION_NODE) { - result.append(subnode.getNodeValue()); - } else if (subnode.getNodeType() == Node.ENTITY_REFERENCE_NODE) { - // Recurse into the subtree for text - // (and ignore comments) - result.append(getText(subnode)); - } - } - return result.toString(); - } - - /** - * Build the namespace prefix to namespace URL mapping in effect for a given - * node. - * - * @param node The context node for which build the map. - * @return The namespace prefix to namespace URL mapping ( - * a String value to String value mapping). - */ - public static Map getNamespaceDeclarations(Node node) { - Map nsDecls = new HashMap(); - int i; - - do { - if (node.hasAttributes()) { - NamedNodeMap attrs = node.getAttributes(); - - for (i = 0; i < attrs.getLength(); i++) { - Attr attr = (Attr) attrs.item(i); - - // add prefix mapping if none exists - if ("xmlns".equals(attr.getPrefix()) - || "xmlns".equals(attr.getName())) { - - String nsPrefix = - attr.getPrefix() != null ? attr.getLocalName() : ""; - - if (nsDecls.get(nsPrefix) == null) { - nsDecls.put(nsPrefix, attr.getValue()); - } - } - } - } - } while ((node = node.getParentNode()) != null); - - return nsDecls; - } - - /** - * Add all namespace declarations declared in the parent(s) of a given - * element and used in the subtree of the given element to the given element. - * - * @param context The element to which to add the namespaces. - */ - public static void localizeNamespaceDeclarations(Element context) { - Node parent = context.getParentNode(); - - if (parent != null) { - Map namespaces = getNamespaceDeclarations(context.getParentNode()); - Set nsUris = collectNamespaceURIs(context); - Iterator iter; - - for (iter = namespaces.entrySet().iterator(); iter.hasNext();) { - Map.Entry e = (Map.Entry) iter.next(); - - if (nsUris.contains(e.getValue())) { - String prefix = (String) e.getKey(); - String nsUri = (String) e.getValue(); - String nsAttrName = "".equals(prefix) ? "xmlns" : "xmlns:" + prefix; - - context.setAttributeNS(Constants.XMLNS_NS_URI, nsAttrName, nsUri); - } - } - } - } - - /** - * Collect all the namespace URIs used in the subtree of a given element. - * - * @param context The element that should be searched for namespace URIs. - * @return All namespace URIs used in the subtree of context, - * including the ones used in context itself. - */ - public static Set collectNamespaceURIs(Element context) { - Set result = new HashSet(); - - collectNamespaceURIsImpl(context, result); - return result; - } - - /** - * A recursive method to do the work of collectNamespaceURIs. - * - * @param context The context element to evaluate. - * @param result The result, passed as a parameter to avoid unnecessary - * instantiations of Set. - */ - private static void collectNamespaceURIsImpl(Element context, Set result) { - NamedNodeMap attrs = context.getAttributes(); - NodeList childNodes = context.getChildNodes(); - String nsUri; - int i; - - // add the namespace of the context element - nsUri = context.getNamespaceURI(); - if (nsUri != null && nsUri != Constants.XMLNS_NS_URI) { - result.add(nsUri); - } - - // add all namespace URIs from attributes - for (i = 0; i < attrs.getLength(); i++) { - nsUri = attrs.item(i).getNamespaceURI(); - if (nsUri != null && nsUri != Constants.XMLNS_NS_URI) { - result.add(nsUri); - } - } - - // add all namespaces from subelements - for (i = 0; i < childNodes.getLength(); i++) { - Node node = childNodes.item(i); - - if (node.getNodeType() == Node.ELEMENT_NODE) { - collectNamespaceURIsImpl((Element) node, result); - } - } - } - - /** - * Check, that each attribute node in the given NodeList has its - * parent in the NodeList as well. - * - * @param nodes The NodeList to check. - * @return true, if each attribute node in nodes - * has its parent in nodes as well. - */ - public static boolean checkAttributeParentsInNodeList(NodeList nodes) { - Set nodeSet = new HashSet(); - int i; - - // put the nodes into the nodeSet - for (i = 0; i < nodes.getLength(); i++) { - nodeSet.add(nodes.item(i)); - } - - // check that each attribute node's parent is in the node list - for (i = 0; i < nodes.getLength(); i++) { - Node n = nodes.item(i); - - if (n.getNodeType() == Node.ATTRIBUTE_NODE) { - Attr attr = (Attr) n; - Element owner = attr.getOwnerElement(); - - if (owner == null) { - if (!isNamespaceDeclaration(attr)) { - return false; - } - } - - if (!nodeSet.contains(owner) && !isNamespaceDeclaration(attr)) { - return false; - } - } - } - - return true; - } - - /** - * Convert an unstructured NodeList into a - * DocumentFragment. - * - * @param nodeList Contains the node list to be converted into a DOM - * DocumentFragment. - * @return the resulting DocumentFragment. The DocumentFragment will be - * backed by a new DOM Document, i.e. all noded of the node list will be - * cloned. - * @throws ParserConfigurationException An error occurred creating the - * DocumentFragment. - * @precondition The nodes in the node list appear in document order - * @precondition for each Attr node in the node list, the owning Element is - * in the node list as well. - * @precondition each Element or Attr node in the node list is namespace - * aware. - */ - public static DocumentFragment nodeList2DocumentFragment(NodeList nodeList) - throws ParserConfigurationException { - - DocumentBuilder builder = - DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Document doc = builder.newDocument(); - DocumentFragment result = doc.createDocumentFragment(); - - if (null == nodeList || nodeList.getLength() == 0) { - return result; - } - - int currPos = 0; - currPos = - nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; - - while (currPos < nodeList.getLength()) { - currPos = - nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; - } - return result; - } - - /** - * Helper method for the nodeList2DocumentFragment. - * - * @param nodeList The NodeList to convert. - * @param currPos The current position in the nodeList. - * @param result The resulting DocumentFragment. - * @param currOrgElem The current original element. - * @param currClonedElem The current cloned element. - * @return The current position. - */ - private static int nodeList2DocumentFragment( - NodeList nodeList, - int currPos, - DocumentFragment result, - Element currOrgElem, - Element currClonedElem) { - - while (currPos < nodeList.getLength()) { - Node currentNode = nodeList.item(currPos); - switch (currentNode.getNodeType()) { - case Node.COMMENT_NODE : - case Node.PROCESSING_INSTRUCTION_NODE : - case Node.TEXT_NODE : - { - // Append current node either to resulting DocumentFragment or to - // current cloned Element - if (null == currClonedElem) { - result.appendChild( - result.getOwnerDocument().importNode(currentNode, false)); - } else { - // Stop processing if current Node is not a descendant of - // current Element - if (!isAncestor(currOrgElem, currentNode)) { - return --currPos; - } - - currClonedElem.appendChild( - result.getOwnerDocument().importNode(currentNode, false)); - } - break; - } - - case Node.ELEMENT_NODE : - { - Element nextCurrOrgElem = (Element) currentNode; - Element nextCurrClonedElem = - result.getOwnerDocument().createElementNS( - nextCurrOrgElem.getNamespaceURI(), - nextCurrOrgElem.getNodeName()); - - // Append current Node either to resulting DocumentFragment or to - // current cloned Element - if (null == currClonedElem) { - result.appendChild(nextCurrClonedElem); - currOrgElem = nextCurrOrgElem; - currClonedElem = nextCurrClonedElem; - } else { - // Stop processing if current Node is not a descendant of - // current Element - if (!isAncestor(currOrgElem, currentNode)) { - return --currPos; - } - - currClonedElem.appendChild(nextCurrClonedElem); - } - - // Process current Node (of type Element) recursively - currPos = - nodeList2DocumentFragment( - nodeList, - ++currPos, - result, - nextCurrOrgElem, - nextCurrClonedElem); - - break; - } - - case Node.ATTRIBUTE_NODE : - { - Attr currAttr = (Attr) currentNode; - - // GK 20030411: Hack to overcome problems with IAIK IXSIL - if (currAttr.getOwnerElement() == null) - break; - if (currClonedElem == null) - break; - - // currClonedElem must be the owner Element of currAttr if - // preconditions are met - currClonedElem.setAttributeNS( - currAttr.getNamespaceURI(), - currAttr.getNodeName(), - currAttr.getValue()); - break; - } - - default : - { - // All other nodes will be ignored - } - } - - currPos++; - } - - return currPos; - } - - /** - * Check, if the given attribute is a namespace declaration. - * - * @param attr The attribute to check. - * @return true, if the attribute is a namespace declaration, - * false otherwise. - */ - private static boolean isNamespaceDeclaration(Attr attr) { - return Constants.XMLNS_NS_URI.equals(attr.getNamespaceURI()); - } - - /** - * Check, if a given DOM element is an ancestor of a given node. - * - * @param candAnc The DOM element to check for being the ancestor. - * @param cand The node to check for being the child. - * @return true, if candAnc is an (indirect) - * ancestor of cand; false otherwise. - */ - public static boolean isAncestor(Element candAnc, Node cand) { - Node currPar = cand.getParentNode(); - - while (currPar != null) { - if (candAnc == currPar) - return true; - currPar = currPar.getParentNode(); - } - return false; - } - - /** - * Selects the (first) element from a node list and returns it. - * - * @param nl The NodeList to get the element from. - * @return The (first) element included in the node list or null - * if the node list is null or empty or no element is - * included in the list. - */ - public static Element getElementFromNodeList (NodeList nl) { - if ((nl == null) || (nl.getLength() == 0)) { - return null; - } - for (int i=0; idateTime, - * according to ISO 8601. - * - * @author Patrick Peck - * @version $Id$ - * @see http://www.w3.org/2001/XMLSchema-datatypes" - */ -public class DateTimeUtils { - /** Error messages. */ - private static MessageProvider msg = MessageProvider.getInstance(); - - /** - * Builds a dateTime value from a Calendar value. - * @param cal the Calendar value - * @return the dateTime value - */ - public static String buildDateTime(Calendar cal) { - StringWriter out = new StringWriter(); - out.write("" + cal.get(Calendar.YEAR)); - out.write("-"); - out.write(to2DigitString(cal.get(Calendar.MONTH) + 1)); - out.write("-"); - out.write(to2DigitString(cal.get(Calendar.DAY_OF_MONTH))); - out.write("T"); - out.write(to2DigitString(cal.get(Calendar.HOUR_OF_DAY))); - out.write(":"); - out.write(to2DigitString(cal.get(Calendar.MINUTE))); - out.write(":"); - out.write(to2DigitString(cal.get(Calendar.SECOND))); - int tzOffsetMilliseconds = - cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); - if (tzOffsetMilliseconds != 0) { - int tzOffsetMinutes = tzOffsetMilliseconds / (1000 * 60); - int tzOffsetHours = tzOffsetMinutes / 60; - tzOffsetMinutes -= tzOffsetHours * 60; - if (tzOffsetMilliseconds > 0) { - out.write("+"); - out.write(to2DigitString(tzOffsetHours)); - out.write(":"); - out.write(to2DigitString(tzOffsetMinutes)); - } else { - out.write("-"); - out.write(to2DigitString(-tzOffsetHours)); - out.write(":"); - out.write(to2DigitString(-tzOffsetMinutes)); - } - } - return out.toString(); - } - - /** - * Converts month, day, hour, minute, or second value - * to a 2 digit String. - * @param number the month, day, hour, minute, or second value - * @return 2 digit String - */ - private static String to2DigitString(int number) { - if (number < 10) - return "0" + number; - else - return "" + number; - } - - /** - * Parse a String containing a date and time instant, given in - * ISO 8601 format. - * - * @param dateTime The String to parse. - * @return The Date representation of the contents of - * dateTime. - * @throws ParseException Parsing the dateTime failed. - */ - public static Date parseDateTime(String dateTime) throws ParseException { - GregorianCalendar calendar; - long time; - int yearSign = 1, year, month, day; - int hour, minute, second; - double fraction = 0.0; - int tzSign = 1, tzHour = 0, tzMinute = 0; - int curPos = 0; - String fractStr; - boolean localTime = false; - char c; - - // parse year sign - ensureChars(dateTime, curPos, 1); - c = dateTime.charAt(curPos); - if (c == '+' || c == '-') { - yearSign = c == '+' ? 1 : -1; - curPos++; - } - - // parse year - year = parseInt(dateTime, curPos, 4); - curPos += 4; - - // parse '-' - ensureChar(dateTime, curPos, '-'); - curPos++; - - // parse month - month = parseInt(dateTime, curPos, 2); - ensureValue(month, 1, 12, curPos); - curPos += 2; - - // parse '-' - ensureChar(dateTime, curPos, '-'); - curPos++; - - // parse day - day = parseInt(dateTime, curPos, 2); - ensureValue(day, 1, 31, curPos); - curPos += 2; - - // parse 'T' - ensureChar(dateTime, curPos, 'T'); - curPos++; - - // parse hour - hour = parseInt(dateTime, curPos, 2); - ensureValue(hour, 0, 23, curPos); - curPos += 2; - - // parse ':' - ensureChar(dateTime, curPos, ':'); - curPos++; - - // parse minute - minute = parseInt(dateTime, curPos, 2); - ensureValue(minute, 0, 59, curPos); - curPos += 2; - - // parse ':' - ensureChar(dateTime, curPos, ':'); - curPos++; - - // parse second - second = parseInt(dateTime, curPos, 2); - ensureValue(second, 0, 59, curPos); - curPos += 2; - - // parse a fraction - if (dateTime.length() > curPos && dateTime.charAt(curPos) == '.') { - curPos++; - ensureDigits(dateTime, curPos, 1); - fractStr = "0."; - fractStr - += dateTime.substring(curPos, curPos + countDigits(dateTime, curPos)); - fraction = Double.parseDouble(fractStr); - curPos += countDigits(dateTime, curPos); - } - - // parse a time zone - if (dateTime.length() > curPos) { - c = dateTime.charAt(curPos); - if (c == 'Z') { - curPos++; - } else if (c == '+' || c == '-') { - // parse time zone sign - tzSign = c == '+' ? 1 : -1; - curPos++; - - // parse time zone hour - tzHour = parseInt(dateTime, curPos, 2); - ensureValue(tzHour, 0, 14, curPos); - curPos += 2; - - // parse ':' - ensureChar(dateTime, curPos, ':'); - curPos++; - - // parse time zone minute - tzMinute = parseInt(dateTime, curPos, 2); - ensureValue(tzMinute, 0, 59, curPos); - curPos += 2; - } - } else { - localTime = true; - } - - // if we have characters left, it's an error - if (dateTime.length() != curPos) { - throw new ParseException(msg.getMessage("datetime.00", null), curPos); - } - - // build the Date object - year = year * yearSign; - try { - calendar = new GregorianCalendar(TimeZone.getTimeZone("GMT")); - calendar.set(year, month - 1, day, hour, minute, second); - calendar.set(Calendar.MILLISECOND, 0); - time = calendar.getTime().getTime(); - time += (long) (fraction * 1000.0); - time -= tzSign * ((tzHour * 60) + tzMinute) * 60 * 1000; - if (localTime) { - time -= TimeZone.getDefault().getRawOffset(); - } - return new Date(time); - } catch (IllegalArgumentException e) { - throw new ParseException(msg.getMessage("datetime.00", null), curPos); - } - - } - - /** - * Parse an integer value. - * - * @param str The String containing the digits. - * @param curPos The starting position. - * @param digits The number of digist making up the integer value. - * @return int The integer representation of the digits contained in - * str. - * @throws ParseException Parsing the integer value failed. - */ - private static int parseInt(String str, int curPos, int digits) - throws ParseException { - - ensureDigits(str, curPos, digits); - return Integer.parseInt(str.substring(curPos, curPos + digits)); - } - - /** - * Count the number of digits following curPos. - * - * @param str The String in which to count digits. - * @param curPos The starting position. - * @return int The number of digits. - */ - private static int countDigits(String str, int curPos) { - int i; - - for (i = curPos; i < str.length() && Character.isDigit(str.charAt(i)); i++); - return i - curPos; - } - - /** - * Ensure that a value falls in a given min/max range. - * - * @param value The value to check. - * @param min The minimum allowed value. - * @param max The maximum allowed value. - * @param curPos To indicate the parsing position in the - * ParseException. - * @throws ParseException Thrown, if value < min || value > - * max - */ - private static void ensureValue(int value, int min, int max, int curPos) - throws ParseException { - - if (value < min || value > max) { - throw new ParseException(msg.getMessage("datetime.00", null), curPos); - } - } - - /** - * Ensure that the given String has a number of characters left. - * - * @param str The String to check for its length. - * @param curPos The starting position. - * @param count The minimum number of characters that str must - * contain, starting at from curPos. - * @throws ParseException Thrown, if - * curPos + count > str.length(). - */ - private static void ensureChars(String str, int curPos, int count) - throws ParseException { - if (curPos + count > str.length()) { - throw new ParseException(msg.getMessage("datetime.00", null), curPos); - } - } - - /** - * Ensure that a given String contains a certain character at a - * certain position. - * - * @param str The String in which to look up the character. - * @param curPos The position in str that must contain the - * character. - * @param c The character value that must be contained at position - * curPos. - * @throws ParseException Thrown, if the characters do not match or - * curPos is out of range. - */ - private static void ensureChar(String str, int curPos, char c) - throws ParseException { - - ensureChars(str, curPos, 1); - if (str.charAt(curPos) != c) { - throw new ParseException(msg.getMessage("datetime.00", null), curPos); - } - } - - /** - * Ensure that a given String contains a number of digits, - * starting at a given position. - * - * @param str The String to scan for digits. - * @param curPos The starting postion. - * @param count The number of digits that must be contained in - * str, starting at curPos. - * @throws ParseException Thrown, if str is not long enough, or - * one of the characters following curPos in str is - * not a digit. - */ - private static void ensureDigits(String str, int curPos, int count) - throws ParseException { - - ensureChars(str, curPos, count); - for (int i = curPos; i < curPos + count; i++) { - if (!Character.isDigit(str.charAt(i))) { - throw new ParseException(msg.getMessage("datetime.00", null), curPos); - } - } - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/EntityResolverChain.java b/common/src/at/gv/egovernment/moa/util/EntityResolverChain.java deleted file mode 100644 index e7008a701..000000000 --- a/common/src/at/gv/egovernment/moa/util/EntityResolverChain.java +++ /dev/null @@ -1,52 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * Implementation of the org.xml.sax.EntityResolver, - * for use by a org.apache.xerces.parsers.DOMParser. - * - * @author Patrick Peck - * @version $Id$ - */ -public class EntityResolverChain implements EntityResolver { - /** The EntityResolvers in the chain. */ - private List resolvers = new ArrayList(); - - /** - * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) - */ - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException, IOException { - - Iterator iter; - - for (iter = resolvers.iterator(); iter.hasNext(); ) { - EntityResolver resolver = (EntityResolver) iter.next(); - InputSource is = resolver.resolveEntity(publicId, systemId); - - if (is != null) { - return is; - } - } - - return null; - } - - /** - * Add an EntityResolver to the chain. - * - * @param entityResolver The EntityResolver to add. - */ - public void addEntityResolver(EntityResolver entityResolver) { - resolvers.add(entityResolver); - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/FileUtils.java b/common/src/at/gv/egovernment/moa/util/FileUtils.java deleted file mode 100644 index a5e777c2d..000000000 --- a/common/src/at/gv/egovernment/moa/util/FileUtils.java +++ /dev/null @@ -1,116 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; - -/** - * Utility for accessing files on the file system, and for reading from input streams. - * @author Paul Ivancsics - * @version $Id$ - */ -public class FileUtils { - - /** - * Reads a file, given by URL, into a byte array. - * @param urlString file URL - * @return file content - * @throws IOException on any exception thrown - */ - public static byte[] readURL(String urlString) throws IOException { - URL url = new URL(urlString); - InputStream in = new BufferedInputStream(url.openStream()); - byte[] content = StreamUtils.readStream(in); - in.close(); - return content; - } - /** - * Reads a file, given by URL, into a String. - * @param urlString file URL - * @param encoding character encoding - * @return file content - * @throws IOException on any exception thrown - */ - public static String readURL(String urlString, String encoding) throws IOException { - byte[] content = readURL(urlString); - return new String(content, encoding); - } - /** - * Reads a file, given by filename, into a byte array. - * @param filename filename - * @return file content - * @throws IOException on any exception thrown - */ - public static byte[] readFile(String filename) throws IOException { - BufferedInputStream in = new BufferedInputStream(new FileInputStream(filename)); - byte[] content = StreamUtils.readStream(in); - in.close(); - return content; - } - /** - * Reads a file, given by filename, into a String. - * @param filename filename - * @param encoding character encoding - * @return file content - * @throws IOException on any exception thrown - */ - public static String readFile(String filename, String encoding) throws IOException { - byte[] content = readFile(filename); - return new String(content, encoding); - } - /** - * Reads a file from a resource. - * @param name resource name - * @return file content as a byte array - * @throws IOException on any exception thrown - */ - public static byte[] readResource(String name) throws IOException { - ClassLoader cl = FileUtils.class.getClassLoader(); - BufferedInputStream in = new BufferedInputStream(cl.getResourceAsStream(name)); - byte[] content = StreamUtils.readStream(in); - in.close(); - return content; - } - /** - * Reads a file from a resource. - * @param name filename - * @param encoding character encoding - * @return file content - * @throws IOException on any exception thrown - */ - public static String readResource(String name, String encoding) throws IOException { - byte[] content = readResource(name); - return new String(content, encoding); - } - - /** - * Returns the absolute URL of a given url which is relative to the parameter root - * @param url - * @param root - * @return String - */ - public static String makeAbsoluteURL(String url, String root) { - //if url is relative to rootConfigFileDirName make it absolute - - File keyFile; - String newURL = url; - - if(null == url) return null; - - if (url.startsWith("http:/") || url.startsWith("https:/") || url.startsWith("file:/") || url.startsWith("ftp:/")) { - return url; - } else { - // check if absolute - if not make it absolute - keyFile = new File(url); - if (!keyFile.isAbsolute()) { - keyFile = new File(root, url); - newURL = keyFile.getPath(); - } - return newURL; - } - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/KeyStoreUtils.java b/common/src/at/gv/egovernment/moa/util/KeyStoreUtils.java deleted file mode 100644 index d6a34a7b2..000000000 --- a/common/src/at/gv/egovernment/moa/util/KeyStoreUtils.java +++ /dev/null @@ -1,134 +0,0 @@ -package at.gv.egovernment.moa.util; - -import iaik.x509.X509Certificate; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.cert.Certificate; - -/** - * Utility for creating and loading key stores. - * - * @author Paul Ivancsics - * @version $Id$ - */ -public class KeyStoreUtils { - - /** - * Loads a key store from file. - * - * @param keystoreType key store type - * @param urlString URL of key store - * @param password password protecting the key store - * @return key store loaded - * @throws IOException thrown while reading the key store from file - * @throws GeneralSecurityException thrown while creating the key store - */ - public static KeyStore loadKeyStore( - String keystoreType, - String urlString, - String password) - throws IOException, GeneralSecurityException { - - URL keystoreURL = new URL(urlString); - InputStream in = keystoreURL.openStream(); - return loadKeyStore(keystoreType, in, password); - } - /** - * Loads a key store from an InputStream, and - * closes the InputStream. - * - * @param keystoreType key store type - * @param in input stream - * @param password password protecting the key store - * @return key store loaded - * @throws IOException thrown while reading the key store from the stream - * @throws GeneralSecurityException thrown while creating the key store - */ - public static KeyStore loadKeyStore( - String keystoreType, - InputStream in, - String password) - throws IOException, GeneralSecurityException { - - char[] chPassword = null; - if (password != null) - chPassword = password.toCharArray(); - KeyStore ks = KeyStore.getInstance(keystoreType); - ks.load(in, chPassword); - in.close(); - return ks; - } - /** - * Creates a key store from X509 certificate files, aliasing them with - * the index in the String[], starting with "0". - * - * @param keyStoreType key store type - * @param certFilenames certificate filenames - * @return key store created - * @throws IOException thrown while reading the certificates from file - * @throws GeneralSecurityException thrown while creating the key store - */ - public static KeyStore createKeyStore( - String keyStoreType, - String[] certFilenames) - throws IOException, GeneralSecurityException { - - KeyStore ks = KeyStore.getInstance(keyStoreType); - ks.load(null, null); - for (int i = 0; i < certFilenames.length; i++) { - Certificate cert = loadCertificate(certFilenames[i]); - ks.setCertificateEntry("" + i, cert); - } - return ks; - } - /** - * Creates a key store from a directory containg X509 certificate files, - * aliasing them with the index in the String[], starting with "0". - * All the files in the directory are considered to be certificates. - * - * @param keyStoreType key store type - * @param certDirURLString file URL of directory containing certificate filenames - * @return key store created - * @throws IOException thrown while reading the certificates from file - * @throws GeneralSecurityException thrown while creating the key store - */ - public static KeyStore createKeyStoreFromCertificateDirectory( - String keyStoreType, - String certDirURLString) - throws IOException, GeneralSecurityException { - - URL certDirURL = new URL(certDirURLString); - String certDirname = certDirURL.getFile(); - File certDir = new File(certDirname); - String[] certFilenames = certDir.list(); - String separator = - (certDirname.endsWith(File.separator) ? "" : File.separator); - for (int i = 0; i < certFilenames.length; i++) { - certFilenames[i] = certDirname + separator + certFilenames[i]; - } - return createKeyStore(keyStoreType, certFilenames); - } - - /** - * Loads an X509 certificate from file. - * @param certFilename filename - * @return the certificate loaded - * @throws IOException thrown while reading the certificate from file - * @throws GeneralSecurityException thrown while creating the certificate - */ - private static Certificate loadCertificate(String certFilename) - throws IOException, GeneralSecurityException { - - FileInputStream in = new FileInputStream(certFilename); - Certificate cert = new X509Certificate(in); - in.close(); - return cert; - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/MOADefaultHandler.java b/common/src/at/gv/egovernment/moa/util/MOADefaultHandler.java deleted file mode 100644 index 0474d92cd..000000000 --- a/common/src/at/gv/egovernment/moa/util/MOADefaultHandler.java +++ /dev/null @@ -1,82 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.io.IOException; - -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * A DefaultHandler that uses a MOAEntityResolver and - * a MOAErrorHandler. - * - * @author Patrick Peck - * @version $Id$ - */ -public class MOADefaultHandler extends DefaultHandler { - /** The EntityResolver to use. */ - private EntityResolver entityResolver; - /** The ErrorHandler to use. */ - private ErrorHandler errorHandler; - - /** - * Create a new MOADefaultHandler. - */ - public MOADefaultHandler() { - entityResolver = new MOAEntityResolver(); - errorHandler = new MOAErrorHandler(); - } - - /** - * Create a new MOADefaultHandler. - * - * @param entityResolver The EntityResolver to use for resolving - * external entities. - * @param errorHandler The ErrorHandler to use for reporting - * parsing errors. - */ - public MOADefaultHandler( - EntityResolver entityResolver, - ErrorHandler errorHandler) { - - this.entityResolver = entityResolver; - this.errorHandler = errorHandler; - } - - /** - * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) - */ - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException { - try { - return entityResolver.resolveEntity(publicId, systemId); - } catch (IOException e) { - return null; - } - } - - /** - * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException) - */ - public void warning(SAXParseException exception) throws SAXException { - errorHandler.warning(exception); - } - - /** - * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) - */ - public void error(SAXParseException exception) throws SAXException { - errorHandler.error(exception); - } - - /** - * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException) - */ - public void fatalError(SAXParseException exception) throws SAXException { - errorHandler.fatalError(exception); - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/MOAEntityResolver.java b/common/src/at/gv/egovernment/moa/util/MOAEntityResolver.java deleted file mode 100644 index 9406612e2..000000000 --- a/common/src/at/gv/egovernment/moa/util/MOAEntityResolver.java +++ /dev/null @@ -1,103 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.io.InputStream; - -import org.apache.xerces.util.URI; -import org.apache.xerces.util.URI.MalformedURIException; -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; - -import at.gv.egovernment.moa.logging.LogMsg; -import at.gv.egovernment.moa.logging.Logger; - -/** - * An EntityResolver that looks up entities stored as - * local resources. - * - *

          The following DTDs are mapped to local resources: - *

            - *
          • The XMLSchema.dtd
          • - *
          • The datatypes.dtd
          • - *
          - *

          - *

          For all other resources, an attempt is made to resolve them as resources, - * either absolute or relative to Constants.SCHEMA_ROOT. - * - * @author Patrick Peck - * @author Sven Aigner - */ -public class MOAEntityResolver implements EntityResolver { - - /** - * Resolve an entity. - * - * The systemId parameter is used to perform the lookup of the - * entity as a resource, either by interpreting the systemId as - * an absolute resource path, or by appending the last path component of - * systemId to Constants.SCHEMA_ROOT. - * - * @param publicId The public ID of the resource. - * @param systemId The system ID of the resource. - * @return An InputSource from which the entity can be read, or - * null, if the entity could not be found. - * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) - */ - public InputSource resolveEntity(String publicId, String systemId) { - InputStream stream; - int slashPos; - - if (Logger.isDebugEnabled()) { - Logger.debug( - new LogMsg("resolveEntity: p=" + publicId + " s=" + systemId)); - } - - if (publicId != null) { - // check if we can resolve some standard dtd's - if (publicId.equalsIgnoreCase("-//W3C//DTD XMLSchema 200102//EN")) { - return new InputSource( - getClass().getResourceAsStream( - Constants.SCHEMA_ROOT + "XMLSchema.dtd")); - } else if (publicId.equalsIgnoreCase("datatypes")) { - return new InputSource( - getClass().getResourceAsStream( - Constants.SCHEMA_ROOT + "datatypes.dtd")); - } - } else if (systemId != null) { - // get the URI path - try { - URI uri = new URI(systemId); - systemId = uri.getPath(); - if (!"file".equals(uri.getScheme()) || "".equals(systemId.trim())) { - return null; - } - } catch (MalformedURIException e) { - return null; - } - - // try to get the resource from the full path - stream = getClass().getResourceAsStream(systemId); - if (stream != null) { - InputSource source = new InputSource(stream); - - source.setSystemId(systemId); - return source; - } - - // try to get the resource from the last path component - slashPos = systemId.lastIndexOf('/'); - if (slashPos >= 0 && systemId.length() > slashPos) { - systemId = systemId.substring(slashPos + 1, systemId.length()); - stream = - getClass().getResourceAsStream(Constants.SCHEMA_ROOT + systemId); - if (stream != null) { - InputSource source = new InputSource(stream); - - source.setSystemId(systemId); - return source; - } - } - } - - return null; // nothing found - let the parser handle the entity - } -} \ No newline at end of file diff --git a/common/src/at/gv/egovernment/moa/util/MOAErrorHandler.java b/common/src/at/gv/egovernment/moa/util/MOAErrorHandler.java deleted file mode 100644 index 1f7757c8f..000000000 --- a/common/src/at/gv/egovernment/moa/util/MOAErrorHandler.java +++ /dev/null @@ -1,85 +0,0 @@ -package at.gv.egovernment.moa.util; - -import org.apache.xml.utils.DefaultErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import at.gv.egovernment.moa.logging.LogMsg; -import at.gv.egovernment.moa.logging.Logger; - -/** - * An ErrorHandler that logs a message and throws a - * SAXException upon error and fatal - * parsing errors. - * - * @author Patrick Peck - * @author Sven Aigner - */ -public class MOAErrorHandler extends DefaultErrorHandler { - - /** - * Logs a warning message. - * - * @see org.xml.sax.ErrorHandler#warning(SAXParseException) - */ - public void warning(SAXParseException exception) throws SAXException { - warn("parser.00", messageParams(exception), null); - } - - /** - * Logs a warning and rethrows the exception. - * - * @see org.xml.sax.ErrorHandler#error(SAXParseException) - */ - public void error(SAXParseException exception) throws SAXException { - warn("parser.01", messageParams(exception), null); - throw exception; - } - - /** - * Logs a warning and rethrows the exception. - * - * @see org.xml.sax.ErrorHandler#fatalError(SAXParseException) - */ - public void fatalError(SAXParseException exception) throws SAXException { - warn("parser.02", messageParams(exception), null); - throw exception; - } - - /** - * Log a warning message. - * - * @param messageId The message ID to log. - * @param parameters Additional message parameters. - * @param t The Throwable to log; usually the cause of this - * warning. - */ - private static void warn( - String messageId, - Object[] parameters, - Throwable t) { - - MessageProvider msg = MessageProvider.getInstance(); - Logger.warn(new LogMsg(msg.getMessage(messageId, parameters)), t); - } - - /** - * Put the system id, line and column number information from the exception - * into an Object array, to provide it as a - * MessageFormat parameter. - * - * @param e The SAXParseException containing the - * source system id and line/column numbers. - * @return An array containing the system id (a String) as well - * as line/column numbers (2 Integer objects) from the - * SAXParseException. - */ - private static Object[] messageParams(SAXParseException e) { - return new Object[] { - e.getMessage(), - e.getSystemId(), - new Integer(e.getLineNumber()), - new Integer(e.getColumnNumber())}; - } - -} \ No newline at end of file diff --git a/common/src/at/gv/egovernment/moa/util/MOATimer.java b/common/src/at/gv/egovernment/moa/util/MOATimer.java deleted file mode 100644 index d8bf64fc3..000000000 --- a/common/src/at/gv/egovernment/moa/util/MOATimer.java +++ /dev/null @@ -1,110 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.util.Map; -import java.util.WeakHashMap; - -/** - * A timer utility for named timers. - * - * @author Sven Aigner - */ -public class MOATimer { - - /** The single instance of this class. */ - private static MOATimer instance = null; - /** The starting points of single timings. */ - private static Map timemapstart = new WeakHashMap(); - /** The end points of single timings. */ - private static Map timemapend = new WeakHashMap(); - - /** - * Return the single instance of this class. - * - * @return The single instance of this class. - */ - public static MOATimer getInstance() { - if (instance == null) { - instance = new MOATimer(); - } - return instance; - } - - /** - * Create a new MOATimer. - * - * Protected to disallow multiple instances. - */ - protected MOATimer() { - super(); - } - - /** - * Start timing a certain action. - * - * The timing belonging to the action ID is garbage collected as soon as there - * exists no other reference to the action ID. - * - * @param id The action ID. - */ - public void startTiming(Object id) { - timemapstart.put(id, new Long(System.currentTimeMillis())); - } - - /** - * Stop timing an action. - * - * @param id The action ID. - */ - public void stopTiming(Object id) { - timemapend.put(id, new Long(System.currentTimeMillis())); - } - - /** - * Get the duration of an action. - * - * @param id The action ID for which to compute the duration. - * @return long The duration in milliseconds between calls to - * startTiming() and stopTiming(). If - * only startTiming() has been called for the action, then - * current difference to the system time is returned. If no timing exists for - * the action, - 1 is returned. - */ - public long duration(Object id) { - if (timemapstart.containsKey(id)) { - long start = ((Long) timemapstart.get(id)).longValue(); - if (timemapend.containsKey(id)) { - long end = ((Long) timemapend.get(id)).longValue(); - return end - start; - } else { - return System.currentTimeMillis() - start; - } - } else - return -1; - } - - /** - * Get the duration of an action, as a nicely formatted String. - * - * @param id The action ID. - * @return String The duration() as a String. - */ - public String durationAsString(Object id) { - long dur = duration(id); - long second = dur / 1000; - long mil = (dur) - (second * 1000); - return "Duration: " + second + "." + mil + " seconds"; - } - - /** - * Remove a timing. - * - * @param id The action ID. - */ - public void clearTiming(String id) { - if (timemapstart.containsKey(id)) - timemapstart.remove(id); - if (timemapend.containsKey(id)) - timemapend.remove(id); - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/MessageProvider.java b/common/src/at/gv/egovernment/moa/util/MessageProvider.java deleted file mode 100644 index f5117e390..000000000 --- a/common/src/at/gv/egovernment/moa/util/MessageProvider.java +++ /dev/null @@ -1,63 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.util.Locale; - -/** - * A singleton wrapper around a Message object. - * - * Provides the messages used in the common project. - * - * @author Patrick Peck - * @version $Id$ - */ -public class MessageProvider { - /** The location of the default message resources. */ - private static final String[] DEFAULT_MESSAGE_RESOURCES = - { "resources/properties/common_messages" }; - /** The locale of the default message resources. */ - private static final Locale[] DEFAULT_MESSAGE_LOCALES = - new Locale[] { new Locale("de", "AT") }; - /** The single instance of this class. */ - private static MessageProvider instance; - - /** The messages provided by this MessageProvider. */ - private Messages messages; - - /** - * Return the single instance of the MessageProvider. - * - * Intialilizes the MessageProvider with the default message - * locations: /resources/properties/common_messages. - * - * @return The single MessageProvider. - */ - public static synchronized MessageProvider getInstance() { - if (instance == null) { - instance = - new MessageProvider(DEFAULT_MESSAGE_RESOURCES, DEFAULT_MESSAGE_LOCALES); - } - return instance; - } - - /** - * Create a MessageProvider. - * - * @param resourceNames The names of the resources containing the messages. - * @param locales The corresponding locales. - */ - protected MessageProvider(String[] resourceNames, Locale[] locales) { - this.messages = new Messages(resourceNames, locales); - } - - /** - * Get the message corresponding to a given message ID. - * - * @param messageId The ID of the message. - * @param parameters The parameters to fill in into the message arguments. - * @return The formatted message. - */ - public String getMessage(String messageId, Object[] parameters) { - return messages.getMessage(messageId, parameters); - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/Messages.java b/common/src/at/gv/egovernment/moa/util/Messages.java deleted file mode 100644 index a0139ae93..000000000 --- a/common/src/at/gv/egovernment/moa/util/Messages.java +++ /dev/null @@ -1,117 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.text.MessageFormat; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.PropertyResourceBundle; - -import at.gv.egovernment.moa.logging.Logger; - -/** - * Provides access to the system messages resource used for exception handling - * and logging messages. - * - * Messages must be provided as a resource bundle at the path. - * - * @author Patrick Peck - * @version $Id$ - */ -public class Messages { - /** Error message indicating that no messages are avaiable. */ - private static final String ERROR_MESSAGES_UNAVAILABLE = - "Fehler in der Server-Konfiguration. " - + "Die Fehlertexte konnten nicht geladen werden."; - /** Error message indicating that the message is not available. */ - private static final String ERROR_NO_MESSAGE = - "Keine Fehlermeldung für Fehler-Nr.={0}"; - - /** The names of the resources containing the messages. */ - private String[] resourceNames; - /** The corresponding Locales of the resources. */ - private Locale[] locales; - /** The ResourceBundles containing the messages. */ - private ResourceBundleChain messages; - - /** - * Create a new Message object containing the messages - * in the given resources. - * - * @param resourceNames The names of the resources containing the messages. - * @param locales The corresponding locales. - */ - public Messages(String[] resourceNames, Locale[] locales) { - this.resourceNames = resourceNames; - this.locales = locales; - this.messages = null; - } - - /** - * Get the message corresponding to a given message ID. - * - * @param messageId The ID of the message. - * @param parameters The parameters to fill in into the message arguments. - * @return The formatted message. - */ - public String getMessage(String messageId, Object[] parameters) { - // initialize messages - if (messages == null) { - initMessages(); - } - - // create the message - if (messages == null) { - return ERROR_MESSAGES_UNAVAILABLE; - } else { - try { - String rawMessage = messages.getString(messageId); - return MessageFormat.format(rawMessage, parameters); - } catch (MissingResourceException e2) { - // couldn't find any message -> set to default error message - return MessageFormat.format( - ERROR_NO_MESSAGE, - new Object[] { messageId }); - } - } - } - - /** - * Return the names of the resources containing the messages. - * - * @return String[] The names of the resource bundles containing the messages. - */ - private String[] getResourceNames() { - return resourceNames; - } - - /** - * Return the Locales of the resources containing the messages. - * - * @return Locale[] The Locales of the resource bundles - * containing the messages. - */ - private Locale[] getLocales() { - return locales; - } - - /** - * Initialize the messages ResourceBundle containing - * the MOA error messages. - */ - private void initMessages() { - messages = new ResourceBundleChain(); - int i; - - // initialize the message resources - for (i = 0; i < resourceNames.length; i++) { - try { - messages.addResourceBundle( - PropertyResourceBundle.getBundle( - getResourceNames()[i], - getLocales()[i])); - } catch (MissingResourceException e) { - Logger.error(ERROR_MESSAGES_UNAVAILABLE, e); - } - } - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/NodeIteratorAdapter.java b/common/src/at/gv/egovernment/moa/util/NodeIteratorAdapter.java deleted file mode 100644 index f71aa472d..000000000 --- a/common/src/at/gv/egovernment/moa/util/NodeIteratorAdapter.java +++ /dev/null @@ -1,87 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.util.ListIterator; - -import org.w3c.dom.DOMException; -import org.w3c.dom.Node; -import org.w3c.dom.traversal.NodeFilter; -import org.w3c.dom.traversal.NodeIterator; - -/** - * A NodeIterator implementation based on a - * ListIterator. - * - * @see java.util.ListIterator - * @see org.w3c.dom.traversal.NodeIterator - * - * @author Patrick Peck - * @version $Id$ - */ -public class NodeIteratorAdapter implements NodeIterator { - - /** The ListIterator to wrap. */ - private ListIterator nodeIterator; - - /** - * Create a new NodeIteratorAdapter. - * @param nodeIterator The ListIterator to iterate over. - */ - public NodeIteratorAdapter(ListIterator nodeIterator) { - this.nodeIterator = nodeIterator; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#getRoot() - */ - public Node getRoot() { - return null; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#getWhatToShow() - */ - public int getWhatToShow() { - return NodeFilter.SHOW_ALL; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#getFilter() - */ - public NodeFilter getFilter() { - return null; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#getExpandEntityReferences() - */ - public boolean getExpandEntityReferences() { - return false; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#nextNode() - */ - public Node nextNode() throws DOMException { - if (nodeIterator.hasNext()) { - return (Node) nodeIterator.next(); - } - return null; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#previousNode() - */ - public Node previousNode() throws DOMException { - if (nodeIterator.hasPrevious()) { - return (Node) nodeIterator.previous(); - } - return null; - } - - /** - * @see org.w3c.dom.traversal.NodeIterator#detach() - */ - public void detach() { - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/NodeListAdapter.java b/common/src/at/gv/egovernment/moa/util/NodeListAdapter.java deleted file mode 100644 index 7102cadca..000000000 --- a/common/src/at/gv/egovernment/moa/util/NodeListAdapter.java +++ /dev/null @@ -1,44 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.util.List; - -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * A NodeList implementation based on a List. - * - * @see java.util.List - * @see org.w3c.dom.NodeList - * - * @author Patrick Peck - * @version $Id$ - */ -public class NodeListAdapter implements NodeList { - /** The List to wrap. */ - private List nodeList; - - /** - * Create a new NodeListAdapter. - * - * @param nodeList The List containing the nodes. - */ - public NodeListAdapter(List nodeList) { - this.nodeList = nodeList; - } - - /** - * @see org.w3c.dom.NodeList#item(int) - */ - public Node item(int index) { - return (Node) nodeList.get(index); - } - - /** - * @see org.w3c.dom.NodeList#getLength() - */ - public int getLength() { - return nodeList.size(); - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/OutputXML2File.java b/common/src/at/gv/egovernment/moa/util/OutputXML2File.java deleted file mode 100644 index f9d330d41..000000000 --- a/common/src/at/gv/egovernment/moa/util/OutputXML2File.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Created on 26.04.2004 - * - * @author rschamberger - * $ID$ - */ -package at.gv.egovernment.moa.util; - -import org.w3c.dom.Element; - -import at.gv.egovernment.moa.logging.Logger; - -/** - * utility functions to write XML data to files - * @author rschamberger - * @version $Id$ - */ -public class OutputXML2File { - - /** - * writes an XML structure to file if debug is enabled in hierarchy (Encoding: UTF-8) - * - * @param filename file name - * @param rootElem root element in DOM tree - * @param hierarchy of the Logger - */ - public static void debugOutputXML2File(String filename, Element rootElem, String hierarchy) { - if (Logger.isDebugEnabled(hierarchy)) { - outputXML2File(filename, rootElem); - } - } - - /** - * writes an XML structure to file if debug is enabled in hierarchy (Encoding: UTF-8) - * - * @param filename file name - * @param xmlString XML string - * @param hierarchy of the Logger - */ - public static void debugOutputXML2File(String filename, String xmlString, String hierarchy) { - if (Logger.isDebugEnabled(hierarchy)) { - outputXML2File(filename, xmlString); - } - } - - /** - * writes an XML structure to file (Encoding: UTF-8) - * - * @param filename file name - * @param rootElem root element in DOM tree - */ - public static void outputXML2File(String filename, Element rootElem) { - try { - String xmlString = new String(DOMUtils.serializeNode(rootElem)); - outputXML2File(filename, xmlString); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - /** - * writes an XML structure to file (Encoding: UTF-8) - * - * @param filename file name - * @param xmlString XML string - */ - public static void outputXML2File(String filename, String xmlString) { - try { - java.io.OutputStream fout = new java.io.FileOutputStream(filename); - byte[] xmlData = xmlString.getBytes("UTF-8"); - fout.write(xmlData); - fout.close(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java b/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java deleted file mode 100644 index 90b28548a..000000000 --- a/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java +++ /dev/null @@ -1,66 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * A class to chain ResourceBundles. - * - * @author Patrick Peck - * @version $Id$ - */ -public class ResourceBundleChain { - /** Error message indicating the resource is not available. */ - private static final String ERROR_MISSING_RESOURCE = "Missing resource"; - /** The ResourceBundles contained in this chain. */ - private List resourceBundles = new ArrayList(); - - /** - * Add a ResourceBundle to the chain. - * - * @param resourceBundle The ResourceBundle to add. - */ - public void addResourceBundle(ResourceBundle resourceBundle) { - resourceBundles.add(resourceBundle); - } - - /** - * Return the value of the resource. - * - * @param key The key to access the String resource. - * @return The resource value. All the registered ResourceBundles - * are searched in the order in which they have previously been added to this - * ResourceBundleChain. - * @throws MissingResourceException The resource coult not be found in any of - * the bundles. - */ - public String getString(String key) throws MissingResourceException { - MissingResourceException lastException = null; - Iterator iter; - - // handle case where no resource bundles have been added - if (resourceBundles.size() == 0) { - throw new MissingResourceException( - ERROR_MISSING_RESOURCE, - this.getClass().getName(), - key); - } - - // try to find the resource in one of the bundles; if it cannot be found, - // return the exception thrown by the last bundle in the list - for (iter = resourceBundles.iterator(); iter.hasNext();) { - ResourceBundle resourceBundle = (ResourceBundle) iter.next(); - try { - String value = resourceBundle.getString(key); - return value; - } catch (MissingResourceException e) { - lastException = e; - } - } - throw lastException; - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/SSLUtils.java b/common/src/at/gv/egovernment/moa/util/SSLUtils.java deleted file mode 100644 index ada21b412..000000000 --- a/common/src/at/gv/egovernment/moa/util/SSLUtils.java +++ /dev/null @@ -1,221 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.io.IOException; -import java.io.InputStream; -import java.security.GeneralSecurityException; -import java.security.KeyStore; - -import javax.net.ssl.KeyManager; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; - -/** - * Utility for connecting to server applications via SSL. - * - * @author Paul Ivancsics - * @version $Id$ - */ -public class SSLUtils { - - /** - * Creates an SSLSocketFactory which utilizes the given trust store. - * - * @param trustStoreType key store type of trust store - * @param trustStoreInputStream input stream for reading JKS trust store containing - * trusted server certificates; if null, the default - * trust store will be utilized - * @param trustStorePassword if provided, it will be used to check - * the integrity of the trust store; if omitted, it will not be checked - * @return SSLSocketFactory to be used by an HttpsURLConnection - * @throws IOException thrown while reading from the input stream - * @throws GeneralSecurityException thrown while creating the socket factory - */ - public static SSLSocketFactory getSSLSocketFactory( - String trustStoreType, - InputStream trustStoreInputStream, - String trustStorePassword) - throws IOException, GeneralSecurityException { - - TrustManager[] tms = getTrustManagers(trustStoreType, trustStoreInputStream, trustStorePassword); - SSLContext ctx = SSLContext.getInstance("TLS"); - ctx.init(null, tms, null); - - SSLSocketFactory sf = ctx.getSocketFactory(); - return sf; - } - /** - * Creates an SSLSocketFactory which utilizes the - * given trust store and keystore. - * - * @param trustStore trust store containing trusted server certificates; - * if null, the default trust store will be utilized - * @param clientKeyStoreType key store type of clientKeyStore - * @param clientKeyStoreURL URL of key store containing keys to be used for - * client authentication; if null, the default key store will be utilized - * @param clientKeyStorePassword if provided, it will be used to check - * the integrity of the client key store; if omitted, it will not be checked - * @return SSLSocketFactory to be used by an HttpsURLConnection - * @throws IOException thrown while reading key store file - * @throws GeneralSecurityException thrown while creating the socket factory - */ - public static SSLSocketFactory getSSLSocketFactory( - KeyStore trustStore, - String clientKeyStoreType, - String clientKeyStoreURL, - String clientKeyStorePassword) - throws IOException, GeneralSecurityException { - - SSLContext ctx = getSSLContext( - trustStore, clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); - SSLSocketFactory sf = ctx.getSocketFactory(); - return sf; - } - /** - * Creates an SSLContext initialized for the - * given trust store and keystore. - * - * @param trustStore trust store containing trusted server certificates; - * if null, the default trust store will be utilized - * @param clientKeyStoreType key store type of clientKeyStore - * @param clientKeyStoreURL URL of key store containing keys to be used for - * client authentication; if null, the default key store will be utilized - * @param clientKeyStorePassword if provided, it will be used to check - * the integrity of the client key store; if omitted, it will not be checked - * @return SSLContext to be used for creating an SSLSocketFactory - * @throws IOException thrown while reading key store file - * @throws GeneralSecurityException thrown while creating the SSL context - */ - public static SSLContext getSSLContext( - KeyStore trustStore, - String clientKeyStoreType, - String clientKeyStoreURL, - String clientKeyStorePassword) - throws IOException, GeneralSecurityException { - - //System.setProperty("javax.net.debug", "all"); - TrustManager[] tms = getTrustManagers(trustStore); - KeyManager[] kms = getKeyManagers(clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); - SSLContext ctx = SSLContext.getInstance("TLS"); - ctx.init(kms, tms, null); - return ctx; - } - /** - * Loads the trust store from an input stream and gets the - * TrustManagers from a default TrustManagerFactory, - * initialized from the given trust store. - * @param trustStoreType key store type of trust store - * @param trustStoreInputStream input stream for reading JKS trust store containing - * trusted server certificates; if null, the default - * trust store will be utilized - * @param trustStorePassword if provided, it will be used to check - * the integrity of the trust store; if omitted, it will not be checked - * @return TrustManagers to be used for creating an - * SSLSocketFactory utilizing the given trust store - * @throws IOException thrown while reading from the input stream - * @throws GeneralSecurityException thrown while initializing the - * default TrustManagerFactory - */ - protected static TrustManager[] getTrustManagers( - String trustStoreType, - InputStream trustStoreInputStream, - String trustStorePassword) - throws IOException, GeneralSecurityException { - - if (trustStoreInputStream == null) - return null; - - // Set up the TrustStore to use. We need to load the file into - // a KeyStore instance. - KeyStore trustStore = KeyStoreUtils.loadKeyStore(trustStoreType, trustStoreInputStream, trustStorePassword); - return getTrustManagers(trustStore); - } - /** - * Gets the TrustManagers from a default TrustManagerFactory, - * initialized from the given trust store. - * - * @param trustStore the trust store to use - * @return TrustManagers to be used for creating an - * SSLSocketFactory utilizing the given trust store - * @throws GeneralSecurityException thrown while initializing the - * default TrustManagerFactory - */ - protected static TrustManager[] getTrustManagers(KeyStore trustStore) - throws GeneralSecurityException { - - if (trustStore == null) - return null; - - // Initialize the default TrustManagerFactory with this KeyStore - String alg=TrustManagerFactory.getDefaultAlgorithm(); - TrustManagerFactory tmFact=TrustManagerFactory.getInstance(alg); - tmFact.init(trustStore); - - // And now get the TrustManagers - TrustManager[] tms=tmFact.getTrustManagers(); - return tms; - } - /** - * Loads the client key store from file and gets the - * KeyManagers from a default KeyManagerFactory, - * initialized from the given client key store. - * @param clientKeyStoreType key store type of clientKeyStore - * @param clientKeyStoreURL URL of key store containing keys to be used for - * client authentication; if null, the default key store will be utilized - * @param clientKeyStorePassword password used to check the integrity of the client key store; - * if null, it will not be checked - * @return KeyManagers to be used for creating an - * SSLSocketFactory utilizing the given client key store - * @throws IOException thrown while reading from the key store file - * @throws GeneralSecurityException thrown while initializing the - * default KeyManagerFactory - */ - public static KeyManager[] getKeyManagers ( - String clientKeyStoreType, - String clientKeyStoreURL, - String clientKeyStorePassword) - throws IOException, GeneralSecurityException { - - if (clientKeyStoreURL == null) - return null; - - // Set up the KeyStore to use. We need to load the file into - // a KeyStore instance. - KeyStore clientKeyStore = KeyStoreUtils.loadKeyStore( - clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); - return getKeyManagers(clientKeyStore, clientKeyStorePassword); - } - /** - * Gets the KeyManagers from a default KeyManagerFactory, - * initialized from the given client key store. - * @param clientKeyStore client key store - * @param clientKeyStorePassword if provided, it will be used to check - * the integrity of the client key store; if omitted, it will not be checked - * @return KeyManagers to be used for creating an - * SSLSocketFactory utilizing the given client key store - * @throws GeneralSecurityException thrown while initializing the - * default KeyManagerFactory - */ - public static KeyManager[] getKeyManagers ( - KeyStore clientKeyStore, - String clientKeyStorePassword) - throws GeneralSecurityException { - - if (clientKeyStore == null) - return null; - - // Now we initialize the default KeyManagerFactory with this KeyStore - String alg=KeyManagerFactory.getDefaultAlgorithm(); - KeyManagerFactory kmFact=KeyManagerFactory.getInstance(alg); - char[] password = null; - if (clientKeyStorePassword != null) - password = clientKeyStorePassword.toCharArray(); - kmFact.init(clientKeyStore, password); - - // And now get the KeyManagers - KeyManager[] kms=kmFact.getKeyManagers(); - return kms; - } -} diff --git a/common/src/at/gv/egovernment/moa/util/StreamEntityResolver.java b/common/src/at/gv/egovernment/moa/util/StreamEntityResolver.java deleted file mode 100644 index 38c4e863c..000000000 --- a/common/src/at/gv/egovernment/moa/util/StreamEntityResolver.java +++ /dev/null @@ -1,64 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; - -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * An EntityResolver that maps system IDs to - * InputStreams. - * - * @author Patrick Peck - * @version $Id$ - */ -public class StreamEntityResolver implements EntityResolver { - - /** A mapping from Public ID or System ID to an InputStream - * containing the entity. */ - private Map mappedEntities; - - /** - * Create a StreamEntityResolver. - * - * @param mappedEntities A mapping from public or system IDs - * (String objects) to InputStreams. - */ - public StreamEntityResolver(Map mappedEntities) { - this.mappedEntities = mappedEntities; - } - - /** - * Resolve an entity by looking it up in the mapped entities. - * - * First, the public ID is looked up in the mapping, then the system ID. - * - * @param publicId The public ID of the entity. - * @param systemId The system ID of the entity. - * @return An InputStream containing the entity or - * null if no entity could be found. - * @throws SAXException Signalling a parsing exception. - * @throws IOException Error reading the entity. - */ - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException, IOException { - - InputSource src = null; - - if (publicId != null && mappedEntities.get(publicId) != null) { - src = new InputSource((InputStream) mappedEntities.get(publicId)); - } else if (systemId != null && mappedEntities.get(systemId) != null) { - src = new InputSource((InputStream) mappedEntities.get(systemId)); - } - - if (src != null) { - src.setPublicId(publicId); - src.setSystemId(systemId); - } - - return src; - } -} diff --git a/common/src/at/gv/egovernment/moa/util/StreamUtils.java b/common/src/at/gv/egovernment/moa/util/StreamUtils.java deleted file mode 100644 index a22f1c2a8..000000000 --- a/common/src/at/gv/egovernment/moa/util/StreamUtils.java +++ /dev/null @@ -1,128 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintStream; - -/** - * Utility methods for streams. - * - * @author Patrick Peck - * @version $Id$ - */ -public class StreamUtils { - - /** - * Compare the contents of two InputStreams. - * - * @param is1 The 1st InputStream to compare. - * @param is2 The 2nd InputStream to compare. - * @return boolean true, if both streams contain the exactly the - * same content, false otherwise. - * @throws IOException An error occurred reading one of the streams. - */ - public static boolean compareStreams(InputStream is1, InputStream is2) - throws IOException { - - byte[] buf1 = new byte[256]; - byte[] buf2 = new byte[256]; - int length1; - int length2; - - try { - while (true) { - length1 = is1.read(buf1); - length2 = is2.read(buf2); - - if (length1 != length2) { - return false; - } - if (length1 <= 0) { - return true; - } - if (!compareBytes(buf1, buf2, length1)) { - return false; - } - } - } catch (IOException e) { - throw e; - } finally { - // close both streams - try { - is1.close(); - is2.close(); - } catch (IOException e) { - // ignore this - } - } - } - - /** - * Compare two byte arrays, up to a given maximum length. - * - * @param b1 1st byte array to compare. - * @param b2 2nd byte array to compare. - * @param length The maximum number of bytes to compare. - * @return true, if the byte arrays are equal, false - * otherwise. - */ - private static boolean compareBytes(byte[] b1, byte[] b2, int length) { - if (b1.length != b2.length) { - return false; - } - - for (int i = 0; i < b1.length && i < length; i++) { - if (b1[i] != b2[i]) { - return false; - } - } - - return true; - } - - /** - * Reads a byte array from a stream. - * @param in The InputStream to read. - * @return The bytes contained in the given InputStream. - * @throws IOException on any exception thrown - */ - public static byte[] readStream(InputStream in) throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - int b; - while ((b = in.read()) >= 0) - out.write(b); - in.close(); - return out.toByteArray(); - } - - /** - * Reads a String from a stream, using given encoding. - * @param in The InputStream to read. - * @param encoding The character encoding to use for converting the bytes - * of the InputStream into a String. - * @return The content of the given InputStream converted into - * a String. - * @throws IOException on any exception thrown - */ - public static String readStream(InputStream in, String encoding) throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - int b; - while ((b = in.read()) >= 0) - out.write(b); - in.close(); - return out.toString(encoding); - } - - /** - * Gets the stack trace of the Throwable passed in as a string. - * @param t The Throwable. - * @return a String representing the stack trace of the Throwable. - */ - public static String getStackTraceAsString(Throwable t) - { - ByteArrayOutputStream stackTraceBIS = new ByteArrayOutputStream(); - t.printStackTrace(new PrintStream(stackTraceBIS)); - return new String(stackTraceBIS.toByteArray()); - } -} diff --git a/common/src/at/gv/egovernment/moa/util/StringUtils.java b/common/src/at/gv/egovernment/moa/util/StringUtils.java deleted file mode 100644 index 61b1a18ea..000000000 --- a/common/src/at/gv/egovernment/moa/util/StringUtils.java +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (C) 2002 IAIK -// email: jce-info@iaik.tu-graz.ac.at -// -// All rights reserved. -// -// This source is provided for inspection purposes and recompilation only, -// unless specified differently in a contract with IAIK. This source has to -// be kept in strict confidence and must not be disclosed to any third party -// under any circumstances. Redistribution in source and binary forms, with -// or without modification, are permitted in any case! -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -// SUCH DAMAGE. -// - -package at.gv.egovernment.moa.util; - -import java.util.StringTokenizer; - -/** - * Utitility functions for string manipulations. - * - * @author Harald Bratko - */ -public class StringUtils { - - /** - * Removes all blanks and tabs from the given string. - * - * @param s The string to remove all blanks and tabs from. - * @return The input string with all blanks and tabs removed from. - */ - public static String removeBlanks(String s) { - StringTokenizer st = new StringTokenizer(s); - StringBuffer sb = new StringBuffer(s.length()); - while (st.hasMoreTokens()) { - sb.append(st.nextToken()); - } - return sb.toString(); - } - - /** - * Removes all occurences of the specified token from the the given string. - * - * @param s The string to remove all occurences of the specified token from. - * @return The input string with all occurences of the specified token removed from. - */ - public static String removeToken(String s, String token) { - StringTokenizer st = new StringTokenizer(s, token); - StringBuffer sb = new StringBuffer(s.length()); - while (st.hasMoreTokens()) { - sb.append(st.nextToken()); - } - return sb.toString(); - } - - /** - * Removes all leading zeros from the input string. - * - * @param s The string remove the leading zeros from. - * @return The input string with the leading zeros removed from. - */ - public static String deleteLeadingZeros(String s) { - StringBuffer sb = new StringBuffer(s); - int l = sb.length(); - int j = 0; - for (int i=0; is that matches the given - * search string by the given replace string. - * - * @param s The string where the replacment should take place. - * @param search The pattern that should be replaced. - * @param replace The string that should replace all each search - * string within s. - * @return A string whrer all occurrence of search are - * replaced with replace. - */ - public static String replaceAll (String s, String search, String replace) - { - StringBuffer sb = new StringBuffer(); - int i = 0, j = 0; - int len = search.length(); - while (j > -1) - { - j = s.indexOf(search, i); - - if (j > -1) - { - sb.append(s.substring(i,j)); - sb.append(replace); - i = j + len; - } - } - - sb.append(s.substring(i, s.length())); - - return sb.toString(); - } - - /** - * Changes the SecurityLayer version in the given string. - * This method usually takes as input an XML structure represented in a string - * format and changes the SecurityLayer namespaces prefixes and URIs from - * one SecurityLayer version to another. - * e.g.: code>sl10 to sl and - * http://www.buergerkarte.at/namespaces/securitylayer/20020225# - * to - * http://www.buergerkarte.at/namespaces/securitylayer/1.2# - * - * @param s The string (usally an XML structure) where the - * SecurityLayer version should be changed. - * @param slPrefixOld The SecurityLayer namespace prefix that should be - * replaced by the new one. - * @param slPrefixNew The new SecurityLayer namespace prefix that should - * replace the old one. - * @param slNSUriOld The SecurityLayer namespace URI that should be - * replaced by the new one. - * @param slNSUriNew The new SecurityLayer namespace URI that should - * replace the old one. - * @return A string where the SecurityLayer namespace prefixes - * and URIs are replaced by new ones. - */ - public static String changeSLVersion(String s, String slPrefixOld, String slPrefixNew, String slNSUriOld, String slNSUriNew) { - String retString = replaceAll(s, slPrefixOld, slPrefixNew); - retString = replaceAll(retString, slNSUriOld, slNSUriNew); - return retString ; - } - - /** - * Removes the XML declaration from an XML expression. - * - * @param xmlString XML expression as String - * - * @return XML expression, XML declaration removed - */ - public static String removeXMLDeclaration(String xmlString) { - if (xmlString.startsWith("application/x-www-form-urlencoded string using a specific encoding scheme. - * @param s the string to decode - * @param encoding name of character encoding - * @return the newly decoded string - * @throws UnsupportedEncodingException if the encoding is not supported - */ - public static String decode(String s, String encoding) throws UnsupportedEncodingException { - StringReader in = new StringReader(s); - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - for (int b = read(in); b >= 0; b = read(in)) - bout.write(b); - return bout.toString(encoding); - } - /** - * Decodes the next byte from the string reader. - * @param in string reader - * @return the next byte decoded; - * -1 upon end of string, on erroneous data, and on any exception caught - * @todo syntax check on string - */ - private static int read(StringReader in) { - try { - int b = in.read(); - if (b == '+') - return ' '; - if (b == '%') { - char[] hex = new char[2]; - if (in.read(hex, 0, 2) >= 0) { - String hexString = new String(hex); - return Integer.valueOf(hexString, 16).intValue(); - } - else - return -1; - } - return b; - } - catch (IOException ex) { - return -1; - } - catch (NumberFormatException ex) { - return -1; - } - } -} diff --git a/common/src/at/gv/egovernment/moa/util/URLEncoder.java b/common/src/at/gv/egovernment/moa/util/URLEncoder.java deleted file mode 100644 index 840c0c3bc..000000000 --- a/common/src/at/gv/egovernment/moa/util/URLEncoder.java +++ /dev/null @@ -1,63 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.io.ByteArrayInputStream; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; - -/** - * Translates a string into mime format "x-www-form-urlencoded". - * Provides a function missing in JDK 1.3. - * @author Paul Ivancsics - * @version $Id$ - */ -public class URLEncoder { - - /** - * Translates a string into x-www-form-urlencoded format. - * @param s the string to be translated - * @param encoding the encoding to use - * @return the translated string - * @throws UnsupportedEncodingException when the desired encoding is not supported - */ - public static String encode(String s, String encoding) throws UnsupportedEncodingException { - byte[] barr = s.getBytes(encoding); - ByteArrayInputStream bin = new ByteArrayInputStream(barr); - StringWriter out = new StringWriter(); - for (int b = bin.read(); b >= 0; b = bin.read()) - encode(b, out); - return out.toString(); - } - - /** - * Encode a character. - * @param ch The character to encode. - * @param out The StringWriter containing the result. - */ - private static void encode(int ch, StringWriter out) { - if ((ch >= 'a' && ch <= 'z') - || (ch >= 'A' && ch <= 'Z') - || (ch >= '0' && ch <= '9') - || ch == '.' || ch == '-' || ch == '*' || ch == '_') - out.write(ch); - else if (ch == ' ') - out.write('+'); - else - encodeHex(ch, out); - } - - /** - * Encode a character as an escaped hex value. - * @param ch The character to encode. - * @param out The StringWriter containing the result. - */ - private static void encodeHex(int ch, StringWriter out) { - out.write('%'); - String hex = Integer.toHexString(ch).toUpperCase(); - if (hex.length() < 2) - out.write('0'); - else - out.write(hex.charAt(hex.length() - 2)); - out.write(hex.charAt(hex.length() - 1)); - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/XPathException.java b/common/src/at/gv/egovernment/moa/util/XPathException.java deleted file mode 100644 index e10c882e5..000000000 --- a/common/src/at/gv/egovernment/moa/util/XPathException.java +++ /dev/null @@ -1,58 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.io.PrintStream; -import java.io.PrintWriter; - -/** - * An exception occurred evaluating an XPath. - * - * @author Patrick Peck - * @version $Id$ - */ -public class XPathException extends RuntimeException { - /** The wrapped exception. */ - private Throwable wrapped; - - /** - * Create a XPathException. - * - * @param message The exception message. - * @param wrapped The exception being the likely cause of this exception. - */ - public XPathException(String message, Throwable wrapped) { - super(message); - this.wrapped = wrapped; - } - - /** - * Return the wrapped exception. - * - * @return The wrapped exception being the likely cause of this exception. - */ - public Throwable getWrapped() { - return wrapped; - } - - /** - * @see java.lang.Throwable#printStackTrace(java.io.PrintStream) - */ - public void printStackTrace(PrintStream s) { - super.printStackTrace(s); - if (getWrapped() != null) { - s.print("Caused by: "); - getWrapped().printStackTrace(s); - } - } - - /** - * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter) - */ - public void printStackTrace(PrintWriter s) { - super.printStackTrace(s); - if (getWrapped() != null) { - s.print("Caused by: "); - getWrapped().printStackTrace(s); - } - } - -} diff --git a/common/src/at/gv/egovernment/moa/util/XPathUtils.java b/common/src/at/gv/egovernment/moa/util/XPathUtils.java deleted file mode 100644 index 5212ed13e..000000000 --- a/common/src/at/gv/egovernment/moa/util/XPathUtils.java +++ /dev/null @@ -1,526 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.util.List; -import java.util.Map; - -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.traversal.NodeIterator; - -import org.jaxen.JaxenException; -import org.jaxen.NamespaceContext; -import org.jaxen.SimpleNamespaceContext; -import org.jaxen.dom.DOMXPath; -import org.jaxen.dom.DocumentNavigator; - -/** - * Utility methods to evaluate XPath expressions on DOM nodes. - * - * @author Patrick Peck - * @version $Id$ - */ -public class XPathUtils { - - /** - * The XPath expression selecting all nodes under a given root (including the - * root node itself). - */ - public static final String ALL_NODES_XPATH = - "(.//. | .//@* | .//namespace::*)"; - - /** The DocumentNavigator to use for navigating the document. */ - private static DocumentNavigator documentNavigator = - DocumentNavigator.getInstance(); - /** The default namespace prefix to namespace URI mappings. */ - private static NamespaceContext NS_CONTEXT; - - static { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(); - ctx.addNamespace(Constants.MOA_PREFIX, Constants.MOA_NS_URI); - ctx.addNamespace(Constants.MOA_CONFIG_PREFIX, Constants.MOA_CONFIG_NS_URI); - ctx.addNamespace(Constants.MOA_ID_CONFIG_PREFIX, Constants.MOA_ID_CONFIG_NS_URI); - ctx.addNamespace(Constants.SL10_PREFIX, Constants.SL10_NS_URI); - ctx.addNamespace(Constants.SL11_PREFIX, Constants.SL11_NS_URI); - ctx.addNamespace(Constants.SL12_PREFIX, Constants.SL12_NS_URI); - ctx.addNamespace(Constants.ECDSA_PREFIX, Constants.ECDSA_NS_URI); - ctx.addNamespace(Constants.PD_PREFIX, Constants.PD_NS_URI); - ctx.addNamespace(Constants.SAML_PREFIX, Constants.SAML_NS_URI); - ctx.addNamespace(Constants.SAMLP_PREFIX, Constants.SAMLP_NS_URI); - ctx.addNamespace(Constants.DSIG_PREFIX, Constants.DSIG_NS_URI); - ctx.addNamespace(Constants.XSLT_PREFIX, Constants.XSLT_NS_URI); - ctx.addNamespace(Constants.XSI_PREFIX, Constants.XSI_NS_URI); - ctx.addNamespace(Constants.DSIG_FILTER2_PREFIX, Constants.DSIG_FILTER2_NS_URI); - ctx.addNamespace(Constants.DSIG_EC_PREFIX, Constants.DSIG_EC_NS_URI); - ctx.addNamespace(Constants.MD_PREFIX, Constants.MD_NS_URI); - ctx.addNamespace(Constants.MDP_PREFIX, Constants.MDP_NS_URI); - ctx.addNamespace(Constants.MVV_PREFIX, Constants.MVV_NS_URI); - ctx.addNamespace(Constants.STB_PREFIX, Constants.STB_NS_URI); - ctx.addNamespace(Constants.WRR_PREFIX, Constants.WRR_NS_URI); - NS_CONTEXT = ctx; - } - - /** - * Return a NodeIterator over the nodes matching the XPath - * expression. - * - * All namespace URIs and prefixes declared in the Constants - * interface are used for resolving namespaces. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param exp The XPath expression to evaluate. - * @return An iterator over the resulting nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static NodeIterator selectNodeIterator(Node contextNode, String exp) - throws XPathException { - - return selectNodeIterator(contextNode, NS_CONTEXT, exp); - } - - /** - * Return a NodeIterator over the nodes matching the XPath - * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceElement An element from which to build the - * namespace mapping for evaluating the XPath expression - * @param exp The XPath expression to evaluate. - * @return An iterator over the resulting nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static NodeIterator selectNodeIterator( - Node contextNode, - Element namespaceElement, - String exp) - throws XPathException { - - try { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(); - ctx.addElementNamespaces(documentNavigator, namespaceElement); - return selectNodeIterator(contextNode, ctx, exp); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); - throw new XPathException(message, e); - } - } - - /** - * Return a NodeIterator over the nodes matching the XPath - * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceMapping A namespace prefix to namespace URI mapping - * (String to String) for evaluating the XPath - * expression. - * @param exp The XPath expression to evaluate. - * @return An iterator over the resulting nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static NodeIterator selectNodeIterator( - Node contextNode, - Map namespaceMapping, - String exp) - throws XPathException { - - SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); - - return selectNodeIterator(contextNode, ctx, exp); - } - - /** - * Return a NodeIterator over the nodes matching the XPath - * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param nsContext The NamespaceContext for resolving namespace - * prefixes to namespace URIs for evaluating the XPath expression. - * @param exp The XPath expression to evaluate. - * @return An iterator over the resulting nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - private static NodeIterator selectNodeIterator( - Node contextNode, - NamespaceContext nsContext, - String exp) - throws XPathException { - - try { - DOMXPath xpath = new DOMXPath(exp); - List nodes; - - xpath.setNamespaceContext(nsContext); - nodes = xpath.selectNodes(contextNode); - return new NodeIteratorAdapter(nodes.listIterator()); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); - throw new XPathException(message, e); - } - } - - /** - * Return a NodeList of all the nodes matching the XPath - * expression. - * - * All namespace URIs and prefixes declared in the Constants - * interface are used for resolving namespaces. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param exp The XPath expression to evaluate. - * @return A NodeList containing the matching nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static NodeList selectNodeList(Node contextNode, String exp) - throws XPathException { - - return selectNodeList(contextNode, NS_CONTEXT, exp); - } - - /** - * Return a NodeList of all the nodes matching the XPath - * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceElement An element from which to build the - * namespace mapping for evaluating the XPath expression - * @param exp The XPath expression to evaluate. - * @return A NodeList containing the matching nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static NodeList selectNodeList( - Node contextNode, - Element namespaceElement, - String exp) - throws XPathException { - - try { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(); - - ctx.addElementNamespaces(documentNavigator, namespaceElement); - return selectNodeList(contextNode, ctx, exp); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); - throw new XPathException(message, e); - } - } - - /** - * Return a NodeList of all the nodes matching the XPath - * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceMapping A namespace prefix to namespace URI mapping - * (String to String) for evaluating the XPath - * expression. - * @param exp The XPath expression to evaluate. - * @return A NodeList containing the matching nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static NodeList selectNodeList( - Node contextNode, - Map namespaceMapping, - String exp) - throws XPathException { - - SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); - - return selectNodeList(contextNode, ctx, exp); - } - - /** - * Return a NodeList of all the nodes matching the XPath - * expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param nsContext The NamespaceContext for resolving namespace - * prefixes to namespace URIs for evaluating the XPath expression. - * @param exp The XPath expression to evaluate. - * @return A NodeList containing the matching nodes. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - private static NodeList selectNodeList( - Node contextNode, - NamespaceContext nsContext, - String exp) - throws XPathException { - - try { - DOMXPath xpath = new DOMXPath(exp); - List nodes; - - xpath.setNamespaceContext(nsContext); - nodes = xpath.selectNodes(contextNode); - return new NodeListAdapter(nodes); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); - throw new XPathException(message, e); - } - } - - /** - * Select the first node matching an XPath expression. - * - * All namespace URIs and prefixes declared in the Constants - * interface are used for resolving namespaces. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param exp The XPath expression to evaluate. - * @return Node The first node matching the XPath expression, or - * null, if no node matched. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static Node selectSingleNode(Node contextNode, String exp) - throws XPathException { - - return selectSingleNode(contextNode, NS_CONTEXT, exp); - } - - /** - * Select the first node matching an XPath expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceElement An element from which to build the - * namespace mapping for evaluating the XPath expression - * @param exp The XPath expression to evaluate. - * @return Node The first node matching the XPath expression, or - * null, if no node matched. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static Node selectSingleNode( - Node contextNode, - Element namespaceElement, - String exp) - throws XPathException { - - try { - SimpleNamespaceContext ctx = new SimpleNamespaceContext(); - ctx.addElementNamespaces(documentNavigator, namespaceElement); - - return selectSingleNode(contextNode, ctx, exp); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); - throw new XPathException(message, e); - } - } - - /** - * Select the first node matching an XPath expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param namespaceMapping A namespace prefix to namespace URI mapping - * (String to String) for evaluating the XPath - * expression. - * @param exp The XPath expression to evaluate. - * @return Node The first node matching the XPath expression, or - * null, if no node matched. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - public static Node selectSingleNode( - Node contextNode, - Map namespaceMapping, - String exp) - throws XPathException { - - SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); - - return selectSingleNode(contextNode, ctx, exp); - } - - /** - * Select the first node matching an XPath expression. - * - * @param contextNode The root node from which to evaluate the XPath - * expression. - * @param nsContext The NamespaceContext for resolving namespace - * prefixes to namespace URIs for evaluating the XPath expression. - * @param exp The XPath expression to evaluate. - * @return Node The first node matching the XPath expression, or - * null, if no node matched. - * @throws XPathException An error occurred evaluating the XPath expression. - */ - private static Node selectSingleNode( - Node contextNode, - NamespaceContext nsContext, - String exp) - throws XPathException { - - try { - DOMXPath xpath = new DOMXPath(exp); - xpath.setNamespaceContext(nsContext); - return (Node) xpath.selectSingleNode(contextNode); - } catch (JaxenException e) { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { exp }); - throw new XPathException(message, e); - } - } - - /** - * Return the value of a DOM element whose location is given by an XPath - * expression. - * - * @param root The root element from which to evaluate the XPath. - * @param xpath The XPath expression pointing to the element whose value - * to return. - * @param def The default value to return, if no element can be found using - * the given xpath. - * @return The element value, if it can be located using the - * xpath. Otherwise, def is returned. - */ - public static String getElementValue( - Element root, - String xpath, - String def) { - - Element elem = (Element) XPathUtils.selectSingleNode(root, xpath); - return elem != null ? DOMUtils.getText(elem) : def; - } - - /** - * Return the value of a DOM attribute whose location is given by an XPath - * expression. - * - * @param root The root element from which to evaluate the XPath. - * @param xpath The XPath expression pointing to the attribute whose value to - * return. - * @param def The default value to return, if no attribute can be found using - * the given xpath. - * @return The element value, if it can be located using the - * xpath. Otherwise, def is returned. - */ - public static String getAttributeValue( - Element root, - String xpath, - String def) { - - Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath); - return attr != null ? attr.getValue() : def; - } - - /** - * Returns the namespace prefix used within XPathUtils for referring to - * the namespace of the specified (Security Layer command) element. - * - * This namespace prefix can be used in various XPath expression evaluation methods - * within XPathUtils without explicitely binding it to the particular - * namespace. - * - * @param contextElement The (Security Layer command) element. - * - * @return the namespace prefix used within XPathUtils for referring to - * the namespace of the specified (Security Layer command) element. - * - * throws XpathException If the specified element has a namespace other than the ones - * known by this implementation as valid Security Layer namespaces (cf. - * @link Constants#SL10_NS_URI, @link Constants#SL11_NS_URI, @link Constants#SL12_NS_URI). - */ - public static String getSlPrefix (Element contextElement) throws XPathException - { - String sLNamespace = contextElement.getNamespaceURI(); - String sLPrefix = null; - - if (sLNamespace.equals(Constants.SL10_NS_URI)) - { - sLPrefix = Constants.SL10_PREFIX; - } - else if (sLNamespace.equals(Constants.SL12_NS_URI)) - { - sLPrefix = Constants.SL12_PREFIX; - } - else if (sLNamespace.equals(Constants.SL11_NS_URI)) - { - sLPrefix = Constants.SL11_PREFIX; - } - else - { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger Security Layer Namespace: \"" + sLNamespace + "\"."}); - throw new XPathException(message, null); - } - - return sLPrefix; - } - - - /** - * Return the SecurityLayer namespace prefix of the context element. - * If the context element is not the element that lies within the - * SecurityLayer namespace. The Securitylayer namespace is derived from - * the xmlns:sl10, sl11 or sl - * attribute of the context element. - * - * The returned prefix is needed for evaluating XPATH expressions. - * - * @param contextElement The element to get a prefix for the Securitylayer namespace, - * that is used within the corresponding document. - * - * @return The string sl10, sl11 or sl, - * depending on the SecurityLayer namespace of the contextElement. - * - * throws XPathException If no (vlalid) SecurityLayer namespace prefix or namespace - * is defined. - */ - public static String getSlPrefixFromNoRoot (Element contextElement) throws XPathException { - - String slPrefix = checkSLnsDeclaration(contextElement, Constants.SL10_PREFIX, Constants.SL10_NS_URI); - if (slPrefix == null) { - slPrefix = checkSLnsDeclaration(contextElement, Constants.SL11_PREFIX, Constants.SL11_NS_URI); - } - if (slPrefix == null) { - slPrefix = checkSLnsDeclaration(contextElement, Constants.SL12_PREFIX, Constants.SL12_NS_URI); - } - - return slPrefix; - - } - - /** - * Checks if the context element has an attribute xmlns:slPrefix and - * if the prefix of that attribute corresponds with a valid SecurityLayer namespace. - * - * @param contextElement The element to be checked. - * @param slPrefix The prefix which should be checked. Must be a valid SecurityLayer - * namespace prefix. - * @param slNameSpace The SecurityLayer namespace that corresponds to the specified prefix. - * - * @return The valid SecurityLayer prefix or null if this prefix is - * not used. - * @throws XPathException - */ - private static String checkSLnsDeclaration(Element contextElement, String slPrefix, String slNameSpace) - throws XPathException - { - String nsAtt = "xmlns:" + slPrefix; - String nameSpace = contextElement.getAttribute(nsAtt); - if (nameSpace == "") { - return null; - } else { - // check if namespace is correct - if (nameSpace.equals(slNameSpace)) { - return slPrefix; - } else { - MessageProvider msg = MessageProvider.getInstance(); - String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); - throw new XPathException(message, null); - } - } - } - -} diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java b/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java new file mode 100644 index 000000000..4d04fc72d --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java @@ -0,0 +1,43 @@ +package at.gv.egovernment.moa.logging; + +/** + * A unified message type to log messages from inside the MOA subsystem. + * + * @author Patrick Peck + * @version $Id$ + */ +public class LogMsg { + /** The message to log. */ + private Object message; + + /** + * Create a LogMsg object. + * + * @param message The actual message to log. May be null. + */ + public LogMsg(Object message) { + this.message = message; + } + + /** + * Convert this log message to a String. + * + * @return The String representation of this log message. + */ + public String toString() { + StringBuffer msg = new StringBuffer(); + LoggingContext ctx = + LoggingContextManager.getInstance().getLoggingContext(); + String tid = ctx != null ? ctx.getTransactionID() : null; + String nodeId = ctx != null ? ctx.getNodeID() : null; + + msg.append("TID="); + msg.append(tid != null ? tid : ""); + msg.append(" NID="); + msg.append(nodeId != null ? nodeId : ""); + msg.append(" MSG="); + msg.append(message != null ? message.toString() : ""); + + return msg.toString(); + } +} diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java b/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java new file mode 100644 index 000000000..eb7aa5634 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java @@ -0,0 +1,175 @@ +package at.gv.egovernment.moa.logging; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * A utility class acting as a facade to the logging subsystem. + * + * Configure the logging defaultHierarchy that the Logger uses by + * calling setHierarchy once before calling any of the logging + * output functions. + * + * @author Patrick Peck + * @version $Id$ + */ +public class Logger { + + /** The default logging hierarchy. */ + private static String defaultHierarchy = ""; + + /** + * Get the Log object for the default hierarchy. + * + * @return The Log object to write log messages to. + */ + private static Log getLog() { + return LogFactory.getLog(defaultHierarchy); + } + + /** + * Get the Log object for a given hierarchy. + * + * @param hierarchy The logging hierarchy for which to return the logger. + * @return The Log object to write log messages to. + */ + private static Log getLog(String hierarchy) { + return LogFactory.getLog(hierarchy); + } + + /** + * Set the default hierarchy to which the Logger should send its + * logging output. + * @param hierarchy The logging defaultHierarchy. + */ + public static void setHierarchy(String hierarchy) { + defaultHierarchy = hierarchy; + } + + /** + * Test, if the trace log level is enabled. + * + * @return boolean true, if tracing output is enabled + * false otherwise. + */ + public static boolean isTraceEnabled() { + return getLog().isTraceEnabled(); + } + + /** + * Test, if the trace log level is enabled for a given hierarchy. + * + * @param hierarchy requested log hierarchy + * @return boolean true, if tracing output is enabled + * false otherwise. + */ + public static boolean isTraceEnabled(String hierarchy) { + return getLog(hierarchy).isTraceEnabled(); + } + + /** + * Trace a message. + * + * @param message The message to trace. + */ + public static void trace(Object message) { + getLog().trace(message); + } + + /** + * Test, if the debug log level is enabled. + * + * @return boolean true, if debug output is enabled + * false otherwise. + */ + public static boolean isDebugEnabled() { + return getLog().isDebugEnabled(); + } + + /** + * Test, if the debug log level is enabled for a given hierarchy. + * + * @param hierarchy requested log hierarchy + * @return boolean true, if debug output is enabled + * false otherwise. + */ + public static boolean isDebugEnabled(String hierarchy) { + return getLog(hierarchy).isDebugEnabled(); + } + + /** + * Log a debug message. + * + * @param message The message to log. + */ + public static void debug(Object message) { + getLog().debug(message); + } + + /** + * Log an info message. + * + * @param message The message to log. + */ + public static void info(Object message) { + getLog().info(message); + } + + /** + * Log a warning message. + * + * @param message The message to log. + */ + public static void warn(Object message) { + getLog().warn(message); + } + + /** + * Log a warning message. + * + * @param message The message to log. + * @param t An exception that may be the cause of the warning. + */ + public static void warn(Object message, Throwable t) { + getLog().warn(message, t); + } + + /** + * Log an error message. + * + * @param message The message to log. + */ + public static void error(Object message) { + getLog().error(message); + } + + /** + * Log an error message. + * + * @param message The message to log. + * @param t An exception that may be the cause of the error. + */ + public static void error(Object message, Throwable t) { + getLog().error(message, t); + } + + /** + * Log a fatal error message. + * + * @param message The message to log. + */ + public static void fatal(Object message) { + getLog().fatal(message); + } + + /** + * Log a fatal error message. + * + * @param message The message to log. + * @param t An exception that may be the cause of the error. + */ + public static void fatal(Object message, Throwable t) { + getLog().fatal(message, t); + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java b/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java new file mode 100644 index 000000000..42d8db06e --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java @@ -0,0 +1,46 @@ +package at.gv.egovernment.moa.logging; + +/** + * Encapsulates contextual information (i.e. per request information) for + * logging purposes. + * + * @author Patrick Peck + * @version $Id$ + */ +public class LoggingContext { + /** The name of the node ID system property. */ + public static final String NODE_ID_PROPERTY = "moa.node-id"; + + /** The current transaction ID. */ + private String transactionID; + /** The node ID. */ + private String nodeID; + + /** + * Create a new LoggingContext. + * + * @param transactionID The transaction ID. May be null. + */ + public LoggingContext(String transactionID) { + this.transactionID = transactionID; + this.nodeID = System.getProperty(NODE_ID_PROPERTY); + } + + /** + * Return the transaction ID. + * + * @return The transaction ID. + */ + public String getTransactionID() { + return transactionID; + } + + /** + * Return the node ID. + * + * @return The node ID. + */ + public String getNodeID() { + return nodeID; + } +} diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java b/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java new file mode 100644 index 000000000..2bbe6caa1 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java @@ -0,0 +1,56 @@ +package at.gv.egovernment.moa.logging; + +/** + * Provides each thread with a single instance of LoggingContext. + * + * @author Patrick Peck + * @version $Id$ + */ +public class LoggingContextManager { + /** The single instance of this class. */ + private static LoggingContextManager instance = null; + + /** The LoggingContext for each thread. */ + private ThreadLocal context; + + /** + * Get the single instance of the LoggingContextManager class. + * + * @return LoggingContextManager The single instance. + */ + public static synchronized LoggingContextManager getInstance() { + if (instance == null) { + instance = new LoggingContextManager(); + } + return instance; + } + + /** + * Creates a new LoggingContextManager. + * + * Protected to disallow direct instantiation. + */ + protected LoggingContextManager() { + context = new ThreadLocal(); + } + + /** + * Set the LoggingContext context for the current thread. + * + * @param ctx The LoggingContext for the current thread. + */ + public void setLoggingContext(LoggingContext ctx) { + context.set(ctx); + } + + /** + * Return the LoggingContext for the current thread. + * + * @return LoggingContext The LoggingContext for the current + * thread, or null if none has been set. + */ + public LoggingContext getLoggingContext() { + return (LoggingContext) context.get(); + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java b/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java new file mode 100644 index 000000000..ad29180a6 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java @@ -0,0 +1,109 @@ +package at.gv.egovernment.moa.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; + +import iaik.utils.Base64InputStream; +import iaik.utils.Base64OutputStream; + +/** + * Utitility functions for encoding/decoding Base64 strings. + * + * @author Patrick Peck + * @version $Id$ + */ +public class Base64Utils { + + /** + * Read the bytes encoded in a Base64 encoded String. + * + * @param base64String The String containing the Base64 encoded + * bytes. + * @param ignoreInvalidChars Whether to ignore invalid Base64 characters. + * @return byte[] The raw bytes contained in the base64String. + * @throws IOException Failed to read the Base64 data. + */ + public static byte[] decode(String base64String, boolean ignoreInvalidChars) + throws IOException { + + Base64InputStream in = + new Base64InputStream( + new ByteArrayInputStream(base64String.getBytes("UTF-8")), + ignoreInvalidChars); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + byte[] bytes = new byte[256]; + int bytesRead; + + while ((bytesRead = in.read(bytes)) > 0) { + out.write(bytes, 0, bytesRead); + } + + return out.toByteArray(); + } + + /** + * Read the bytes encoded in a Base64 encoded String and provide + * them via an InputStream. + * + * @param base64String The String containing the Base64 encoded + * bytes. + * @param ignoreInvalidChars Whether to ignore invalid Base64 characters. + * @return The InputStream from which the binary content of the + * base64String can be read. + */ + public static InputStream decodeToStream( + String base64String, + boolean ignoreInvalidChars) { + + try { + ByteArrayInputStream bin = + new ByteArrayInputStream(base64String.getBytes("UTF-8")); + Base64InputStream in = new Base64InputStream(bin, ignoreInvalidChars); + + return in; + } catch (UnsupportedEncodingException e) { + // cannot occur, since UTF-8 is required to be supported by every JRE + return null; + } + } + + /** + * Convert a byte array to a Base64 encoded String. + * + * @param bytes The bytes to encode. + * @return String The Base64 encoded representation of the bytes. + * @throws IOException Failed to write the bytes as Base64 data. + */ + public static String encode(byte[] bytes) throws IOException { + return encode(new ByteArrayInputStream(bytes)); + } + + /** + * Convert the data contained in the given stream to a Base64 encoded + * String. + * + * @param inputStream The stream containing the data to encode. + * @return The Base64 encoded data of inputStream, as a + * String. + * @throws IOException Failed to convert the data in the stream. + */ + public static String encode(InputStream inputStream) throws IOException { + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + Base64OutputStream base64Stream = new Base64OutputStream(byteStream, "\n".getBytes()); + byte[] bytes = new byte[256]; + int bytesRead; + + while ((bytesRead = inputStream.read(bytes)) > 0) { + base64Stream.write(bytes, 0, bytesRead); + } + base64Stream.flush(); + base64Stream.close(); + inputStream.close(); + + return byteStream.toString("UTF-8"); + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java new file mode 100644 index 000000000..fcd39b4dd --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java @@ -0,0 +1,24 @@ +package at.gv.egovernment.moa.util; + +/** + * Utility class for parsing XML schema boolean values. + * + * @author Patrick Peck + * @version $Id$ + */ +public class BoolUtils { + + /** + * Return the boolean value of an xsd:boolean type of DOM + * element/attribute. + * + * @param boolStr The value of the xsd:boolean element/attribute. + * @return true, if boolStr equals + * "true" or "1;". Otherwise, + * false is returned. + */ + public static boolean valueOf(String boolStr) { + return "true".equals(boolStr) || "1".equals(boolStr); + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java new file mode 100644 index 000000000..5329dcbd2 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java @@ -0,0 +1,36 @@ +package at.gv.egovernment.moa.util; + +import java.util.Iterator; +import java.util.List; + +/** + * Various utility methods for dealing with java.util.Collection + * classes. + * + * @author Patrick Peck + * @version $Id$ + */ +public class CollectionUtils { + + /** + * Convert a List of Number objects to an + * int array. + * + * @param nums The List containing the numbers whose integer + * value to put into the result. + * @return The int values of the Numbers contained + * in nums. + */ + public static int[] toIntArray(List nums) { + int[] result = new int[nums.size()]; + Iterator iter; + int i; + + for (i = 0, iter = nums.iterator(); iter.hasNext(); i++) { + Number num = (Number) iter.next(); + result[i] = num.intValue(); + } + + return result; + } +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java new file mode 100644 index 000000000..5c1314296 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -0,0 +1,318 @@ +package at.gv.egovernment.moa.util; + +import java.util.HashMap; + +/** + * Contains various constants used throughout the system. + * + * @author Patrick Peck + * @version $Id$ + */ +public interface Constants { + /** Root location of the schema files. */ + public static final String SCHEMA_ROOT = "/resources/schemas/"; + + /** URI of the Widerrufregister XML namespace. */ + public static final String WRR_NS_URI = + "http://reference.e-government.gv.at/namespace/moavv/20041223"; + + /** Prefix used for the Widerrufregister XML namespace */ + public static final String WRR_PREFIX = "wrr"; + + /** URI of the StandardTextBlock XML namespace. */ + public static final String STB_NS_URI = + "http://reference.e-government.gv.at/namespace/standardtextblock/20041105#"; + + /** Prefix used for the Mandate XML namespace */ + public static final String STB_PREFIX = "stb"; + + /** URI of the MOA XML namespace. */ + public static final String MOA_NS_URI = + "http://reference.e-government.gv.at/namespace/moa/20020822#"; + + /** Prefix used for the Mandate XML namespace */ + public static final String MD_PREFIX = "md"; + + /** URI of the Mandate XML namespace. */ + public static final String MD_NS_URI = + "http://reference.e-government.gv.at/namespace/mandates/20040701#"; + + /** Prefix used for the Mandate XML namespace */ + public static final String MVV_PREFIX = "mvv"; + + /** URI of the Mandate XML namespace. */ + public static final String MVV_NS_URI = + "http://reference.e-government.gv.at/namespace/moavv/app2mvv/20041125"; + + /** Prefix used for the MandateCheckProfile XML namespace */ + public static final String MDP_PREFIX = "mdp"; + + /** URI of the Mandate XML namespace. */ + public static final String MDP_NS_URI = + "http://reference.e-government.gv.at/namespace/mandateprofile/20041105#"; + + /** Prefix used for the MOA XML namespace */ + public static final String MOA_PREFIX = "moa"; + + /** Local location of the MOA XML schema definition. */ + public static final String MOA_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOA-SPSS-1.3.xsd"; + + /** URI of the MOA configuration XML namespace. */ + public static final String MOA_CONFIG_NS_URI = + "http://reference.e-government.gv.at/namespace/moaconfig/20021122#"; + + /** URI of the MOA ID configuration XML namespace. */ + public static final String MOA_ID_CONFIG_NS_URI = + "http://www.buergerkarte.at/namespaces/moaconfig#"; + + /** Prefix used for the MOA configuration XML namespace */ + public static final String MOA_CONFIG_PREFIX = "conf"; + + /** Prefix used for the MOA configuration XML namespace */ + public static final String MOA_ID_CONFIG_PREFIX = "confID"; + + /** Local location of the MOA configuration XML schema definition. */ + public static final String MOA_CONFIG_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOA-SPSS-config-1.3.xsd"; + + /** Local location of the MOA ID configuration XML schema definition. */ + public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOA-ID-Configuration-1.4.xsd"; + + /** URI of the Security Layer 1.0 namespace. */ + public static final String SL10_NS_URI = + "http://www.buergerkarte.at/namespaces/securitylayer/20020225#"; + + /** Prefix used for the Security Layer 1.0 XML namespace */ + public static final String SL10_PREFIX = "sl10"; + + /** Local location of the Security Layer 1.0 XML schema definition */ + public static final String SL10_SCHEMA_LOCATION = + SCHEMA_ROOT + "Core.20020225.xsd"; + + /** URI of the Security Layer 1.1 XML namespace */ + public static final String SL11_NS_URI = + "http://www.buergerkarte.at/namespaces/securitylayer/20020831#"; + + /** Prefix used for the Security Layer 1.1 XML namespace */ + public static final String SL11_PREFIX = "sl11"; + + /** Local location of the Security Layer 1.1 XML schema definition */ + public static final String SL11_SCHEMA_LOCATION = + SCHEMA_ROOT + "Core.20020831.xsd"; + + /** URI of the Security Layer 1.2 XML namespace */ + public static final String SL12_NS_URI = + "http://www.buergerkarte.at/namespaces/securitylayer/1.2#"; + + /** Prefix used for the Security Layer 1.2 XML namespace */ + public static final String SL12_PREFIX = "sl"; + + /** Local location of the Security Layer 1.2 XML schema definition */ + public static final String SL12_SCHEMA_LOCATION = + SCHEMA_ROOT + "Core-1.2.xsd"; + + /** URI of the ECDSA XML namespace */ + public static final String ECDSA_NS_URI = + "http://www.w3.org/2001/04/xmldsig-more#"; + + /** Prefix used for ECDSA namespace */ + public static final String ECDSA_PREFIX = "ecdsa"; + + /** Local location of ECDSA XML schema definition */ + public static final String ECDSA_SCHEMA_LOCATION = + SCHEMA_ROOT + "ECDSAKeyValue.xsd"; + + /** URI of the PersonData XML namespace. */ + public static final String PD_NS_URI = + "http://reference.e-government.gv.at/namespace/persondata/20020228#"; + + /** Prefix used for the PersonData XML namespace */ + public static final String PD_PREFIX = "pr"; + +// /** Local location of the PersonData XML schema definition */ +// public static final String PD_SCHEMA_LOCATION = +// SCHEMA_ROOT + "PersonData.xsd"; + + /** Local location of the PersonData XML schema definition */ + public static final String PD_SCHEMA_LOCATION = + SCHEMA_ROOT + "PersonData_20_en_moaWID.xsd"; + + /** URI of the SAML namespace. */ + public static final String SAML_NS_URI = + "urn:oasis:names:tc:SAML:1.0:assertion"; + + /** Prefix used for the SAML XML namespace */ + public static final String SAML_PREFIX = "saml"; + + /** Local location of the SAML XML schema definition. */ + public static final String SAML_SCHEMA_LOCATION = + SCHEMA_ROOT + "cs-sstc-schema-assertion-01.xsd"; + + /** URI of the SAML request-response protocol namespace. */ + public static final String SAMLP_NS_URI = + "urn:oasis:names:tc:SAML:1.0:protocol"; + + /** Prefix used for the SAML request-response protocol namespace */ + public static final String SAMLP_PREFIX = "samlp"; + + /** Local location of the SAML request-response protocol schema definition. */ + public static final String SAMLP_SCHEMA_LOCATION = + SCHEMA_ROOT + "cs-sstc-schema-protocol-01.xsd"; + + /** URI of the XML namespace. */ + public static final String XML_NS_URI = + "http://www.w3.org/XML/1998/namespace"; + + /** Prefix used for the XML namespace */ + public static final String XML_PREFIX = "xml"; + + /** Local location of the XML schema definition. */ + public static final String XML_SCHEMA_LOCATION = SCHEMA_ROOT + "xml.xsd"; + + /** URI of the XMLNS namespace */ + public static final String XMLNS_NS_URI = "http://www.w3.org/2000/xmlns/"; + + /** Prefix used for the XSI namespace */ + public static final String XSI_PREFIX = "xsi"; + + /** Local location of the XSI schema definition. */ + public static final String XSI_SCHEMA_LOCATION = + SCHEMA_ROOT + "XMLSchema-instance.xsd"; + + /** URI of the XSI XMLNS namespace */ + public static final String XSI_NS_URI = + "http://www.w3.org/2001/XMLSchema-instance"; + + /** URI of the XSLT XML namespace */ + public static final String XSLT_NS_URI = + "http://www.w3.org/1999/XSL/Transform"; + + /** Prefix used for the XSLT XML namespace */ + public static final String XSLT_PREFIX = "xsl"; + + /** URI of the XMLDSig XML namespace. */ + public static final String DSIG_NS_URI = "http://www.w3.org/2000/09/xmldsig#"; + + /** Prefix used for the XMLDSig XML namespace */ + public static final String DSIG_PREFIX = "dsig"; + + /** Local location of the XMLDSig XML schema. */ + public static final String DSIG_SCHEMA_LOCATION = + SCHEMA_ROOT + "xmldsig-core-schema.xsd"; + + /** URI of the XMLDSig XPath Filter XML namespace. */ + public static final String DSIG_FILTER2_NS_URI = + "http://www.w3.org/2002/06/xmldsig-filter2"; + + /** Prefix used for the XMLDSig XPath Filter XML namespace */ + public static final String DSIG_FILTER2_PREFIX = "dsig-filter2"; + + /** Local location of the XMLDSig XPath Filter XML schema definition. */ + public static final String DSIG_FILTER2_SCHEMA_LOCATION = + SCHEMA_ROOT + "xmldsig-filter2.xsd"; + + /** URI of the Exclusive Canonicalization XML namespace */ + public static final String DSIG_EC_NS_URI = + "http://www.w3.org/2001/10/xml-exc-c14n#"; + + /** Prefix used for the Exclusive Canonicalization XML namespace */ + public static final String DSIG_EC_PREFIX = "ec"; + + /** Local location of the Exclusive Canonicalizaion XML schema definition */ + public static final String DSIG_EC_SCHEMA_LOCATION = + SCHEMA_ROOT + "exclusive-canonicalization.xsd"; + + /** URI of the XMLLoginParameterResolver Configuration XML namespace */ + public static final String XMLLPR_NS_URI="http://reference.e-government.gv.at/namespace/moa/20020822#/xmllpr20030814"; + + /** Local location of the XMLLoginParameterResolver Configuration XML schema definition */ + public static final String XMLLPR_SCHEMA_LOCATION = + SCHEMA_ROOT + "MOAIdentities.xsd"; + + + /** + * Contains all namespaces and local schema locations for XML schema + * definitions relevant for MOA. For use in validating XML parsers. + */ + public static final String ALL_SCHEMA_LOCATIONS = + (MOA_NS_URI + " " + MOA_SCHEMA_LOCATION + " ") + + (MOA_CONFIG_NS_URI + " " + MOA_CONFIG_SCHEMA_LOCATION + " ") + + (MOA_ID_CONFIG_NS_URI + " " + MOA_ID_CONFIG_SCHEMA_LOCATION + " ") + + (SL10_NS_URI + " " + SL10_SCHEMA_LOCATION + " ") + + (SL11_NS_URI + " " + SL11_SCHEMA_LOCATION + " ") + + (SL12_NS_URI + " " + SL12_SCHEMA_LOCATION + " ") + + (ECDSA_NS_URI + " " + ECDSA_SCHEMA_LOCATION + " ") + + (PD_NS_URI + " " + PD_SCHEMA_LOCATION + " ") + + (SAML_NS_URI + " " + SAML_SCHEMA_LOCATION + " ") + + (SAMLP_NS_URI + " " + SAMLP_SCHEMA_LOCATION + " ") + + (XML_NS_URI + " " + XML_SCHEMA_LOCATION + " ") + + (XSI_NS_URI + " " + XSI_SCHEMA_LOCATION + " ") + + (DSIG_NS_URI + " " + DSIG_SCHEMA_LOCATION + " ") + + (DSIG_FILTER2_NS_URI + " " + DSIG_FILTER2_SCHEMA_LOCATION + " ") + + (DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION + " ") + + (XMLLPR_NS_URI + " " + XMLLPR_SCHEMA_LOCATION); + + /** URN prefix for bPK and wbPK. */ + public static final String URN_PREFIX = "urn:publicid:gv.at"; + + /** URN prefix for context dependent id. */ + public static final String URN_PREFIX_CDID = URN_PREFIX + ":cdid"; + + /** URN prefix for context dependent id (bPK). */ + public static final String URN_PREFIX_BPK = URN_PREFIX_CDID + "+bpk"; + + /** URN prefix for context dependent id (HPI). */ + public static final String URN_PREFIX_HPI = URN_PREFIX_CDID + "+EHSP"; + + /** URN prefix for context dependent id (wbPK). */ + public static final String URN_PREFIX_WBPK = URN_PREFIX + ":wbpk"; + + /** URN prefix for context dependent id. */ + public static final String URN_PREFIX_BASEID = URN_PREFIX + ":baseid"; + + /** Security Layer manifest type URI. */ + public static final String SL_MANIFEST_TYPE_URI = + "http://www.buergerkarte.at/specifications/Security-Layer/20020225#SignatureManifest"; + + /** URI of the SHA1 digest algorithm */ + public static final String SHA1_URI = + "http://www.w3.org/2000/09/xmldsig#sha1"; + + /** URI of the Canonical XML algorithm */ + public static final String C14N_URI = + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; + + /** URI of the Canoncial XML with comments algorithm */ + public static final String C14N_WITH_COMMENTS_URI = + "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"; + + /** URI of the Exclusive Canonical XML algorithm */ + public static final String EXC_C14N_URI = + "http://www.w3.org/2001/10/xml-exc-c14n#"; + + /** URI of the Exclusive Canonical XML with commments algorithm */ + public static final String EXC_C14N_WITH_COMMENTS_URI = + "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"; + + // + // Local names for elements of the MOA SPSS schema + // + + /** + * Local name of request for creating an XML signature. + */ + public static final String MOA_SPSS_CREATE_XML_REQUEST = "CreateXMLSignatureRequest"; + + /** + * Local name of request for verifying an XML signature. + */ + public static final String MOA_SPSS_VERIFY_XML_REQUEST = "VerifiyXMLSignatureRequest"; + + /** + * A map used to map namespace prefixes to namespace URIs + */ + public static HashMap nSMap = new HashMap(5); + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java new file mode 100644 index 000000000..5be0bb500 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java @@ -0,0 +1,971 @@ +package at.gv.egovernment.moa.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Vector; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentFragment; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import org.apache.xerces.parsers.DOMParser; +import org.apache.xerces.parsers.SAXParser; +import org.apache.xerces.parsers.XMLGrammarPreparser; +import org.apache.xerces.util.SymbolTable; +import org.apache.xerces.util.XMLGrammarPoolImpl; +import org.apache.xerces.xni.grammars.XMLGrammarDescription; +import org.apache.xerces.xni.grammars.XMLGrammarPool; +import org.apache.xerces.xni.parser.XMLInputSource; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + + +import at.gv.egovernment.moa.logging.Logger; + +/** + * Various utility functions for handling XML DOM trees. + * + * The parsing methods in this class make use of some features internal to the + * Xerces DOM parser, mainly for performance reasons. As soon as JAXP + * (currently at version 1.2) is better at schema handling, it should be used as + * the parser interface. + * + * @author Patrick Peck + * @version $Id$ + */ +public class DOMUtils { + + /** Feature URI for namespace aware parsing. */ + private static final String NAMESPACES_FEATURE = + "http://xml.org/sax/features/namespaces"; + /** Feature URI for validating parsing. */ + private static final String VALIDATION_FEATURE = + "http://xml.org/sax/features/validation"; + /** Feature URI for schema validating parsing. */ + private static final String SCHEMA_VALIDATION_FEATURE = + "http://apache.org/xml/features/validation/schema"; + /** Feature URI for normalization of element/attribute values. */ + private static final String NORMALIZED_VALUE_FEATURE = + "http://apache.org/xml/features/validation/schema/normalized-value"; + /** Feature URI for parsing ignorable whitespace. */ + private static final String INCLUDE_IGNORABLE_WHITESPACE_FEATURE = + "http://apache.org/xml/features/dom/include-ignorable-whitespace"; + /** Feature URI for creating EntityReference nodes in the DOM tree. */ + private static final String CREATE_ENTITY_REF_NODES_FEATURE = + "http://apache.org/xml/features/dom/create-entity-ref-nodes"; + /** Property URI for providing external schema locations. */ + private static final String EXTERNAL_SCHEMA_LOCATION_PROPERTY = + "http://apache.org/xml/properties/schema/external-schemaLocation"; + /** Property URI for providing the external schema location for elements + * without a namespace. */ + private static final String EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY = + "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"; + /** Property URI for the Xerces grammar pool. */ + private static final String GRAMMAR_POOL = + org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX + + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; + /** A prime number for initializing the symbol table. */ + private static final int BIG_PRIME = 2039; + /** Symbol table for the grammar pool. */ + private static SymbolTable symbolTable = new SymbolTable(BIG_PRIME); + /** Xerces schema grammar pool. */ + private static XMLGrammarPool grammarPool = new XMLGrammarPoolImpl(); + /** Set holding the NamespaceURIs of the grammarPool, to prevent multiple + * entries of same grammars to the pool */ + private static Set grammarNamespaces; + + static { + grammarPool.lockPool(); + grammarNamespaces = new HashSet(); + } + + /** + * Preparse a schema and add it to the schema pool. + * The method only adds the schema to the pool if a schema having the same + * systemId (namespace URI) is not already present in the pool. + * + * @param inputStream An InputStream providing the contents of + * the schema. + * @param systemId The systemId (namespace URI) to use for the schema. + * @throws IOException An error occurred reading the schema. + */ + public static void addSchemaToPool(InputStream inputStream, String systemId) + throws IOException { + XMLGrammarPreparser preparser; + + if (!grammarNamespaces.contains(systemId)) { + + grammarNamespaces.add(systemId); + + // unlock the pool so that we can add another grammar + grammarPool.unlockPool(); + + // prepare the preparser + preparser = new XMLGrammarPreparser(symbolTable); + preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); + preparser.setProperty(GRAMMAR_POOL, grammarPool); + preparser.setFeature(NAMESPACES_FEATURE, true); + preparser.setFeature(VALIDATION_FEATURE, true); + + // add the grammar to the pool + preparser.preparseGrammar( + XMLGrammarDescription.XML_SCHEMA, + new XMLInputSource(null, systemId, null, inputStream, null)); + + // lock the pool again so that schemas are not added automatically + grammarPool.lockPool(); + } + } + + /** + * Parse an XML document from an InputStream. + * + * @param inputStream The InputStream containing the XML + * document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @param entityResolver An EntityResolver to resolve external + * entities (schemas and DTDs). If null, it will not be set. + * @param errorHandler An ErrorHandler to decide what to do + * with parsing errors. If null, it will not be set. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocument( + InputStream inputStream, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation, + EntityResolver entityResolver, + ErrorHandler errorHandler) + throws SAXException, IOException, ParserConfigurationException { + + DOMParser parser; + + + + //if Debug is enabled make a copy of inputStream to enable debug output in case of SAXException + byte buffer [] = null; + ByteArrayInputStream baStream = null; + if(true == Logger.isDebugEnabled()) { + int len = inputStream.available(); + buffer = new byte[len]; + inputStream.read(buffer); + baStream = new ByteArrayInputStream(buffer); + } + + // create the DOM parser + if (symbolTable != null) { + parser = new DOMParser(symbolTable, grammarPool); + } else { + parser = new DOMParser(); + } + + // set parser features and properties + try { + parser.setFeature(NAMESPACES_FEATURE, true); + parser.setFeature(VALIDATION_FEATURE, validating); + parser.setFeature(SCHEMA_VALIDATION_FEATURE, validating); + parser.setFeature(NORMALIZED_VALUE_FEATURE, false); + parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); + parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); + + if (validating) { + if (externalSchemaLocations != null) { + parser.setProperty( + EXTERNAL_SCHEMA_LOCATION_PROPERTY, + externalSchemaLocations); + } + if (externalNoNamespaceSchemaLocation != null) { + parser.setProperty( + EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, + externalNoNamespaceSchemaLocation); + } + } + + // set entity resolver and error handler + if (entityResolver != null) { + parser.setEntityResolver(entityResolver); + } + if (errorHandler != null) { + parser.setErrorHandler(errorHandler); + } + + // parse the document and return it + // if debug is enabled: use copy of strem (baStream) else use orig stream + if(null != baStream) + parser.parse(new InputSource(baStream)); + else + parser.parse(new InputSource(inputStream)); + } catch(SAXException e) { + if(true == Logger.isDebugEnabled() && null != buffer) { + String xmlContent = new String(buffer); + Logger.debug("SAXException in:\n" + xmlContent); + } + throw(e); + } + + return parser.getDocument(); + } + + /** + * Parse an XML document from an InputStream. + * + * It uses a MOAEntityResolver as the EntityResolver + * and a MOAErrorHandler as the ErrorHandler. + * + * @param inputStream The InputStream containing the XML + * document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocument( + InputStream inputStream, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws SAXException, IOException, ParserConfigurationException { + + return parseDocument( + inputStream, + validating, + externalSchemaLocations, + externalNoNamespaceSchemaLocation, + new MOAEntityResolver(), + new MOAErrorHandler()); + } + + /** + * Parse an XML document from a String. + * + * It uses a MOAEntityResolver as the EntityResolver + * and a MOAErrorHandler as the ErrorHandler. + * + * @param xmlString The String containing the XML document. + * @param encoding The encoding of the XML document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocument( + String xmlString, + String encoding, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws SAXException, IOException, ParserConfigurationException { + + InputStream in = new ByteArrayInputStream(xmlString.getBytes(encoding)); + return parseDocument( + in, + validating, + externalSchemaLocations, + externalNoNamespaceSchemaLocation); + } + + /** + * Parse an UTF-8 encoded XML document from a String. + * + * @param xmlString The String containing the XML document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocument( + String xmlString, + boolean validating, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws SAXException, IOException, ParserConfigurationException { + + return parseDocument( + xmlString, + "UTF-8", + validating, + externalSchemaLocations, + externalNoNamespaceSchemaLocation); + } + + /** + * A convenience method to parse an XML document validating. + * + * @param inputStream The InputStream containing the XML + * document. + * @return The root element of the parsed XML document. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Element parseXmlValidating(InputStream inputStream) + throws ParserConfigurationException, SAXException, IOException { + return DOMUtils + .parseDocument(inputStream, true, Constants.ALL_SCHEMA_LOCATIONS, null) + .getDocumentElement(); + } + + /** + * Schema validate a given DOM element. + * + * @param element The element to validate. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return true, if the element validates against + * the schemas declared in it. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document from its + * serialized representation. + * @throws ParserConfigurationException An error occurred configuring the XML + * @throws TransformerException An error occurred serializing the element. + */ + public static boolean validateElement( + Element element, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation) + throws + ParserConfigurationException, + IOException, + SAXException, + TransformerException { + + byte[] docBytes; + SAXParser parser; + + // create the SAX parser + if (symbolTable != null) { + parser = new SAXParser(symbolTable, grammarPool); + } else { + parser = new SAXParser(); + } + + // serialize the document + docBytes = serializeNode(element, "UTF-8"); + + // set up parser features and attributes + parser.setFeature(NAMESPACES_FEATURE, true); + parser.setFeature(VALIDATION_FEATURE, true); + parser.setFeature(SCHEMA_VALIDATION_FEATURE, true); + if (externalSchemaLocations != null) { + parser.setProperty( + EXTERNAL_SCHEMA_LOCATION_PROPERTY, + externalSchemaLocations); + } + if (externalNoNamespaceSchemaLocation != null) { + parser.setProperty( + EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, + "externalNoNamespaceSchemaLocation"); + } + + // set up entity resolver and error handler + parser.setEntityResolver(new MOAEntityResolver()); + parser.setErrorHandler(new MOAErrorHandler()); + + // parse validating + parser.parse(new InputSource(new ByteArrayInputStream(docBytes))); + return true; + } + + /** + * Serialize the given DOM node. + * + * The node will be serialized using the UTF-8 encoding. + * + * @param node The node to serialize. + * @return String The String representation of the given DOM + * node. + * @throws TransformerException An error occurred transforming the + * node to a String. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static String serializeNode(Node node) + throws TransformerException, IOException { + return new String(serializeNode(node, "UTF-8", false), "UTF-8"); + } + + + /** + * Serialize the given DOM node. + * + * The node will be serialized using the UTF-8 encoding. + * + * @param node The node to serialize. + * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. + * @return String The String representation of the given DOM + * node. + * @throws TransformerException An error occurred transforming the + * node to a String. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static String serializeNode(Node node, boolean omitXmlDeclaration) + throws TransformerException, IOException { + return new String(serializeNode(node, "UTF-8", omitXmlDeclaration), "UTF-8"); + } + + /** + * Serialize the given DOM node. + * + * The node will be serialized using the UTF-8 encoding. + * + * @param node The node to serialize. + * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. + * @param lineSeperator Sets the line seperator String of the parser + * @return String The String representation of the given DOM + * node. + * @throws TransformerException An error occurred transforming the + * node to a String. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static String serializeNode(Node node, boolean omitXmlDeclaration, String lineSeperator) + throws TransformerException, IOException { + return new String(serializeNode(node, "UTF-8", omitXmlDeclaration, lineSeperator), "UTF-8"); + } + + /** + * Serialize the given DOM node to a byte array. + * + * @param node The node to serialize. + * @param xmlEncoding The XML encoding to use. + * @return The serialized node, as a byte array. Using a compatible encoding + * this can easily be converted into a String. + * @throws TransformerException An error occurred transforming the node to a + * byte array. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static byte[] serializeNode(Node node, String xmlEncoding) + throws TransformerException, IOException { + return serializeNode(node, xmlEncoding, false); + } + + /** + * Serialize the given DOM node to a byte array. + * + * @param node The node to serialize. + * @param xmlEncoding The XML encoding to use. + * @param omitDeclaration The boolean value for omitting the XML Declaration. + * @return The serialized node, as a byte array. Using a compatible encoding + * this can easily be converted into a String. + * @throws TransformerException An error occurred transforming the node to a + * byte array. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration) + throws TransformerException, IOException { + return serializeNode(node, xmlEncoding, omitDeclaration, null); + } + + + /** + * Serialize the given DOM node to a byte array. + * + * @param node The node to serialize. + * @param xmlEncoding The XML encoding to use. + * @param omitDeclaration The boolean value for omitting the XML Declaration. + * @param lineSeperator Sets the line seperator String of the parser + * @return The serialized node, as a byte array. Using a compatible encoding + * this can easily be converted into a String. + * @throws TransformerException An error occurred transforming the node to a + * byte array. + * @throws IOException An IO error occurred writing the node to a byte array. + */ + public static byte[] serializeNode(Node node, String xmlEncoding, boolean omitDeclaration, String lineSeperator) + throws TransformerException, IOException { + + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(16384); + + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.ENCODING, xmlEncoding); + String omit = omitDeclaration ? "yes" : "no"; + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omit); + if (null!=lineSeperator) { + transformer.setOutputProperty("{http://xml.apache.org/xalan}line-separator", lineSeperator);//does not work for xalan <= 2.5.1 + } + transformer.transform(new DOMSource(node), new StreamResult(bos)); + + bos.flush(); + bos.close(); + + return bos.toByteArray(); + } + + /** + * Return the text that a node contains. + * + * This routine: + *

            + *
          • Ignores comments and processing instructions.
          • + *
          • Concatenates TEXT nodes, CDATA nodes, and the results recursively + * processing EntityRef nodes.
          • + *
          • Ignores any element nodes in the sublist. (Other possible options are + * to recurse into element sublists or throw an exception.)
          • + *
          + * + * @param node A DOM node from which to extract text. + * @return A String representing its contents. + */ + public static String getText(Node node) { + if (!node.hasChildNodes()) { + return ""; + } + + StringBuffer result = new StringBuffer(); + NodeList list = node.getChildNodes(); + + for (int i = 0; i < list.getLength(); i++) { + Node subnode = list.item(i); + if (subnode.getNodeType() == Node.TEXT_NODE) { + result.append(subnode.getNodeValue()); + } else if (subnode.getNodeType() == Node.CDATA_SECTION_NODE) { + result.append(subnode.getNodeValue()); + } else if (subnode.getNodeType() == Node.ENTITY_REFERENCE_NODE) { + // Recurse into the subtree for text + // (and ignore comments) + result.append(getText(subnode)); + } + } + return result.toString(); + } + + /** + * Build the namespace prefix to namespace URL mapping in effect for a given + * node. + * + * @param node The context node for which build the map. + * @return The namespace prefix to namespace URL mapping ( + * a String value to String value mapping). + */ + public static Map getNamespaceDeclarations(Node node) { + Map nsDecls = new HashMap(); + int i; + + do { + if (node.hasAttributes()) { + NamedNodeMap attrs = node.getAttributes(); + + for (i = 0; i < attrs.getLength(); i++) { + Attr attr = (Attr) attrs.item(i); + + // add prefix mapping if none exists + if ("xmlns".equals(attr.getPrefix()) + || "xmlns".equals(attr.getName())) { + + String nsPrefix = + attr.getPrefix() != null ? attr.getLocalName() : ""; + + if (nsDecls.get(nsPrefix) == null) { + nsDecls.put(nsPrefix, attr.getValue()); + } + } + } + } + } while ((node = node.getParentNode()) != null); + + return nsDecls; + } + + /** + * Add all namespace declarations declared in the parent(s) of a given + * element and used in the subtree of the given element to the given element. + * + * @param context The element to which to add the namespaces. + */ + public static void localizeNamespaceDeclarations(Element context) { + Node parent = context.getParentNode(); + + if (parent != null) { + Map namespaces = getNamespaceDeclarations(context.getParentNode()); + Set nsUris = collectNamespaceURIs(context); + Iterator iter; + + for (iter = namespaces.entrySet().iterator(); iter.hasNext();) { + Map.Entry e = (Map.Entry) iter.next(); + + if (nsUris.contains(e.getValue())) { + String prefix = (String) e.getKey(); + String nsUri = (String) e.getValue(); + String nsAttrName = "".equals(prefix) ? "xmlns" : "xmlns:" + prefix; + + context.setAttributeNS(Constants.XMLNS_NS_URI, nsAttrName, nsUri); + } + } + } + } + + /** + * Collect all the namespace URIs used in the subtree of a given element. + * + * @param context The element that should be searched for namespace URIs. + * @return All namespace URIs used in the subtree of context, + * including the ones used in context itself. + */ + public static Set collectNamespaceURIs(Element context) { + Set result = new HashSet(); + + collectNamespaceURIsImpl(context, result); + return result; + } + + /** + * A recursive method to do the work of collectNamespaceURIs. + * + * @param context The context element to evaluate. + * @param result The result, passed as a parameter to avoid unnecessary + * instantiations of Set. + */ + private static void collectNamespaceURIsImpl(Element context, Set result) { + NamedNodeMap attrs = context.getAttributes(); + NodeList childNodes = context.getChildNodes(); + String nsUri; + int i; + + // add the namespace of the context element + nsUri = context.getNamespaceURI(); + if (nsUri != null && nsUri != Constants.XMLNS_NS_URI) { + result.add(nsUri); + } + + // add all namespace URIs from attributes + for (i = 0; i < attrs.getLength(); i++) { + nsUri = attrs.item(i).getNamespaceURI(); + if (nsUri != null && nsUri != Constants.XMLNS_NS_URI) { + result.add(nsUri); + } + } + + // add all namespaces from subelements + for (i = 0; i < childNodes.getLength(); i++) { + Node node = childNodes.item(i); + + if (node.getNodeType() == Node.ELEMENT_NODE) { + collectNamespaceURIsImpl((Element) node, result); + } + } + } + + /** + * Check, that each attribute node in the given NodeList has its + * parent in the NodeList as well. + * + * @param nodes The NodeList to check. + * @return true, if each attribute node in nodes + * has its parent in nodes as well. + */ + public static boolean checkAttributeParentsInNodeList(NodeList nodes) { + Set nodeSet = new HashSet(); + int i; + + // put the nodes into the nodeSet + for (i = 0; i < nodes.getLength(); i++) { + nodeSet.add(nodes.item(i)); + } + + // check that each attribute node's parent is in the node list + for (i = 0; i < nodes.getLength(); i++) { + Node n = nodes.item(i); + + if (n.getNodeType() == Node.ATTRIBUTE_NODE) { + Attr attr = (Attr) n; + Element owner = attr.getOwnerElement(); + + if (owner == null) { + if (!isNamespaceDeclaration(attr)) { + return false; + } + } + + if (!nodeSet.contains(owner) && !isNamespaceDeclaration(attr)) { + return false; + } + } + } + + return true; + } + + /** + * Convert an unstructured NodeList into a + * DocumentFragment. + * + * @param nodeList Contains the node list to be converted into a DOM + * DocumentFragment. + * @return the resulting DocumentFragment. The DocumentFragment will be + * backed by a new DOM Document, i.e. all noded of the node list will be + * cloned. + * @throws ParserConfigurationException An error occurred creating the + * DocumentFragment. + * @precondition The nodes in the node list appear in document order + * @precondition for each Attr node in the node list, the owning Element is + * in the node list as well. + * @precondition each Element or Attr node in the node list is namespace + * aware. + */ + public static DocumentFragment nodeList2DocumentFragment(NodeList nodeList) + throws ParserConfigurationException { + + DocumentBuilder builder = + DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = builder.newDocument(); + DocumentFragment result = doc.createDocumentFragment(); + + if (null == nodeList || nodeList.getLength() == 0) { + return result; + } + + int currPos = 0; + currPos = + nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; + + while (currPos < nodeList.getLength()) { + currPos = + nodeList2DocumentFragment(nodeList, currPos, result, null, null) + 1; + } + return result; + } + + /** + * Helper method for the nodeList2DocumentFragment. + * + * @param nodeList The NodeList to convert. + * @param currPos The current position in the nodeList. + * @param result The resulting DocumentFragment. + * @param currOrgElem The current original element. + * @param currClonedElem The current cloned element. + * @return The current position. + */ + private static int nodeList2DocumentFragment( + NodeList nodeList, + int currPos, + DocumentFragment result, + Element currOrgElem, + Element currClonedElem) { + + while (currPos < nodeList.getLength()) { + Node currentNode = nodeList.item(currPos); + switch (currentNode.getNodeType()) { + case Node.COMMENT_NODE : + case Node.PROCESSING_INSTRUCTION_NODE : + case Node.TEXT_NODE : + { + // Append current node either to resulting DocumentFragment or to + // current cloned Element + if (null == currClonedElem) { + result.appendChild( + result.getOwnerDocument().importNode(currentNode, false)); + } else { + // Stop processing if current Node is not a descendant of + // current Element + if (!isAncestor(currOrgElem, currentNode)) { + return --currPos; + } + + currClonedElem.appendChild( + result.getOwnerDocument().importNode(currentNode, false)); + } + break; + } + + case Node.ELEMENT_NODE : + { + Element nextCurrOrgElem = (Element) currentNode; + Element nextCurrClonedElem = + result.getOwnerDocument().createElementNS( + nextCurrOrgElem.getNamespaceURI(), + nextCurrOrgElem.getNodeName()); + + // Append current Node either to resulting DocumentFragment or to + // current cloned Element + if (null == currClonedElem) { + result.appendChild(nextCurrClonedElem); + currOrgElem = nextCurrOrgElem; + currClonedElem = nextCurrClonedElem; + } else { + // Stop processing if current Node is not a descendant of + // current Element + if (!isAncestor(currOrgElem, currentNode)) { + return --currPos; + } + + currClonedElem.appendChild(nextCurrClonedElem); + } + + // Process current Node (of type Element) recursively + currPos = + nodeList2DocumentFragment( + nodeList, + ++currPos, + result, + nextCurrOrgElem, + nextCurrClonedElem); + + break; + } + + case Node.ATTRIBUTE_NODE : + { + Attr currAttr = (Attr) currentNode; + + // GK 20030411: Hack to overcome problems with IAIK IXSIL + if (currAttr.getOwnerElement() == null) + break; + if (currClonedElem == null) + break; + + // currClonedElem must be the owner Element of currAttr if + // preconditions are met + currClonedElem.setAttributeNS( + currAttr.getNamespaceURI(), + currAttr.getNodeName(), + currAttr.getValue()); + break; + } + + default : + { + // All other nodes will be ignored + } + } + + currPos++; + } + + return currPos; + } + + /** + * Check, if the given attribute is a namespace declaration. + * + * @param attr The attribute to check. + * @return true, if the attribute is a namespace declaration, + * false otherwise. + */ + private static boolean isNamespaceDeclaration(Attr attr) { + return Constants.XMLNS_NS_URI.equals(attr.getNamespaceURI()); + } + + /** + * Check, if a given DOM element is an ancestor of a given node. + * + * @param candAnc The DOM element to check for being the ancestor. + * @param cand The node to check for being the child. + * @return true, if candAnc is an (indirect) + * ancestor of cand; false otherwise. + */ + public static boolean isAncestor(Element candAnc, Node cand) { + Node currPar = cand.getParentNode(); + + while (currPar != null) { + if (candAnc == currPar) + return true; + currPar = currPar.getParentNode(); + } + return false; + } + + /** + * Selects the (first) element from a node list and returns it. + * + * @param nl The NodeList to get the element from. + * @return The (first) element included in the node list or null + * if the node list is null or empty or no element is + * included in the list. + */ + public static Element getElementFromNodeList (NodeList nl) { + if ((nl == null) || (nl.getLength() == 0)) { + return null; + } + for (int i=0; idateTime, + * according to ISO 8601. + * + * @author Patrick Peck + * @version $Id$ + * @see http://www.w3.org/2001/XMLSchema-datatypes" + */ +public class DateTimeUtils { + /** Error messages. */ + private static MessageProvider msg = MessageProvider.getInstance(); + + /** + * Builds a dateTime value from a Calendar value. + * @param cal the Calendar value + * @return the dateTime value + */ + public static String buildDateTime(Calendar cal) { + StringWriter out = new StringWriter(); + out.write("" + cal.get(Calendar.YEAR)); + out.write("-"); + out.write(to2DigitString(cal.get(Calendar.MONTH) + 1)); + out.write("-"); + out.write(to2DigitString(cal.get(Calendar.DAY_OF_MONTH))); + out.write("T"); + out.write(to2DigitString(cal.get(Calendar.HOUR_OF_DAY))); + out.write(":"); + out.write(to2DigitString(cal.get(Calendar.MINUTE))); + out.write(":"); + out.write(to2DigitString(cal.get(Calendar.SECOND))); + int tzOffsetMilliseconds = + cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); + if (tzOffsetMilliseconds != 0) { + int tzOffsetMinutes = tzOffsetMilliseconds / (1000 * 60); + int tzOffsetHours = tzOffsetMinutes / 60; + tzOffsetMinutes -= tzOffsetHours * 60; + if (tzOffsetMilliseconds > 0) { + out.write("+"); + out.write(to2DigitString(tzOffsetHours)); + out.write(":"); + out.write(to2DigitString(tzOffsetMinutes)); + } else { + out.write("-"); + out.write(to2DigitString(-tzOffsetHours)); + out.write(":"); + out.write(to2DigitString(-tzOffsetMinutes)); + } + } + return out.toString(); + } + + /** + * Converts month, day, hour, minute, or second value + * to a 2 digit String. + * @param number the month, day, hour, minute, or second value + * @return 2 digit String + */ + private static String to2DigitString(int number) { + if (number < 10) + return "0" + number; + else + return "" + number; + } + + /** + * Parse a String containing a date and time instant, given in + * ISO 8601 format. + * + * @param dateTime The String to parse. + * @return The Date representation of the contents of + * dateTime. + * @throws ParseException Parsing the dateTime failed. + */ + public static Date parseDateTime(String dateTime) throws ParseException { + GregorianCalendar calendar; + long time; + int yearSign = 1, year, month, day; + int hour, minute, second; + double fraction = 0.0; + int tzSign = 1, tzHour = 0, tzMinute = 0; + int curPos = 0; + String fractStr; + boolean localTime = false; + char c; + + // parse year sign + ensureChars(dateTime, curPos, 1); + c = dateTime.charAt(curPos); + if (c == '+' || c == '-') { + yearSign = c == '+' ? 1 : -1; + curPos++; + } + + // parse year + year = parseInt(dateTime, curPos, 4); + curPos += 4; + + // parse '-' + ensureChar(dateTime, curPos, '-'); + curPos++; + + // parse month + month = parseInt(dateTime, curPos, 2); + ensureValue(month, 1, 12, curPos); + curPos += 2; + + // parse '-' + ensureChar(dateTime, curPos, '-'); + curPos++; + + // parse day + day = parseInt(dateTime, curPos, 2); + ensureValue(day, 1, 31, curPos); + curPos += 2; + + // parse 'T' + ensureChar(dateTime, curPos, 'T'); + curPos++; + + // parse hour + hour = parseInt(dateTime, curPos, 2); + ensureValue(hour, 0, 23, curPos); + curPos += 2; + + // parse ':' + ensureChar(dateTime, curPos, ':'); + curPos++; + + // parse minute + minute = parseInt(dateTime, curPos, 2); + ensureValue(minute, 0, 59, curPos); + curPos += 2; + + // parse ':' + ensureChar(dateTime, curPos, ':'); + curPos++; + + // parse second + second = parseInt(dateTime, curPos, 2); + ensureValue(second, 0, 59, curPos); + curPos += 2; + + // parse a fraction + if (dateTime.length() > curPos && dateTime.charAt(curPos) == '.') { + curPos++; + ensureDigits(dateTime, curPos, 1); + fractStr = "0."; + fractStr + += dateTime.substring(curPos, curPos + countDigits(dateTime, curPos)); + fraction = Double.parseDouble(fractStr); + curPos += countDigits(dateTime, curPos); + } + + // parse a time zone + if (dateTime.length() > curPos) { + c = dateTime.charAt(curPos); + if (c == 'Z') { + curPos++; + } else if (c == '+' || c == '-') { + // parse time zone sign + tzSign = c == '+' ? 1 : -1; + curPos++; + + // parse time zone hour + tzHour = parseInt(dateTime, curPos, 2); + ensureValue(tzHour, 0, 14, curPos); + curPos += 2; + + // parse ':' + ensureChar(dateTime, curPos, ':'); + curPos++; + + // parse time zone minute + tzMinute = parseInt(dateTime, curPos, 2); + ensureValue(tzMinute, 0, 59, curPos); + curPos += 2; + } + } else { + localTime = true; + } + + // if we have characters left, it's an error + if (dateTime.length() != curPos) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + + // build the Date object + year = year * yearSign; + try { + calendar = new GregorianCalendar(TimeZone.getTimeZone("GMT")); + calendar.set(year, month - 1, day, hour, minute, second); + calendar.set(Calendar.MILLISECOND, 0); + time = calendar.getTime().getTime(); + time += (long) (fraction * 1000.0); + time -= tzSign * ((tzHour * 60) + tzMinute) * 60 * 1000; + if (localTime) { + time -= TimeZone.getDefault().getRawOffset(); + } + return new Date(time); + } catch (IllegalArgumentException e) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + + } + + /** + * Parse an integer value. + * + * @param str The String containing the digits. + * @param curPos The starting position. + * @param digits The number of digist making up the integer value. + * @return int The integer representation of the digits contained in + * str. + * @throws ParseException Parsing the integer value failed. + */ + private static int parseInt(String str, int curPos, int digits) + throws ParseException { + + ensureDigits(str, curPos, digits); + return Integer.parseInt(str.substring(curPos, curPos + digits)); + } + + /** + * Count the number of digits following curPos. + * + * @param str The String in which to count digits. + * @param curPos The starting position. + * @return int The number of digits. + */ + private static int countDigits(String str, int curPos) { + int i; + + for (i = curPos; i < str.length() && Character.isDigit(str.charAt(i)); i++); + return i - curPos; + } + + /** + * Ensure that a value falls in a given min/max range. + * + * @param value The value to check. + * @param min The minimum allowed value. + * @param max The maximum allowed value. + * @param curPos To indicate the parsing position in the + * ParseException. + * @throws ParseException Thrown, if value < min || value > + * max + */ + private static void ensureValue(int value, int min, int max, int curPos) + throws ParseException { + + if (value < min || value > max) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + } + + /** + * Ensure that the given String has a number of characters left. + * + * @param str The String to check for its length. + * @param curPos The starting position. + * @param count The minimum number of characters that str must + * contain, starting at from curPos. + * @throws ParseException Thrown, if + * curPos + count > str.length(). + */ + private static void ensureChars(String str, int curPos, int count) + throws ParseException { + if (curPos + count > str.length()) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + } + + /** + * Ensure that a given String contains a certain character at a + * certain position. + * + * @param str The String in which to look up the character. + * @param curPos The position in str that must contain the + * character. + * @param c The character value that must be contained at position + * curPos. + * @throws ParseException Thrown, if the characters do not match or + * curPos is out of range. + */ + private static void ensureChar(String str, int curPos, char c) + throws ParseException { + + ensureChars(str, curPos, 1); + if (str.charAt(curPos) != c) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + } + + /** + * Ensure that a given String contains a number of digits, + * starting at a given position. + * + * @param str The String to scan for digits. + * @param curPos The starting postion. + * @param count The number of digits that must be contained in + * str, starting at curPos. + * @throws ParseException Thrown, if str is not long enough, or + * one of the characters following curPos in str is + * not a digit. + */ + private static void ensureDigits(String str, int curPos, int count) + throws ParseException { + + ensureChars(str, curPos, count); + for (int i = curPos; i < curPos + count; i++) { + if (!Character.isDigit(str.charAt(i))) { + throw new ParseException(msg.getMessage("datetime.00", null), curPos); + } + } + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java b/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java new file mode 100644 index 000000000..e7008a701 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java @@ -0,0 +1,52 @@ +package at.gv.egovernment.moa.util; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * Implementation of the org.xml.sax.EntityResolver, + * for use by a org.apache.xerces.parsers.DOMParser. + * + * @author Patrick Peck + * @version $Id$ + */ +public class EntityResolverChain implements EntityResolver { + /** The EntityResolvers in the chain. */ + private List resolvers = new ArrayList(); + + /** + * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) + */ + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException, IOException { + + Iterator iter; + + for (iter = resolvers.iterator(); iter.hasNext(); ) { + EntityResolver resolver = (EntityResolver) iter.next(); + InputSource is = resolver.resolveEntity(publicId, systemId); + + if (is != null) { + return is; + } + } + + return null; + } + + /** + * Add an EntityResolver to the chain. + * + * @param entityResolver The EntityResolver to add. + */ + public void addEntityResolver(EntityResolver entityResolver) { + resolvers.add(entityResolver); + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java new file mode 100644 index 000000000..a5e777c2d --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java @@ -0,0 +1,116 @@ +package at.gv.egovernment.moa.util; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +/** + * Utility for accessing files on the file system, and for reading from input streams. + * @author Paul Ivancsics + * @version $Id$ + */ +public class FileUtils { + + /** + * Reads a file, given by URL, into a byte array. + * @param urlString file URL + * @return file content + * @throws IOException on any exception thrown + */ + public static byte[] readURL(String urlString) throws IOException { + URL url = new URL(urlString); + InputStream in = new BufferedInputStream(url.openStream()); + byte[] content = StreamUtils.readStream(in); + in.close(); + return content; + } + /** + * Reads a file, given by URL, into a String. + * @param urlString file URL + * @param encoding character encoding + * @return file content + * @throws IOException on any exception thrown + */ + public static String readURL(String urlString, String encoding) throws IOException { + byte[] content = readURL(urlString); + return new String(content, encoding); + } + /** + * Reads a file, given by filename, into a byte array. + * @param filename filename + * @return file content + * @throws IOException on any exception thrown + */ + public static byte[] readFile(String filename) throws IOException { + BufferedInputStream in = new BufferedInputStream(new FileInputStream(filename)); + byte[] content = StreamUtils.readStream(in); + in.close(); + return content; + } + /** + * Reads a file, given by filename, into a String. + * @param filename filename + * @param encoding character encoding + * @return file content + * @throws IOException on any exception thrown + */ + public static String readFile(String filename, String encoding) throws IOException { + byte[] content = readFile(filename); + return new String(content, encoding); + } + /** + * Reads a file from a resource. + * @param name resource name + * @return file content as a byte array + * @throws IOException on any exception thrown + */ + public static byte[] readResource(String name) throws IOException { + ClassLoader cl = FileUtils.class.getClassLoader(); + BufferedInputStream in = new BufferedInputStream(cl.getResourceAsStream(name)); + byte[] content = StreamUtils.readStream(in); + in.close(); + return content; + } + /** + * Reads a file from a resource. + * @param name filename + * @param encoding character encoding + * @return file content + * @throws IOException on any exception thrown + */ + public static String readResource(String name, String encoding) throws IOException { + byte[] content = readResource(name); + return new String(content, encoding); + } + + /** + * Returns the absolute URL of a given url which is relative to the parameter root + * @param url + * @param root + * @return String + */ + public static String makeAbsoluteURL(String url, String root) { + //if url is relative to rootConfigFileDirName make it absolute + + File keyFile; + String newURL = url; + + if(null == url) return null; + + if (url.startsWith("http:/") || url.startsWith("https:/") || url.startsWith("file:/") || url.startsWith("ftp:/")) { + return url; + } else { + // check if absolute - if not make it absolute + keyFile = new File(url); + if (!keyFile.isAbsolute()) { + keyFile = new File(root, url); + newURL = keyFile.getPath(); + } + return newURL; + } + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java new file mode 100644 index 000000000..d6a34a7b2 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java @@ -0,0 +1,134 @@ +package at.gv.egovernment.moa.util; + +import iaik.x509.X509Certificate; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.cert.Certificate; + +/** + * Utility for creating and loading key stores. + * + * @author Paul Ivancsics + * @version $Id$ + */ +public class KeyStoreUtils { + + /** + * Loads a key store from file. + * + * @param keystoreType key store type + * @param urlString URL of key store + * @param password password protecting the key store + * @return key store loaded + * @throws IOException thrown while reading the key store from file + * @throws GeneralSecurityException thrown while creating the key store + */ + public static KeyStore loadKeyStore( + String keystoreType, + String urlString, + String password) + throws IOException, GeneralSecurityException { + + URL keystoreURL = new URL(urlString); + InputStream in = keystoreURL.openStream(); + return loadKeyStore(keystoreType, in, password); + } + /** + * Loads a key store from an InputStream, and + * closes the InputStream. + * + * @param keystoreType key store type + * @param in input stream + * @param password password protecting the key store + * @return key store loaded + * @throws IOException thrown while reading the key store from the stream + * @throws GeneralSecurityException thrown while creating the key store + */ + public static KeyStore loadKeyStore( + String keystoreType, + InputStream in, + String password) + throws IOException, GeneralSecurityException { + + char[] chPassword = null; + if (password != null) + chPassword = password.toCharArray(); + KeyStore ks = KeyStore.getInstance(keystoreType); + ks.load(in, chPassword); + in.close(); + return ks; + } + /** + * Creates a key store from X509 certificate files, aliasing them with + * the index in the String[], starting with "0". + * + * @param keyStoreType key store type + * @param certFilenames certificate filenames + * @return key store created + * @throws IOException thrown while reading the certificates from file + * @throws GeneralSecurityException thrown while creating the key store + */ + public static KeyStore createKeyStore( + String keyStoreType, + String[] certFilenames) + throws IOException, GeneralSecurityException { + + KeyStore ks = KeyStore.getInstance(keyStoreType); + ks.load(null, null); + for (int i = 0; i < certFilenames.length; i++) { + Certificate cert = loadCertificate(certFilenames[i]); + ks.setCertificateEntry("" + i, cert); + } + return ks; + } + /** + * Creates a key store from a directory containg X509 certificate files, + * aliasing them with the index in the String[], starting with "0". + * All the files in the directory are considered to be certificates. + * + * @param keyStoreType key store type + * @param certDirURLString file URL of directory containing certificate filenames + * @return key store created + * @throws IOException thrown while reading the certificates from file + * @throws GeneralSecurityException thrown while creating the key store + */ + public static KeyStore createKeyStoreFromCertificateDirectory( + String keyStoreType, + String certDirURLString) + throws IOException, GeneralSecurityException { + + URL certDirURL = new URL(certDirURLString); + String certDirname = certDirURL.getFile(); + File certDir = new File(certDirname); + String[] certFilenames = certDir.list(); + String separator = + (certDirname.endsWith(File.separator) ? "" : File.separator); + for (int i = 0; i < certFilenames.length; i++) { + certFilenames[i] = certDirname + separator + certFilenames[i]; + } + return createKeyStore(keyStoreType, certFilenames); + } + + /** + * Loads an X509 certificate from file. + * @param certFilename filename + * @return the certificate loaded + * @throws IOException thrown while reading the certificate from file + * @throws GeneralSecurityException thrown while creating the certificate + */ + private static Certificate loadCertificate(String certFilename) + throws IOException, GeneralSecurityException { + + FileInputStream in = new FileInputStream(certFilename); + Certificate cert = new X509Certificate(in); + in.close(); + return cert; + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java b/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java new file mode 100644 index 000000000..0474d92cd --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java @@ -0,0 +1,82 @@ +package at.gv.egovernment.moa.util; + +import java.io.IOException; + +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.helpers.DefaultHandler; + +/** + * A DefaultHandler that uses a MOAEntityResolver and + * a MOAErrorHandler. + * + * @author Patrick Peck + * @version $Id$ + */ +public class MOADefaultHandler extends DefaultHandler { + /** The EntityResolver to use. */ + private EntityResolver entityResolver; + /** The ErrorHandler to use. */ + private ErrorHandler errorHandler; + + /** + * Create a new MOADefaultHandler. + */ + public MOADefaultHandler() { + entityResolver = new MOAEntityResolver(); + errorHandler = new MOAErrorHandler(); + } + + /** + * Create a new MOADefaultHandler. + * + * @param entityResolver The EntityResolver to use for resolving + * external entities. + * @param errorHandler The ErrorHandler to use for reporting + * parsing errors. + */ + public MOADefaultHandler( + EntityResolver entityResolver, + ErrorHandler errorHandler) { + + this.entityResolver = entityResolver; + this.errorHandler = errorHandler; + } + + /** + * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) + */ + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException { + try { + return entityResolver.resolveEntity(publicId, systemId); + } catch (IOException e) { + return null; + } + } + + /** + * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException) + */ + public void warning(SAXParseException exception) throws SAXException { + errorHandler.warning(exception); + } + + /** + * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) + */ + public void error(SAXParseException exception) throws SAXException { + errorHandler.error(exception); + } + + /** + * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException) + */ + public void fatalError(SAXParseException exception) throws SAXException { + errorHandler.fatalError(exception); + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java b/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java new file mode 100644 index 000000000..9406612e2 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java @@ -0,0 +1,103 @@ +package at.gv.egovernment.moa.util; + +import java.io.InputStream; + +import org.apache.xerces.util.URI; +import org.apache.xerces.util.URI.MalformedURIException; +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; + +/** + * An EntityResolver that looks up entities stored as + * local resources. + * + *

          The following DTDs are mapped to local resources: + *

            + *
          • The XMLSchema.dtd
          • + *
          • The datatypes.dtd
          • + *
          + *

          + *

          For all other resources, an attempt is made to resolve them as resources, + * either absolute or relative to Constants.SCHEMA_ROOT. + * + * @author Patrick Peck + * @author Sven Aigner + */ +public class MOAEntityResolver implements EntityResolver { + + /** + * Resolve an entity. + * + * The systemId parameter is used to perform the lookup of the + * entity as a resource, either by interpreting the systemId as + * an absolute resource path, or by appending the last path component of + * systemId to Constants.SCHEMA_ROOT. + * + * @param publicId The public ID of the resource. + * @param systemId The system ID of the resource. + * @return An InputSource from which the entity can be read, or + * null, if the entity could not be found. + * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) + */ + public InputSource resolveEntity(String publicId, String systemId) { + InputStream stream; + int slashPos; + + if (Logger.isDebugEnabled()) { + Logger.debug( + new LogMsg("resolveEntity: p=" + publicId + " s=" + systemId)); + } + + if (publicId != null) { + // check if we can resolve some standard dtd's + if (publicId.equalsIgnoreCase("-//W3C//DTD XMLSchema 200102//EN")) { + return new InputSource( + getClass().getResourceAsStream( + Constants.SCHEMA_ROOT + "XMLSchema.dtd")); + } else if (publicId.equalsIgnoreCase("datatypes")) { + return new InputSource( + getClass().getResourceAsStream( + Constants.SCHEMA_ROOT + "datatypes.dtd")); + } + } else if (systemId != null) { + // get the URI path + try { + URI uri = new URI(systemId); + systemId = uri.getPath(); + if (!"file".equals(uri.getScheme()) || "".equals(systemId.trim())) { + return null; + } + } catch (MalformedURIException e) { + return null; + } + + // try to get the resource from the full path + stream = getClass().getResourceAsStream(systemId); + if (stream != null) { + InputSource source = new InputSource(stream); + + source.setSystemId(systemId); + return source; + } + + // try to get the resource from the last path component + slashPos = systemId.lastIndexOf('/'); + if (slashPos >= 0 && systemId.length() > slashPos) { + systemId = systemId.substring(slashPos + 1, systemId.length()); + stream = + getClass().getResourceAsStream(Constants.SCHEMA_ROOT + systemId); + if (stream != null) { + InputSource source = new InputSource(stream); + + source.setSystemId(systemId); + return source; + } + } + } + + return null; // nothing found - let the parser handle the entity + } +} \ No newline at end of file diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java b/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java new file mode 100644 index 000000000..1f7757c8f --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java @@ -0,0 +1,85 @@ +package at.gv.egovernment.moa.util; + +import org.apache.xml.utils.DefaultErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +import at.gv.egovernment.moa.logging.LogMsg; +import at.gv.egovernment.moa.logging.Logger; + +/** + * An ErrorHandler that logs a message and throws a + * SAXException upon error and fatal + * parsing errors. + * + * @author Patrick Peck + * @author Sven Aigner + */ +public class MOAErrorHandler extends DefaultErrorHandler { + + /** + * Logs a warning message. + * + * @see org.xml.sax.ErrorHandler#warning(SAXParseException) + */ + public void warning(SAXParseException exception) throws SAXException { + warn("parser.00", messageParams(exception), null); + } + + /** + * Logs a warning and rethrows the exception. + * + * @see org.xml.sax.ErrorHandler#error(SAXParseException) + */ + public void error(SAXParseException exception) throws SAXException { + warn("parser.01", messageParams(exception), null); + throw exception; + } + + /** + * Logs a warning and rethrows the exception. + * + * @see org.xml.sax.ErrorHandler#fatalError(SAXParseException) + */ + public void fatalError(SAXParseException exception) throws SAXException { + warn("parser.02", messageParams(exception), null); + throw exception; + } + + /** + * Log a warning message. + * + * @param messageId The message ID to log. + * @param parameters Additional message parameters. + * @param t The Throwable to log; usually the cause of this + * warning. + */ + private static void warn( + String messageId, + Object[] parameters, + Throwable t) { + + MessageProvider msg = MessageProvider.getInstance(); + Logger.warn(new LogMsg(msg.getMessage(messageId, parameters)), t); + } + + /** + * Put the system id, line and column number information from the exception + * into an Object array, to provide it as a + * MessageFormat parameter. + * + * @param e The SAXParseException containing the + * source system id and line/column numbers. + * @return An array containing the system id (a String) as well + * as line/column numbers (2 Integer objects) from the + * SAXParseException. + */ + private static Object[] messageParams(SAXParseException e) { + return new Object[] { + e.getMessage(), + e.getSystemId(), + new Integer(e.getLineNumber()), + new Integer(e.getColumnNumber())}; + } + +} \ No newline at end of file diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java b/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java new file mode 100644 index 000000000..d8bf64fc3 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java @@ -0,0 +1,110 @@ +package at.gv.egovernment.moa.util; + +import java.util.Map; +import java.util.WeakHashMap; + +/** + * A timer utility for named timers. + * + * @author Sven Aigner + */ +public class MOATimer { + + /** The single instance of this class. */ + private static MOATimer instance = null; + /** The starting points of single timings. */ + private static Map timemapstart = new WeakHashMap(); + /** The end points of single timings. */ + private static Map timemapend = new WeakHashMap(); + + /** + * Return the single instance of this class. + * + * @return The single instance of this class. + */ + public static MOATimer getInstance() { + if (instance == null) { + instance = new MOATimer(); + } + return instance; + } + + /** + * Create a new MOATimer. + * + * Protected to disallow multiple instances. + */ + protected MOATimer() { + super(); + } + + /** + * Start timing a certain action. + * + * The timing belonging to the action ID is garbage collected as soon as there + * exists no other reference to the action ID. + * + * @param id The action ID. + */ + public void startTiming(Object id) { + timemapstart.put(id, new Long(System.currentTimeMillis())); + } + + /** + * Stop timing an action. + * + * @param id The action ID. + */ + public void stopTiming(Object id) { + timemapend.put(id, new Long(System.currentTimeMillis())); + } + + /** + * Get the duration of an action. + * + * @param id The action ID for which to compute the duration. + * @return long The duration in milliseconds between calls to + * startTiming() and stopTiming(). If + * only startTiming() has been called for the action, then + * current difference to the system time is returned. If no timing exists for + * the action, - 1 is returned. + */ + public long duration(Object id) { + if (timemapstart.containsKey(id)) { + long start = ((Long) timemapstart.get(id)).longValue(); + if (timemapend.containsKey(id)) { + long end = ((Long) timemapend.get(id)).longValue(); + return end - start; + } else { + return System.currentTimeMillis() - start; + } + } else + return -1; + } + + /** + * Get the duration of an action, as a nicely formatted String. + * + * @param id The action ID. + * @return String The duration() as a String. + */ + public String durationAsString(Object id) { + long dur = duration(id); + long second = dur / 1000; + long mil = (dur) - (second * 1000); + return "Duration: " + second + "." + mil + " seconds"; + } + + /** + * Remove a timing. + * + * @param id The action ID. + */ + public void clearTiming(String id) { + if (timemapstart.containsKey(id)) + timemapstart.remove(id); + if (timemapend.containsKey(id)) + timemapend.remove(id); + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java b/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java new file mode 100644 index 000000000..f5117e390 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java @@ -0,0 +1,63 @@ +package at.gv.egovernment.moa.util; + +import java.util.Locale; + +/** + * A singleton wrapper around a Message object. + * + * Provides the messages used in the common project. + * + * @author Patrick Peck + * @version $Id$ + */ +public class MessageProvider { + /** The location of the default message resources. */ + private static final String[] DEFAULT_MESSAGE_RESOURCES = + { "resources/properties/common_messages" }; + /** The locale of the default message resources. */ + private static final Locale[] DEFAULT_MESSAGE_LOCALES = + new Locale[] { new Locale("de", "AT") }; + /** The single instance of this class. */ + private static MessageProvider instance; + + /** The messages provided by this MessageProvider. */ + private Messages messages; + + /** + * Return the single instance of the MessageProvider. + * + * Intialilizes the MessageProvider with the default message + * locations: /resources/properties/common_messages. + * + * @return The single MessageProvider. + */ + public static synchronized MessageProvider getInstance() { + if (instance == null) { + instance = + new MessageProvider(DEFAULT_MESSAGE_RESOURCES, DEFAULT_MESSAGE_LOCALES); + } + return instance; + } + + /** + * Create a MessageProvider. + * + * @param resourceNames The names of the resources containing the messages. + * @param locales The corresponding locales. + */ + protected MessageProvider(String[] resourceNames, Locale[] locales) { + this.messages = new Messages(resourceNames, locales); + } + + /** + * Get the message corresponding to a given message ID. + * + * @param messageId The ID of the message. + * @param parameters The parameters to fill in into the message arguments. + * @return The formatted message. + */ + public String getMessage(String messageId, Object[] parameters) { + return messages.getMessage(messageId, parameters); + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Messages.java b/common/src/main/java/at/gv/egovernment/moa/util/Messages.java new file mode 100644 index 000000000..a0139ae93 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/Messages.java @@ -0,0 +1,117 @@ +package at.gv.egovernment.moa.util; + +import java.text.MessageFormat; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.PropertyResourceBundle; + +import at.gv.egovernment.moa.logging.Logger; + +/** + * Provides access to the system messages resource used for exception handling + * and logging messages. + * + * Messages must be provided as a resource bundle at the path. + * + * @author Patrick Peck + * @version $Id$ + */ +public class Messages { + /** Error message indicating that no messages are avaiable. */ + private static final String ERROR_MESSAGES_UNAVAILABLE = + "Fehler in der Server-Konfiguration. " + + "Die Fehlertexte konnten nicht geladen werden."; + /** Error message indicating that the message is not available. */ + private static final String ERROR_NO_MESSAGE = + "Keine Fehlermeldung für Fehler-Nr.={0}"; + + /** The names of the resources containing the messages. */ + private String[] resourceNames; + /** The corresponding Locales of the resources. */ + private Locale[] locales; + /** The ResourceBundles containing the messages. */ + private ResourceBundleChain messages; + + /** + * Create a new Message object containing the messages + * in the given resources. + * + * @param resourceNames The names of the resources containing the messages. + * @param locales The corresponding locales. + */ + public Messages(String[] resourceNames, Locale[] locales) { + this.resourceNames = resourceNames; + this.locales = locales; + this.messages = null; + } + + /** + * Get the message corresponding to a given message ID. + * + * @param messageId The ID of the message. + * @param parameters The parameters to fill in into the message arguments. + * @return The formatted message. + */ + public String getMessage(String messageId, Object[] parameters) { + // initialize messages + if (messages == null) { + initMessages(); + } + + // create the message + if (messages == null) { + return ERROR_MESSAGES_UNAVAILABLE; + } else { + try { + String rawMessage = messages.getString(messageId); + return MessageFormat.format(rawMessage, parameters); + } catch (MissingResourceException e2) { + // couldn't find any message -> set to default error message + return MessageFormat.format( + ERROR_NO_MESSAGE, + new Object[] { messageId }); + } + } + } + + /** + * Return the names of the resources containing the messages. + * + * @return String[] The names of the resource bundles containing the messages. + */ + private String[] getResourceNames() { + return resourceNames; + } + + /** + * Return the Locales of the resources containing the messages. + * + * @return Locale[] The Locales of the resource bundles + * containing the messages. + */ + private Locale[] getLocales() { + return locales; + } + + /** + * Initialize the messages ResourceBundle containing + * the MOA error messages. + */ + private void initMessages() { + messages = new ResourceBundleChain(); + int i; + + // initialize the message resources + for (i = 0; i < resourceNames.length; i++) { + try { + messages.addResourceBundle( + PropertyResourceBundle.getBundle( + getResourceNames()[i], + getLocales()[i])); + } catch (MissingResourceException e) { + Logger.error(ERROR_MESSAGES_UNAVAILABLE, e); + } + } + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java b/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java new file mode 100644 index 000000000..f71aa472d --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java @@ -0,0 +1,87 @@ +package at.gv.egovernment.moa.util; + +import java.util.ListIterator; + +import org.w3c.dom.DOMException; +import org.w3c.dom.Node; +import org.w3c.dom.traversal.NodeFilter; +import org.w3c.dom.traversal.NodeIterator; + +/** + * A NodeIterator implementation based on a + * ListIterator. + * + * @see java.util.ListIterator + * @see org.w3c.dom.traversal.NodeIterator + * + * @author Patrick Peck + * @version $Id$ + */ +public class NodeIteratorAdapter implements NodeIterator { + + /** The ListIterator to wrap. */ + private ListIterator nodeIterator; + + /** + * Create a new NodeIteratorAdapter. + * @param nodeIterator The ListIterator to iterate over. + */ + public NodeIteratorAdapter(ListIterator nodeIterator) { + this.nodeIterator = nodeIterator; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#getRoot() + */ + public Node getRoot() { + return null; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#getWhatToShow() + */ + public int getWhatToShow() { + return NodeFilter.SHOW_ALL; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#getFilter() + */ + public NodeFilter getFilter() { + return null; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#getExpandEntityReferences() + */ + public boolean getExpandEntityReferences() { + return false; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#nextNode() + */ + public Node nextNode() throws DOMException { + if (nodeIterator.hasNext()) { + return (Node) nodeIterator.next(); + } + return null; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#previousNode() + */ + public Node previousNode() throws DOMException { + if (nodeIterator.hasPrevious()) { + return (Node) nodeIterator.previous(); + } + return null; + } + + /** + * @see org.w3c.dom.traversal.NodeIterator#detach() + */ + public void detach() { + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java b/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java new file mode 100644 index 000000000..7102cadca --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java @@ -0,0 +1,44 @@ +package at.gv.egovernment.moa.util; + +import java.util.List; + +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * A NodeList implementation based on a List. + * + * @see java.util.List + * @see org.w3c.dom.NodeList + * + * @author Patrick Peck + * @version $Id$ + */ +public class NodeListAdapter implements NodeList { + /** The List to wrap. */ + private List nodeList; + + /** + * Create a new NodeListAdapter. + * + * @param nodeList The List containing the nodes. + */ + public NodeListAdapter(List nodeList) { + this.nodeList = nodeList; + } + + /** + * @see org.w3c.dom.NodeList#item(int) + */ + public Node item(int index) { + return (Node) nodeList.get(index); + } + + /** + * @see org.w3c.dom.NodeList#getLength() + */ + public int getLength() { + return nodeList.size(); + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java b/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java new file mode 100644 index 000000000..f9d330d41 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java @@ -0,0 +1,78 @@ +/* + * Created on 26.04.2004 + * + * @author rschamberger + * $ID$ + */ +package at.gv.egovernment.moa.util; + +import org.w3c.dom.Element; + +import at.gv.egovernment.moa.logging.Logger; + +/** + * utility functions to write XML data to files + * @author rschamberger + * @version $Id$ + */ +public class OutputXML2File { + + /** + * writes an XML structure to file if debug is enabled in hierarchy (Encoding: UTF-8) + * + * @param filename file name + * @param rootElem root element in DOM tree + * @param hierarchy of the Logger + */ + public static void debugOutputXML2File(String filename, Element rootElem, String hierarchy) { + if (Logger.isDebugEnabled(hierarchy)) { + outputXML2File(filename, rootElem); + } + } + + /** + * writes an XML structure to file if debug is enabled in hierarchy (Encoding: UTF-8) + * + * @param filename file name + * @param xmlString XML string + * @param hierarchy of the Logger + */ + public static void debugOutputXML2File(String filename, String xmlString, String hierarchy) { + if (Logger.isDebugEnabled(hierarchy)) { + outputXML2File(filename, xmlString); + } + } + + /** + * writes an XML structure to file (Encoding: UTF-8) + * + * @param filename file name + * @param rootElem root element in DOM tree + */ + public static void outputXML2File(String filename, Element rootElem) { + try { + String xmlString = new String(DOMUtils.serializeNode(rootElem)); + outputXML2File(filename, xmlString); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + /** + * writes an XML structure to file (Encoding: UTF-8) + * + * @param filename file name + * @param xmlString XML string + */ + public static void outputXML2File(String filename, String xmlString) { + try { + java.io.OutputStream fout = new java.io.FileOutputStream(filename); + byte[] xmlData = xmlString.getBytes("UTF-8"); + fout.write(xmlData); + fout.close(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java b/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java new file mode 100644 index 000000000..90b28548a --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java @@ -0,0 +1,66 @@ +package at.gv.egovernment.moa.util; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * A class to chain ResourceBundles. + * + * @author Patrick Peck + * @version $Id$ + */ +public class ResourceBundleChain { + /** Error message indicating the resource is not available. */ + private static final String ERROR_MISSING_RESOURCE = "Missing resource"; + /** The ResourceBundles contained in this chain. */ + private List resourceBundles = new ArrayList(); + + /** + * Add a ResourceBundle to the chain. + * + * @param resourceBundle The ResourceBundle to add. + */ + public void addResourceBundle(ResourceBundle resourceBundle) { + resourceBundles.add(resourceBundle); + } + + /** + * Return the value of the resource. + * + * @param key The key to access the String resource. + * @return The resource value. All the registered ResourceBundles + * are searched in the order in which they have previously been added to this + * ResourceBundleChain. + * @throws MissingResourceException The resource coult not be found in any of + * the bundles. + */ + public String getString(String key) throws MissingResourceException { + MissingResourceException lastException = null; + Iterator iter; + + // handle case where no resource bundles have been added + if (resourceBundles.size() == 0) { + throw new MissingResourceException( + ERROR_MISSING_RESOURCE, + this.getClass().getName(), + key); + } + + // try to find the resource in one of the bundles; if it cannot be found, + // return the exception thrown by the last bundle in the list + for (iter = resourceBundles.iterator(); iter.hasNext();) { + ResourceBundle resourceBundle = (ResourceBundle) iter.next(); + try { + String value = resourceBundle.getString(key); + return value; + } catch (MissingResourceException e) { + lastException = e; + } + } + throw lastException; + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java new file mode 100644 index 000000000..ada21b412 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java @@ -0,0 +1,221 @@ +package at.gv.egovernment.moa.util; + +import java.io.IOException; +import java.io.InputStream; +import java.security.GeneralSecurityException; +import java.security.KeyStore; + +import javax.net.ssl.KeyManager; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; + +/** + * Utility for connecting to server applications via SSL. + * + * @author Paul Ivancsics + * @version $Id$ + */ +public class SSLUtils { + + /** + * Creates an SSLSocketFactory which utilizes the given trust store. + * + * @param trustStoreType key store type of trust store + * @param trustStoreInputStream input stream for reading JKS trust store containing + * trusted server certificates; if null, the default + * trust store will be utilized + * @param trustStorePassword if provided, it will be used to check + * the integrity of the trust store; if omitted, it will not be checked + * @return SSLSocketFactory to be used by an HttpsURLConnection + * @throws IOException thrown while reading from the input stream + * @throws GeneralSecurityException thrown while creating the socket factory + */ + public static SSLSocketFactory getSSLSocketFactory( + String trustStoreType, + InputStream trustStoreInputStream, + String trustStorePassword) + throws IOException, GeneralSecurityException { + + TrustManager[] tms = getTrustManagers(trustStoreType, trustStoreInputStream, trustStorePassword); + SSLContext ctx = SSLContext.getInstance("TLS"); + ctx.init(null, tms, null); + + SSLSocketFactory sf = ctx.getSocketFactory(); + return sf; + } + /** + * Creates an SSLSocketFactory which utilizes the + * given trust store and keystore. + * + * @param trustStore trust store containing trusted server certificates; + * if null, the default trust store will be utilized + * @param clientKeyStoreType key store type of clientKeyStore + * @param clientKeyStoreURL URL of key store containing keys to be used for + * client authentication; if null, the default key store will be utilized + * @param clientKeyStorePassword if provided, it will be used to check + * the integrity of the client key store; if omitted, it will not be checked + * @return SSLSocketFactory to be used by an HttpsURLConnection + * @throws IOException thrown while reading key store file + * @throws GeneralSecurityException thrown while creating the socket factory + */ + public static SSLSocketFactory getSSLSocketFactory( + KeyStore trustStore, + String clientKeyStoreType, + String clientKeyStoreURL, + String clientKeyStorePassword) + throws IOException, GeneralSecurityException { + + SSLContext ctx = getSSLContext( + trustStore, clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); + SSLSocketFactory sf = ctx.getSocketFactory(); + return sf; + } + /** + * Creates an SSLContext initialized for the + * given trust store and keystore. + * + * @param trustStore trust store containing trusted server certificates; + * if null, the default trust store will be utilized + * @param clientKeyStoreType key store type of clientKeyStore + * @param clientKeyStoreURL URL of key store containing keys to be used for + * client authentication; if null, the default key store will be utilized + * @param clientKeyStorePassword if provided, it will be used to check + * the integrity of the client key store; if omitted, it will not be checked + * @return SSLContext to be used for creating an SSLSocketFactory + * @throws IOException thrown while reading key store file + * @throws GeneralSecurityException thrown while creating the SSL context + */ + public static SSLContext getSSLContext( + KeyStore trustStore, + String clientKeyStoreType, + String clientKeyStoreURL, + String clientKeyStorePassword) + throws IOException, GeneralSecurityException { + + //System.setProperty("javax.net.debug", "all"); + TrustManager[] tms = getTrustManagers(trustStore); + KeyManager[] kms = getKeyManagers(clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); + SSLContext ctx = SSLContext.getInstance("TLS"); + ctx.init(kms, tms, null); + return ctx; + } + /** + * Loads the trust store from an input stream and gets the + * TrustManagers from a default TrustManagerFactory, + * initialized from the given trust store. + * @param trustStoreType key store type of trust store + * @param trustStoreInputStream input stream for reading JKS trust store containing + * trusted server certificates; if null, the default + * trust store will be utilized + * @param trustStorePassword if provided, it will be used to check + * the integrity of the trust store; if omitted, it will not be checked + * @return TrustManagers to be used for creating an + * SSLSocketFactory utilizing the given trust store + * @throws IOException thrown while reading from the input stream + * @throws GeneralSecurityException thrown while initializing the + * default TrustManagerFactory + */ + protected static TrustManager[] getTrustManagers( + String trustStoreType, + InputStream trustStoreInputStream, + String trustStorePassword) + throws IOException, GeneralSecurityException { + + if (trustStoreInputStream == null) + return null; + + // Set up the TrustStore to use. We need to load the file into + // a KeyStore instance. + KeyStore trustStore = KeyStoreUtils.loadKeyStore(trustStoreType, trustStoreInputStream, trustStorePassword); + return getTrustManagers(trustStore); + } + /** + * Gets the TrustManagers from a default TrustManagerFactory, + * initialized from the given trust store. + * + * @param trustStore the trust store to use + * @return TrustManagers to be used for creating an + * SSLSocketFactory utilizing the given trust store + * @throws GeneralSecurityException thrown while initializing the + * default TrustManagerFactory + */ + protected static TrustManager[] getTrustManagers(KeyStore trustStore) + throws GeneralSecurityException { + + if (trustStore == null) + return null; + + // Initialize the default TrustManagerFactory with this KeyStore + String alg=TrustManagerFactory.getDefaultAlgorithm(); + TrustManagerFactory tmFact=TrustManagerFactory.getInstance(alg); + tmFact.init(trustStore); + + // And now get the TrustManagers + TrustManager[] tms=tmFact.getTrustManagers(); + return tms; + } + /** + * Loads the client key store from file and gets the + * KeyManagers from a default KeyManagerFactory, + * initialized from the given client key store. + * @param clientKeyStoreType key store type of clientKeyStore + * @param clientKeyStoreURL URL of key store containing keys to be used for + * client authentication; if null, the default key store will be utilized + * @param clientKeyStorePassword password used to check the integrity of the client key store; + * if null, it will not be checked + * @return KeyManagers to be used for creating an + * SSLSocketFactory utilizing the given client key store + * @throws IOException thrown while reading from the key store file + * @throws GeneralSecurityException thrown while initializing the + * default KeyManagerFactory + */ + public static KeyManager[] getKeyManagers ( + String clientKeyStoreType, + String clientKeyStoreURL, + String clientKeyStorePassword) + throws IOException, GeneralSecurityException { + + if (clientKeyStoreURL == null) + return null; + + // Set up the KeyStore to use. We need to load the file into + // a KeyStore instance. + KeyStore clientKeyStore = KeyStoreUtils.loadKeyStore( + clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); + return getKeyManagers(clientKeyStore, clientKeyStorePassword); + } + /** + * Gets the KeyManagers from a default KeyManagerFactory, + * initialized from the given client key store. + * @param clientKeyStore client key store + * @param clientKeyStorePassword if provided, it will be used to check + * the integrity of the client key store; if omitted, it will not be checked + * @return KeyManagers to be used for creating an + * SSLSocketFactory utilizing the given client key store + * @throws GeneralSecurityException thrown while initializing the + * default KeyManagerFactory + */ + public static KeyManager[] getKeyManagers ( + KeyStore clientKeyStore, + String clientKeyStorePassword) + throws GeneralSecurityException { + + if (clientKeyStore == null) + return null; + + // Now we initialize the default KeyManagerFactory with this KeyStore + String alg=KeyManagerFactory.getDefaultAlgorithm(); + KeyManagerFactory kmFact=KeyManagerFactory.getInstance(alg); + char[] password = null; + if (clientKeyStorePassword != null) + password = clientKeyStorePassword.toCharArray(); + kmFact.init(clientKeyStore, password); + + // And now get the KeyManagers + KeyManager[] kms=kmFact.getKeyManagers(); + return kms; + } +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java b/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java new file mode 100644 index 000000000..38c4e863c --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java @@ -0,0 +1,64 @@ +package at.gv.egovernment.moa.util; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * An EntityResolver that maps system IDs to + * InputStreams. + * + * @author Patrick Peck + * @version $Id$ + */ +public class StreamEntityResolver implements EntityResolver { + + /** A mapping from Public ID or System ID to an InputStream + * containing the entity. */ + private Map mappedEntities; + + /** + * Create a StreamEntityResolver. + * + * @param mappedEntities A mapping from public or system IDs + * (String objects) to InputStreams. + */ + public StreamEntityResolver(Map mappedEntities) { + this.mappedEntities = mappedEntities; + } + + /** + * Resolve an entity by looking it up in the mapped entities. + * + * First, the public ID is looked up in the mapping, then the system ID. + * + * @param publicId The public ID of the entity. + * @param systemId The system ID of the entity. + * @return An InputStream containing the entity or + * null if no entity could be found. + * @throws SAXException Signalling a parsing exception. + * @throws IOException Error reading the entity. + */ + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException, IOException { + + InputSource src = null; + + if (publicId != null && mappedEntities.get(publicId) != null) { + src = new InputSource((InputStream) mappedEntities.get(publicId)); + } else if (systemId != null && mappedEntities.get(systemId) != null) { + src = new InputSource((InputStream) mappedEntities.get(systemId)); + } + + if (src != null) { + src.setPublicId(publicId); + src.setSystemId(systemId); + } + + return src; + } +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java new file mode 100644 index 000000000..a22f1c2a8 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java @@ -0,0 +1,128 @@ +package at.gv.egovernment.moa.util; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintStream; + +/** + * Utility methods for streams. + * + * @author Patrick Peck + * @version $Id$ + */ +public class StreamUtils { + + /** + * Compare the contents of two InputStreams. + * + * @param is1 The 1st InputStream to compare. + * @param is2 The 2nd InputStream to compare. + * @return boolean true, if both streams contain the exactly the + * same content, false otherwise. + * @throws IOException An error occurred reading one of the streams. + */ + public static boolean compareStreams(InputStream is1, InputStream is2) + throws IOException { + + byte[] buf1 = new byte[256]; + byte[] buf2 = new byte[256]; + int length1; + int length2; + + try { + while (true) { + length1 = is1.read(buf1); + length2 = is2.read(buf2); + + if (length1 != length2) { + return false; + } + if (length1 <= 0) { + return true; + } + if (!compareBytes(buf1, buf2, length1)) { + return false; + } + } + } catch (IOException e) { + throw e; + } finally { + // close both streams + try { + is1.close(); + is2.close(); + } catch (IOException e) { + // ignore this + } + } + } + + /** + * Compare two byte arrays, up to a given maximum length. + * + * @param b1 1st byte array to compare. + * @param b2 2nd byte array to compare. + * @param length The maximum number of bytes to compare. + * @return true, if the byte arrays are equal, false + * otherwise. + */ + private static boolean compareBytes(byte[] b1, byte[] b2, int length) { + if (b1.length != b2.length) { + return false; + } + + for (int i = 0; i < b1.length && i < length; i++) { + if (b1[i] != b2[i]) { + return false; + } + } + + return true; + } + + /** + * Reads a byte array from a stream. + * @param in The InputStream to read. + * @return The bytes contained in the given InputStream. + * @throws IOException on any exception thrown + */ + public static byte[] readStream(InputStream in) throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int b; + while ((b = in.read()) >= 0) + out.write(b); + in.close(); + return out.toByteArray(); + } + + /** + * Reads a String from a stream, using given encoding. + * @param in The InputStream to read. + * @param encoding The character encoding to use for converting the bytes + * of the InputStream into a String. + * @return The content of the given InputStream converted into + * a String. + * @throws IOException on any exception thrown + */ + public static String readStream(InputStream in, String encoding) throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int b; + while ((b = in.read()) >= 0) + out.write(b); + in.close(); + return out.toString(encoding); + } + + /** + * Gets the stack trace of the Throwable passed in as a string. + * @param t The Throwable. + * @return a String representing the stack trace of the Throwable. + */ + public static String getStackTraceAsString(Throwable t) + { + ByteArrayOutputStream stackTraceBIS = new ByteArrayOutputStream(); + t.printStackTrace(new PrintStream(stackTraceBIS)); + return new String(stackTraceBIS.toByteArray()); + } +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java new file mode 100644 index 000000000..61b1a18ea --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java @@ -0,0 +1,164 @@ +// Copyright (C) 2002 IAIK +// email: jce-info@iaik.tu-graz.ac.at +// +// All rights reserved. +// +// This source is provided for inspection purposes and recompilation only, +// unless specified differently in a contract with IAIK. This source has to +// be kept in strict confidence and must not be disclosed to any third party +// under any circumstances. Redistribution in source and binary forms, with +// or without modification, are permitted in any case! +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// + +package at.gv.egovernment.moa.util; + +import java.util.StringTokenizer; + +/** + * Utitility functions for string manipulations. + * + * @author Harald Bratko + */ +public class StringUtils { + + /** + * Removes all blanks and tabs from the given string. + * + * @param s The string to remove all blanks and tabs from. + * @return The input string with all blanks and tabs removed from. + */ + public static String removeBlanks(String s) { + StringTokenizer st = new StringTokenizer(s); + StringBuffer sb = new StringBuffer(s.length()); + while (st.hasMoreTokens()) { + sb.append(st.nextToken()); + } + return sb.toString(); + } + + /** + * Removes all occurences of the specified token from the the given string. + * + * @param s The string to remove all occurences of the specified token from. + * @return The input string with all occurences of the specified token removed from. + */ + public static String removeToken(String s, String token) { + StringTokenizer st = new StringTokenizer(s, token); + StringBuffer sb = new StringBuffer(s.length()); + while (st.hasMoreTokens()) { + sb.append(st.nextToken()); + } + return sb.toString(); + } + + /** + * Removes all leading zeros from the input string. + * + * @param s The string remove the leading zeros from. + * @return The input string with the leading zeros removed from. + */ + public static String deleteLeadingZeros(String s) { + StringBuffer sb = new StringBuffer(s); + int l = sb.length(); + int j = 0; + for (int i=0; is that matches the given + * search string by the given replace string. + * + * @param s The string where the replacment should take place. + * @param search The pattern that should be replaced. + * @param replace The string that should replace all each search + * string within s. + * @return A string whrer all occurrence of search are + * replaced with replace. + */ + public static String replaceAll (String s, String search, String replace) + { + StringBuffer sb = new StringBuffer(); + int i = 0, j = 0; + int len = search.length(); + while (j > -1) + { + j = s.indexOf(search, i); + + if (j > -1) + { + sb.append(s.substring(i,j)); + sb.append(replace); + i = j + len; + } + } + + sb.append(s.substring(i, s.length())); + + return sb.toString(); + } + + /** + * Changes the SecurityLayer version in the given string. + * This method usually takes as input an XML structure represented in a string + * format and changes the SecurityLayer namespaces prefixes and URIs from + * one SecurityLayer version to another. + * e.g.: code>sl10 to sl and + * http://www.buergerkarte.at/namespaces/securitylayer/20020225# + * to + * http://www.buergerkarte.at/namespaces/securitylayer/1.2# + * + * @param s The string (usally an XML structure) where the + * SecurityLayer version should be changed. + * @param slPrefixOld The SecurityLayer namespace prefix that should be + * replaced by the new one. + * @param slPrefixNew The new SecurityLayer namespace prefix that should + * replace the old one. + * @param slNSUriOld The SecurityLayer namespace URI that should be + * replaced by the new one. + * @param slNSUriNew The new SecurityLayer namespace URI that should + * replace the old one. + * @return A string where the SecurityLayer namespace prefixes + * and URIs are replaced by new ones. + */ + public static String changeSLVersion(String s, String slPrefixOld, String slPrefixNew, String slNSUriOld, String slNSUriNew) { + String retString = replaceAll(s, slPrefixOld, slPrefixNew); + retString = replaceAll(retString, slNSUriOld, slNSUriNew); + return retString ; + } + + /** + * Removes the XML declaration from an XML expression. + * + * @param xmlString XML expression as String + * + * @return XML expression, XML declaration removed + */ + public static String removeXMLDeclaration(String xmlString) { + if (xmlString.startsWith("application/x-www-form-urlencoded string using a specific encoding scheme. + * @param s the string to decode + * @param encoding name of character encoding + * @return the newly decoded string + * @throws UnsupportedEncodingException if the encoding is not supported + */ + public static String decode(String s, String encoding) throws UnsupportedEncodingException { + StringReader in = new StringReader(s); + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + for (int b = read(in); b >= 0; b = read(in)) + bout.write(b); + return bout.toString(encoding); + } + /** + * Decodes the next byte from the string reader. + * @param in string reader + * @return the next byte decoded; + * -1 upon end of string, on erroneous data, and on any exception caught + * @todo syntax check on string + */ + private static int read(StringReader in) { + try { + int b = in.read(); + if (b == '+') + return ' '; + if (b == '%') { + char[] hex = new char[2]; + if (in.read(hex, 0, 2) >= 0) { + String hexString = new String(hex); + return Integer.valueOf(hexString, 16).intValue(); + } + else + return -1; + } + return b; + } + catch (IOException ex) { + return -1; + } + catch (NumberFormatException ex) { + return -1; + } + } +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java b/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java new file mode 100644 index 000000000..840c0c3bc --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java @@ -0,0 +1,63 @@ +package at.gv.egovernment.moa.util; + +import java.io.ByteArrayInputStream; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; + +/** + * Translates a string into mime format "x-www-form-urlencoded". + * Provides a function missing in JDK 1.3. + * @author Paul Ivancsics + * @version $Id$ + */ +public class URLEncoder { + + /** + * Translates a string into x-www-form-urlencoded format. + * @param s the string to be translated + * @param encoding the encoding to use + * @return the translated string + * @throws UnsupportedEncodingException when the desired encoding is not supported + */ + public static String encode(String s, String encoding) throws UnsupportedEncodingException { + byte[] barr = s.getBytes(encoding); + ByteArrayInputStream bin = new ByteArrayInputStream(barr); + StringWriter out = new StringWriter(); + for (int b = bin.read(); b >= 0; b = bin.read()) + encode(b, out); + return out.toString(); + } + + /** + * Encode a character. + * @param ch The character to encode. + * @param out The StringWriter containing the result. + */ + private static void encode(int ch, StringWriter out) { + if ((ch >= 'a' && ch <= 'z') + || (ch >= 'A' && ch <= 'Z') + || (ch >= '0' && ch <= '9') + || ch == '.' || ch == '-' || ch == '*' || ch == '_') + out.write(ch); + else if (ch == ' ') + out.write('+'); + else + encodeHex(ch, out); + } + + /** + * Encode a character as an escaped hex value. + * @param ch The character to encode. + * @param out The StringWriter containing the result. + */ + private static void encodeHex(int ch, StringWriter out) { + out.write('%'); + String hex = Integer.toHexString(ch).toUpperCase(); + if (hex.length() < 2) + out.write('0'); + else + out.write(hex.charAt(hex.length() - 2)); + out.write(hex.charAt(hex.length() - 1)); + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java b/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java new file mode 100644 index 000000000..e10c882e5 --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java @@ -0,0 +1,58 @@ +package at.gv.egovernment.moa.util; + +import java.io.PrintStream; +import java.io.PrintWriter; + +/** + * An exception occurred evaluating an XPath. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XPathException extends RuntimeException { + /** The wrapped exception. */ + private Throwable wrapped; + + /** + * Create a XPathException. + * + * @param message The exception message. + * @param wrapped The exception being the likely cause of this exception. + */ + public XPathException(String message, Throwable wrapped) { + super(message); + this.wrapped = wrapped; + } + + /** + * Return the wrapped exception. + * + * @return The wrapped exception being the likely cause of this exception. + */ + public Throwable getWrapped() { + return wrapped; + } + + /** + * @see java.lang.Throwable#printStackTrace(java.io.PrintStream) + */ + public void printStackTrace(PrintStream s) { + super.printStackTrace(s); + if (getWrapped() != null) { + s.print("Caused by: "); + getWrapped().printStackTrace(s); + } + } + + /** + * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter) + */ + public void printStackTrace(PrintWriter s) { + super.printStackTrace(s); + if (getWrapped() != null) { + s.print("Caused by: "); + getWrapped().printStackTrace(s); + } + } + +} diff --git a/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java new file mode 100644 index 000000000..5212ed13e --- /dev/null +++ b/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java @@ -0,0 +1,526 @@ +package at.gv.egovernment.moa.util; + +import java.util.List; +import java.util.Map; + +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.traversal.NodeIterator; + +import org.jaxen.JaxenException; +import org.jaxen.NamespaceContext; +import org.jaxen.SimpleNamespaceContext; +import org.jaxen.dom.DOMXPath; +import org.jaxen.dom.DocumentNavigator; + +/** + * Utility methods to evaluate XPath expressions on DOM nodes. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XPathUtils { + + /** + * The XPath expression selecting all nodes under a given root (including the + * root node itself). + */ + public static final String ALL_NODES_XPATH = + "(.//. | .//@* | .//namespace::*)"; + + /** The DocumentNavigator to use for navigating the document. */ + private static DocumentNavigator documentNavigator = + DocumentNavigator.getInstance(); + /** The default namespace prefix to namespace URI mappings. */ + private static NamespaceContext NS_CONTEXT; + + static { + SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + ctx.addNamespace(Constants.MOA_PREFIX, Constants.MOA_NS_URI); + ctx.addNamespace(Constants.MOA_CONFIG_PREFIX, Constants.MOA_CONFIG_NS_URI); + ctx.addNamespace(Constants.MOA_ID_CONFIG_PREFIX, Constants.MOA_ID_CONFIG_NS_URI); + ctx.addNamespace(Constants.SL10_PREFIX, Constants.SL10_NS_URI); + ctx.addNamespace(Constants.SL11_PREFIX, Constants.SL11_NS_URI); + ctx.addNamespace(Constants.SL12_PREFIX, Constants.SL12_NS_URI); + ctx.addNamespace(Constants.ECDSA_PREFIX, Constants.ECDSA_NS_URI); + ctx.addNamespace(Constants.PD_PREFIX, Constants.PD_NS_URI); + ctx.addNamespace(Constants.SAML_PREFIX, Constants.SAML_NS_URI); + ctx.addNamespace(Constants.SAMLP_PREFIX, Constants.SAMLP_NS_URI); + ctx.addNamespace(Constants.DSIG_PREFIX, Constants.DSIG_NS_URI); + ctx.addNamespace(Constants.XSLT_PREFIX, Constants.XSLT_NS_URI); + ctx.addNamespace(Constants.XSI_PREFIX, Constants.XSI_NS_URI); + ctx.addNamespace(Constants.DSIG_FILTER2_PREFIX, Constants.DSIG_FILTER2_NS_URI); + ctx.addNamespace(Constants.DSIG_EC_PREFIX, Constants.DSIG_EC_NS_URI); + ctx.addNamespace(Constants.MD_PREFIX, Constants.MD_NS_URI); + ctx.addNamespace(Constants.MDP_PREFIX, Constants.MDP_NS_URI); + ctx.addNamespace(Constants.MVV_PREFIX, Constants.MVV_NS_URI); + ctx.addNamespace(Constants.STB_PREFIX, Constants.STB_NS_URI); + ctx.addNamespace(Constants.WRR_PREFIX, Constants.WRR_NS_URI); + NS_CONTEXT = ctx; + } + + /** + * Return a NodeIterator over the nodes matching the XPath + * expression. + * + * All namespace URIs and prefixes declared in the Constants + * interface are used for resolving namespaces. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return An iterator over the resulting nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeIterator selectNodeIterator(Node contextNode, String exp) + throws XPathException { + + return selectNodeIterator(contextNode, NS_CONTEXT, exp); + } + + /** + * Return a NodeIterator over the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceElement An element from which to build the + * namespace mapping for evaluating the XPath expression + * @param exp The XPath expression to evaluate. + * @return An iterator over the resulting nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeIterator selectNodeIterator( + Node contextNode, + Element namespaceElement, + String exp) + throws XPathException { + + try { + SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + ctx.addElementNamespaces(documentNavigator, namespaceElement); + return selectNodeIterator(contextNode, ctx, exp); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Return a NodeIterator over the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceMapping A namespace prefix to namespace URI mapping + * (String to String) for evaluating the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return An iterator over the resulting nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeIterator selectNodeIterator( + Node contextNode, + Map namespaceMapping, + String exp) + throws XPathException { + + SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); + + return selectNodeIterator(contextNode, ctx, exp); + } + + /** + * Return a NodeIterator over the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param nsContext The NamespaceContext for resolving namespace + * prefixes to namespace URIs for evaluating the XPath expression. + * @param exp The XPath expression to evaluate. + * @return An iterator over the resulting nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + private static NodeIterator selectNodeIterator( + Node contextNode, + NamespaceContext nsContext, + String exp) + throws XPathException { + + try { + DOMXPath xpath = new DOMXPath(exp); + List nodes; + + xpath.setNamespaceContext(nsContext); + nodes = xpath.selectNodes(contextNode); + return new NodeIteratorAdapter(nodes.listIterator()); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Return a NodeList of all the nodes matching the XPath + * expression. + * + * All namespace URIs and prefixes declared in the Constants + * interface are used for resolving namespaces. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return A NodeList containing the matching nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeList selectNodeList(Node contextNode, String exp) + throws XPathException { + + return selectNodeList(contextNode, NS_CONTEXT, exp); + } + + /** + * Return a NodeList of all the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceElement An element from which to build the + * namespace mapping for evaluating the XPath expression + * @param exp The XPath expression to evaluate. + * @return A NodeList containing the matching nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeList selectNodeList( + Node contextNode, + Element namespaceElement, + String exp) + throws XPathException { + + try { + SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + + ctx.addElementNamespaces(documentNavigator, namespaceElement); + return selectNodeList(contextNode, ctx, exp); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Return a NodeList of all the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceMapping A namespace prefix to namespace URI mapping + * (String to String) for evaluating the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return A NodeList containing the matching nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static NodeList selectNodeList( + Node contextNode, + Map namespaceMapping, + String exp) + throws XPathException { + + SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); + + return selectNodeList(contextNode, ctx, exp); + } + + /** + * Return a NodeList of all the nodes matching the XPath + * expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param nsContext The NamespaceContext for resolving namespace + * prefixes to namespace URIs for evaluating the XPath expression. + * @param exp The XPath expression to evaluate. + * @return A NodeList containing the matching nodes. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + private static NodeList selectNodeList( + Node contextNode, + NamespaceContext nsContext, + String exp) + throws XPathException { + + try { + DOMXPath xpath = new DOMXPath(exp); + List nodes; + + xpath.setNamespaceContext(nsContext); + nodes = xpath.selectNodes(contextNode); + return new NodeListAdapter(nodes); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Select the first node matching an XPath expression. + * + * All namespace URIs and prefixes declared in the Constants + * interface are used for resolving namespaces. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return Node The first node matching the XPath expression, or + * null, if no node matched. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static Node selectSingleNode(Node contextNode, String exp) + throws XPathException { + + return selectSingleNode(contextNode, NS_CONTEXT, exp); + } + + /** + * Select the first node matching an XPath expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceElement An element from which to build the + * namespace mapping for evaluating the XPath expression + * @param exp The XPath expression to evaluate. + * @return Node The first node matching the XPath expression, or + * null, if no node matched. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static Node selectSingleNode( + Node contextNode, + Element namespaceElement, + String exp) + throws XPathException { + + try { + SimpleNamespaceContext ctx = new SimpleNamespaceContext(); + ctx.addElementNamespaces(documentNavigator, namespaceElement); + + return selectSingleNode(contextNode, ctx, exp); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Select the first node matching an XPath expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param namespaceMapping A namespace prefix to namespace URI mapping + * (String to String) for evaluating the XPath + * expression. + * @param exp The XPath expression to evaluate. + * @return Node The first node matching the XPath expression, or + * null, if no node matched. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + public static Node selectSingleNode( + Node contextNode, + Map namespaceMapping, + String exp) + throws XPathException { + + SimpleNamespaceContext ctx = new SimpleNamespaceContext(namespaceMapping); + + return selectSingleNode(contextNode, ctx, exp); + } + + /** + * Select the first node matching an XPath expression. + * + * @param contextNode The root node from which to evaluate the XPath + * expression. + * @param nsContext The NamespaceContext for resolving namespace + * prefixes to namespace URIs for evaluating the XPath expression. + * @param exp The XPath expression to evaluate. + * @return Node The first node matching the XPath expression, or + * null, if no node matched. + * @throws XPathException An error occurred evaluating the XPath expression. + */ + private static Node selectSingleNode( + Node contextNode, + NamespaceContext nsContext, + String exp) + throws XPathException { + + try { + DOMXPath xpath = new DOMXPath(exp); + xpath.setNamespaceContext(nsContext); + return (Node) xpath.selectSingleNode(contextNode); + } catch (JaxenException e) { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { exp }); + throw new XPathException(message, e); + } + } + + /** + * Return the value of a DOM element whose location is given by an XPath + * expression. + * + * @param root The root element from which to evaluate the XPath. + * @param xpath The XPath expression pointing to the element whose value + * to return. + * @param def The default value to return, if no element can be found using + * the given xpath. + * @return The element value, if it can be located using the + * xpath. Otherwise, def is returned. + */ + public static String getElementValue( + Element root, + String xpath, + String def) { + + Element elem = (Element) XPathUtils.selectSingleNode(root, xpath); + return elem != null ? DOMUtils.getText(elem) : def; + } + + /** + * Return the value of a DOM attribute whose location is given by an XPath + * expression. + * + * @param root The root element from which to evaluate the XPath. + * @param xpath The XPath expression pointing to the attribute whose value to + * return. + * @param def The default value to return, if no attribute can be found using + * the given xpath. + * @return The element value, if it can be located using the + * xpath. Otherwise, def is returned. + */ + public static String getAttributeValue( + Element root, + String xpath, + String def) { + + Attr attr = (Attr) XPathUtils.selectSingleNode(root, xpath); + return attr != null ? attr.getValue() : def; + } + + /** + * Returns the namespace prefix used within XPathUtils for referring to + * the namespace of the specified (Security Layer command) element. + * + * This namespace prefix can be used in various XPath expression evaluation methods + * within XPathUtils without explicitely binding it to the particular + * namespace. + * + * @param contextElement The (Security Layer command) element. + * + * @return the namespace prefix used within XPathUtils for referring to + * the namespace of the specified (Security Layer command) element. + * + * throws XpathException If the specified element has a namespace other than the ones + * known by this implementation as valid Security Layer namespaces (cf. + * @link Constants#SL10_NS_URI, @link Constants#SL11_NS_URI, @link Constants#SL12_NS_URI). + */ + public static String getSlPrefix (Element contextElement) throws XPathException + { + String sLNamespace = contextElement.getNamespaceURI(); + String sLPrefix = null; + + if (sLNamespace.equals(Constants.SL10_NS_URI)) + { + sLPrefix = Constants.SL10_PREFIX; + } + else if (sLNamespace.equals(Constants.SL12_NS_URI)) + { + sLPrefix = Constants.SL12_PREFIX; + } + else if (sLNamespace.equals(Constants.SL11_NS_URI)) + { + sLPrefix = Constants.SL11_PREFIX; + } + else + { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger Security Layer Namespace: \"" + sLNamespace + "\"."}); + throw new XPathException(message, null); + } + + return sLPrefix; + } + + + /** + * Return the SecurityLayer namespace prefix of the context element. + * If the context element is not the element that lies within the + * SecurityLayer namespace. The Securitylayer namespace is derived from + * the xmlns:sl10, sl11 or sl + * attribute of the context element. + * + * The returned prefix is needed for evaluating XPATH expressions. + * + * @param contextElement The element to get a prefix for the Securitylayer namespace, + * that is used within the corresponding document. + * + * @return The string sl10, sl11 or sl, + * depending on the SecurityLayer namespace of the contextElement. + * + * throws XPathException If no (vlalid) SecurityLayer namespace prefix or namespace + * is defined. + */ + public static String getSlPrefixFromNoRoot (Element contextElement) throws XPathException { + + String slPrefix = checkSLnsDeclaration(contextElement, Constants.SL10_PREFIX, Constants.SL10_NS_URI); + if (slPrefix == null) { + slPrefix = checkSLnsDeclaration(contextElement, Constants.SL11_PREFIX, Constants.SL11_NS_URI); + } + if (slPrefix == null) { + slPrefix = checkSLnsDeclaration(contextElement, Constants.SL12_PREFIX, Constants.SL12_NS_URI); + } + + return slPrefix; + + } + + /** + * Checks if the context element has an attribute xmlns:slPrefix and + * if the prefix of that attribute corresponds with a valid SecurityLayer namespace. + * + * @param contextElement The element to be checked. + * @param slPrefix The prefix which should be checked. Must be a valid SecurityLayer + * namespace prefix. + * @param slNameSpace The SecurityLayer namespace that corresponds to the specified prefix. + * + * @return The valid SecurityLayer prefix or null if this prefix is + * not used. + * @throws XPathException + */ + private static String checkSLnsDeclaration(Element contextElement, String slPrefix, String slNameSpace) + throws XPathException + { + String nsAtt = "xmlns:" + slPrefix; + String nameSpace = contextElement.getAttribute(nsAtt); + if (nameSpace == "") { + return null; + } else { + // check if namespace is correct + if (nameSpace.equals(slNameSpace)) { + return slPrefix; + } else { + MessageProvider msg = MessageProvider.getInstance(); + String message = msg.getMessage("xpath.00", new Object[] { "Ungültiger SecurityLayer Namespace: \"" + nameSpace + "\"."}); + throw new XPathException(message, null); + } + } + } + +} diff --git a/common/src/test/at/gv/egovernment/moa/AllTests.java b/common/src/test/at/gv/egovernment/moa/AllTests.java deleted file mode 100644 index 00e2c505f..000000000 --- a/common/src/test/at/gv/egovernment/moa/AllTests.java +++ /dev/null @@ -1,38 +0,0 @@ -package test.at.gv.egovernment.moa; - -import test.at.gv.egovernment.moa.util.DOMUtilsTest; -import test.at.gv.egovernment.moa.util.DateTimeUtilsTest; -import test.at.gv.egovernment.moa.util.KeyStoreUtilsTest; -import test.at.gv.egovernment.moa.util.SSLUtilsTest; -import test.at.gv.egovernment.moa.util.XPathUtilsTest; - -import junit.awtui.TestRunner; -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author patrick - * @version $Id$ - */ -public class AllTests { - - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(DOMUtilsTest.class); - suite.addTestSuite(DateTimeUtilsTest.class); - suite.addTestSuite(XPathUtilsTest.class); - suite.addTestSuite(KeyStoreUtilsTest.class); - suite.addTestSuite(SSLUtilsTest.class); - - return suite; - } - - public static void main(String[] args) { - try { - TestRunner.run(AllTests.class); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/common/src/test/at/gv/egovernment/moa/MOATestCase.java b/common/src/test/at/gv/egovernment/moa/MOATestCase.java deleted file mode 100644 index 86ea2ee6c..000000000 --- a/common/src/test/at/gv/egovernment/moa/MOATestCase.java +++ /dev/null @@ -1,75 +0,0 @@ -package test.at.gv.egovernment.moa; - -import java.io.FileInputStream; -import java.io.StringReader; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.w3c.dom.Document; - -import org.xml.sax.InputSource; - -import junit.framework.TestCase; - -import at.gv.egovernment.moa.util.Constants; -import at.gv.egovernment.moa.util.DOMUtils; - -/** - * Base class for MOA test cases. - * - * Provides some utility functions. - * - * @author Patrick Peck - * @version $Id$ - */ -public class MOATestCase extends TestCase { - - protected static final String TESTDATA_ROOT = "data/test/"; - - /** - * Constructor for MOATestCase. - * @param arg0 - */ - public MOATestCase(String name) { - super(name); - } - - /** - * Parse an XML file non-validating. - */ - public static Document parseXml(String fileName) throws Exception { - return DOMUtils.parseDocument( - new FileInputStream(fileName), - false, - null, - null); - } - - /** - * Parse an XML validating with a given file name. - * - * Uses the local schema resources. - */ - public static Document parseXmlValidating(String fileName) throws Exception { - return DOMUtils.parseDocument( - new FileInputStream(fileName), - true, - Constants.ALL_SCHEMA_LOCATIONS, - null); - } - - /** - * Parse an XML from a String. - */ - public static Document parseXmlString(String xml) throws Exception { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder; - - factory.setNamespaceAware(true); - builder = factory.newDocumentBuilder(); - - return builder.parse(new InputSource(new StringReader(xml))); - } - -} diff --git a/common/src/test/at/gv/egovernment/moa/util/DOMUtilsTest.java b/common/src/test/at/gv/egovernment/moa/util/DOMUtilsTest.java deleted file mode 100644 index eb3ad1a5c..000000000 --- a/common/src/test/at/gv/egovernment/moa/util/DOMUtilsTest.java +++ /dev/null @@ -1,137 +0,0 @@ -package test.at.gv.egovernment.moa.util; -import java.io.FileInputStream; -import java.util.Map; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -import test.at.gv.egovernment.moa.*; - -import at.gv.egovernment.moa.util.Constants; -import at.gv.egovernment.moa.util.DOMUtils; - -/** - * @author Patrick Peck - * @version $Id$ - */ -public class DOMUtilsTest extends MOATestCase { - private static final String TESTDATA_BASE = TESTDATA_ROOT + "xml/"; - private static boolean grammarsInitialized = false; - - /** - * Constructor for DOMUtilsTest. - * @param name - */ - public DOMUtilsTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - if (!grammarsInitialized) { - // preparse XML schema - DOMUtils.addSchemaToPool( - getClass().getResourceAsStream(Constants.XML_SCHEMA_LOCATION), - Constants.XML_NS_URI); - // preparse XMLDsig Filter2 schema - DOMUtils.addSchemaToPool( - getClass().getResourceAsStream(Constants.DSIG_FILTER2_SCHEMA_LOCATION), - Constants.DSIG_FILTER2_NS_URI); - // preparse XMLDsig schema - DOMUtils.addSchemaToPool( - getClass().getResourceAsStream(Constants.DSIG_SCHEMA_LOCATION), - Constants.DSIG_NS_URI); - // preparse MOA schema - DOMUtils.addSchemaToPool( - getClass().getResourceAsStream(Constants.MOA_SCHEMA_LOCATION), - Constants.MOA_NS_URI); - grammarsInitialized = true; - } - } - - private Document parse(String fileName) throws Exception { - return DOMUtils.parseDocument( - new FileInputStream(fileName), - true, - Constants.ALL_SCHEMA_LOCATIONS, - null); - } - - public void testParseCreateXMLSignature() throws Exception { - parse(TESTDATA_BASE + "CreateXMLSignature/TestGeneratorCX2.005.Req.xml"); - parse(TESTDATA_BASE + "CreateXMLSignature/Req000.xml"); - parse(TESTDATA_BASE + "CreateXMLSignature/Req001.xml"); - parse(TESTDATA_BASE + "CreateXMLSignature/Req002.xml"); - parse(TESTDATA_BASE + "CreateXMLSignature/Req004.xml"); - } - - public void testParseVerifyCMSSignature() throws Exception { - parse(TESTDATA_BASE + "VerifyCMSSignature/Req000.xml"); - } - - public void testParseVerifyXMLSignature() throws Exception { - parse(TESTDATA_BASE + "VerifyXMLSignature/Req000.xml"); - parse(TESTDATA_BASE + "VerifyXMLSignature/Req001.xml"); - parse(TESTDATA_BASE + "VerifyXMLSignature/Req002.xml"); - parse(TESTDATA_BASE + "VerifyXMLSignature/TestGeneratorVX.002.Req.xml"); - //parse(TESTDATA_BASE + "VerifyXMLSignature/TestGeneratorVX.006.Req.xml"); - parse(TESTDATA_BASE + "VerifyXMLSignature/VerifySAMLRequest.xml"); - } - - public void testParseInfobox() throws Exception { - parse(TESTDATA_BASE + "Infobox/InfoboxReadResponseMOA4.xml"); - parse(TESTDATA_BASE + "Infobox/InfoboxReadResponse.xml"); - } - - - private Document parsePlain(String fileName) throws Exception { - return DOMUtils.parseDocument( - new FileInputStream(fileName), - false, - null, - null); - } - - public void testValidateCreateXMLSignature() throws Exception { - Document doc; - boolean valid; - - // test a valid request - doc = parsePlain(TESTDATA_BASE + "CreateXMLSignature/Req000.xml"); - valid = - DOMUtils.validateElement( - doc.getDocumentElement(), - Constants.ALL_SCHEMA_LOCATIONS, - null); - assertTrue(valid); - - // test an invalid request - doc = parsePlain(TESTDATA_BASE + "CreateXMLSignature/invalid.xml"); - try { - valid = - DOMUtils.validateElement( - doc.getDocumentElement(), - Constants.ALL_SCHEMA_LOCATIONS, - null); - fail(); - } catch (Exception e) { - } - } - - public void testGetNamespaceDeclarations() throws Exception { - Document doc; - NodeList nl; - Element elem; - Map nsDecls; - - doc = parse(TESTDATA_BASE + "VerifyXMLSignature/Req002.xml"); - nl = doc.getElementsByTagNameNS(Constants.DSIG_NS_URI, "Reference"); - elem = (Element) nl.item(0); - nsDecls = DOMUtils.getNamespaceDeclarations(elem); - - assertEquals(2, nsDecls.size()); - assertEquals(Constants.DSIG_NS_URI, nsDecls.get("dsig")); - assertEquals(Constants.MOA_NS_URI, nsDecls.get("")); - } - -} diff --git a/common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java b/common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java deleted file mode 100644 index da6b29b1c..000000000 --- a/common/src/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java +++ /dev/null @@ -1,104 +0,0 @@ -package test.at.gv.egovernment.moa.util; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -import junit.framework.TestCase; - -import at.gv.egovernment.moa.util.DateTimeUtils; - -/** - * @author Patrick Peck - * @version $Id$ - */ -public class DateTimeUtilsTest extends TestCase { - - /** - * Constructor for DateTimeUtilsTest. - * @param arg0 - */ - public DateTimeUtilsTest(String arg0) { - super(arg0); - } - - public void testParseDateTimeValid() throws Exception { - Date date; - DateFormat format = SimpleDateFormat.getDateTimeInstance(); - String dateStr; - - format.setTimeZone(TimeZone.getTimeZone("GMT")); - date = DateTimeUtils.parseDateTime("+1971-12-12T06:30:15"); - date.setTime(date.getTime() + TimeZone.getDefault().getRawOffset()); - dateStr = format.format(date); - assertEquals("12.12.1971 06:30:15", dateStr); - - date = DateTimeUtils.parseDateTime("2000-01-01T23:59:59.012Z"); - dateStr = format.format(date); - assertEquals("01.01.2000 23:59:59", dateStr); - - date = DateTimeUtils.parseDateTime("2003-05-20T12:17:30-05:00"); - dateStr = format.format(date); - assertEquals("20.05.2003 17:17:30", dateStr); - - - date = DateTimeUtils.parseDateTime("2002-02-02T02:02:02.33+04:30"); - dateStr = format.format(date); - assertEquals("01.02.2002 21:32:02", dateStr); - } - - public void testParseDateTimeInvalid() { - try { - DateTimeUtils.parseDateTime("+1971-12-12T6:30:15"); - fail(); - } catch (ParseException e) { - } - - try { - DateTimeUtils.parseDateTime("2000-01-0123:59:59.999999Z"); - fail(); - } catch (ParseException e) { - } - - try { - DateTimeUtils.parseDateTime("2003-05-20T12:17:3005:00"); - fail(); - } catch (ParseException e) { - } - - try { - DateTimeUtils.parseDateTime(" 2002-02-02T02:02:02.33+04:00"); - fail(); - } catch (ParseException e) { - } - - } - - public void testBuildDateTimeGMTMinus3() { - String should = "2002-01-01T01:01:01-03:00"; - doTestBuildDateTime(2002, 1, 1, 1, 1, 1, "GMT-03:00", should); - } - public void testBuildDateTimeMEZSommerzeit() { - String should = "2002-07-31T23:59:59+02:00"; - doTestBuildDateTime(2002, 7, 31, 23, 59, 59, "GMT+01:00", should); - } - public void testBuildDateTimeGMT() { - String should = "2002-01-01T01:01:01"; - doTestBuildDateTime(2002, 1, 1, 1, 1, 1, "GMT+00:00", should); - } - private void doTestBuildDateTime( - int year, int month, int day, - int hour, int min, int sec, - String timeZone, String dateTimeShould) { - - Calendar cal = new GregorianCalendar(TimeZone.getTimeZone(timeZone)); - cal.set(year,month, day, hour, min, sec); - cal.set(Calendar.MILLISECOND, 0); - String dateTimeBuilt = DateTimeUtils.buildDateTime(cal); - assertEquals(dateTimeShould, dateTimeBuilt); - } - -} diff --git a/common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java b/common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java deleted file mode 100644 index a6d1847ce..000000000 --- a/common/src/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java +++ /dev/null @@ -1,90 +0,0 @@ -package test.at.gv.egovernment.moa.util; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.math.BigInteger; -import java.security.KeyStore; -import java.security.Security; -import java.security.cert.X509Certificate; -import java.util.Enumeration; - -import at.gv.egovernment.moa.util.KeyStoreUtils; - -import junit.framework.TestCase; - -/** - * @author Paul Ivancsics - * @version $Id$ - */ -public class KeyStoreUtilsTest extends TestCase { - private String tmpDir = "tmp/KeyStoreUtilsTest"; - private String tmpDirURL = "file:" + tmpDir; - - public KeyStoreUtilsTest(String arg0) { - super(arg0); - } - - protected void setUp() throws Exception { - Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); - new File(tmpDir).mkdirs(); - } - protected void tearDown() throws Exception { - new File(tmpDir).delete(); - } - public void testCreateKeyStoreJKS() throws Exception { - String[] certFilenames = new String[] { - "data/test/security/server-certs/baltimore.cer" - }; - KeyStore ks = KeyStoreUtils.createKeyStore("jks", certFilenames); - assertEquals(1, ks.size()); - X509Certificate cert = (X509Certificate)ks.getCertificate("0"); - assertEquals(3424, cert.getSerialNumber().intValue()); - } - public void testCreateKeyStorePKCS12() throws Exception { - String[] certFilenames = new String[] { - "data/test/security/server-certs/baltimore.cer" - }; - KeyStore ks = KeyStoreUtils.createKeyStore("pkcs12", certFilenames); - assertEquals(1, ks.size()); - X509Certificate cert = (X509Certificate)ks.getCertificate("0"); - assertEquals(3424, cert.getSerialNumber().intValue()); - } - public void testCreateKeyStoreFromCertificateDirectory() throws Exception { - // copy certificate files to a temporary directory, - // omitting the "CVS" directory in the source directory - copyCertificates("data/test/security/server-certs", tmpDir); - KeyStore ks = KeyStoreUtils.createKeyStoreFromCertificateDirectory("jks", tmpDirURL); - assertEquals(2, ks.size()); - X509Certificate cert0 = (X509Certificate)ks.getCertificate("0"); - X509Certificate cert1 = (X509Certificate)ks.getCertificate("1"); - assertTrue(3424 == cert0.getSerialNumber().intValue() || 3424 == cert1.getSerialNumber().intValue()); - } - private void copyCertificates(String from, String to) throws IOException { - String[] fromList = new File(from).list(); - for (int i = 0; i < fromList.length; i++) { - File fromFile = new File(from + File.separator + fromList[i]); - if (fromFile.isFile()) { - String toFile = to + "/" + fromList[i]; - FileInputStream in = new FileInputStream(fromFile); - FileOutputStream out = new FileOutputStream(toFile); - for (int ch = in.read(); ch >= 0; ch = in.read()) - out.write(ch); - out.close(); - in.close(); - } - } - - } - public void testLoadKeyStore() throws Exception { - String keyStoreURL = "file:data/test/security/client-certs/sicher-demo(buergerkarte).p12"; - KeyStore ks = KeyStoreUtils.loadKeyStore("pkcs12", keyStoreURL, "buergerkarte"); - assertEquals(1, ks.size()); - Enumeration aliases = ks.aliases(); - String alias = (String)aliases.nextElement(); - X509Certificate cert = (X509Certificate)ks.getCertificate(alias); - assertEquals(new BigInteger("1044289238331").intValue(), cert.getSerialNumber().intValue()); - } - -} diff --git a/common/src/test/at/gv/egovernment/moa/util/SSLUtilsTest.java b/common/src/test/at/gv/egovernment/moa/util/SSLUtilsTest.java deleted file mode 100644 index 7e55cb7d0..000000000 --- a/common/src/test/at/gv/egovernment/moa/util/SSLUtilsTest.java +++ /dev/null @@ -1,160 +0,0 @@ -package test.at.gv.egovernment.moa.util; - -import java.io.FileInputStream; -import java.io.IOException; -import java.net.URL; -import java.security.KeyStore; -import java.security.Security; - -import javax.net.ssl.SSLException; -import javax.net.ssl.SSLSocketFactory; - -import com.sun.net.ssl.HostnameVerifier; -import com.sun.net.ssl.HttpsURLConnection; - -import at.gv.egovernment.moa.util.KeyStoreUtils; -import at.gv.egovernment.moa.util.SSLUtils; - -import junit.framework.TestCase; - -/** - * @author Paul Ivancsics - * @version $Id$ - */ -public class SSLUtilsTest extends TestCase { - - public SSLUtilsTest(String arg0) { - super(arg0); - } - - - protected void setUp() throws Exception { - //System.setProperty("javax.net.debug", "all"); - Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); - System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); - System.setProperty("https.cipherSuites", "SSL_DHE_DSS_WITH_DES_CBC_SHA,SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA,SSL_RSA_WITH_DES_CBC_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_RSA_EXPORT_WITH_RC4_40_MD5"); - } - - public void testGetSSLSocketFactoryBaltimoreOK() throws Exception { - doTestGetSSLSocketFactory( - "GET", - "https://www.baltimore.com/", - false, - "file:data/test/security/cacerts+gt_cybertrust_root", - "changeit", - true); - } - public void testGetSSLSocketFactoryBaltimoreNOK() throws Exception { - doTestGetSSLSocketFactory( - "GET", - "https://www.baltimore.com/", - false, - "file:data/test/security/cacerts", - "changeit", - false); - } - public void testGetSSLSocketFactoryVerisignOK() throws Exception { - doTestGetSSLSocketFactory( - "GET", - "https://www.verisign.com/", - false, - "file:data/test/security/cacerts", - "changeit", - true); - } - public void testGetSSLSocketFactoryVerisignNoTruststoreOK() throws Exception { - doTestGetSSLSocketFactory( - "GET", - "https://www.verisign.com/", - false, - null, - null, - true); - } - public void testGetSSLSocketFactoryLocalhostOK() throws Exception { - String urlString = "https://localhost:8443/moa-id-auth/index.jsp"; - doTestGetSSLSocketFactory( - "GET", - urlString, - true, - "file:data/test/security/server.keystore.tomcat", - "changeit", - true); - } - public void testGetSSLSocketFactoryLocalhostNOK() throws Exception { - String urlString = "https://localhost:8443/moa-id-auth/index.jsp"; - doTestGetSSLSocketFactory( - "GET", - urlString, - true, - null, - null, - false); - } - - public void doTestGetSSLSocketFactory( - String requestMethod, - String urlString, - boolean useHostnameVerifierHack, - String truststoreurl, - String trustpassword, - boolean shouldOk - ) throws Exception { - - doTestGetSSLSocketFactory( - requestMethod, urlString, useHostnameVerifierHack, truststoreurl, trustpassword, null, null, null, shouldOk); - } - public void doTestGetSSLSocketFactory( - String requestMethod, - String urlString, - boolean useHostnameVerifierHack, - String truststoreurl, - String trustpassword, - String keystoretype, - String keystoreurl, - String keypassword, - boolean shouldOk - ) throws Exception { - - KeyStore truststore = null; - if (truststoreurl != null) - truststore = KeyStoreUtils.loadKeyStore("jks", truststoreurl, trustpassword); - SSLSocketFactory sf = SSLUtils.getSSLSocketFactory( - truststore, keystoretype, keystoreurl, keypassword); - System.out.println(requestMethod + " " + urlString); - - URL url = new URL(urlString); - HttpsURLConnection conn = (HttpsURLConnection)url.openConnection(); - conn.setRequestMethod(requestMethod); - conn.setDoInput(true); - conn.setDoOutput(true); - conn.setUseCaches(false); - conn.setAllowUserInteraction(false); - conn.setSSLSocketFactory(sf); - if (useHostnameVerifierHack) - conn.setHostnameVerifier(new HostnameVerifierHack()); - try { - conn.connect(); - assertTrue(shouldOk); - assertEquals(200, conn.getResponseCode()); - conn.disconnect(); - } - catch (SSLException ex) { - assertFalse(shouldOk); - } - } - private byte[] readTruststore(String filename) throws IOException { - if (filename == null) - return null; - FileInputStream in = new FileInputStream(filename); - byte[] buffer = new byte[in.available()]; - in.read(buffer); - in.close(); - return buffer; - } - private class HostnameVerifierHack implements HostnameVerifier { - public boolean verify(String arg0, String arg1) { - return true; - } - } -} diff --git a/common/src/test/at/gv/egovernment/moa/util/URLDecoderTest.java b/common/src/test/at/gv/egovernment/moa/util/URLDecoderTest.java deleted file mode 100644 index b6ea0e152..000000000 --- a/common/src/test/at/gv/egovernment/moa/util/URLDecoderTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package test.at.gv.egovernment.moa.util; - -import java.net.URLEncoder; - -import at.gv.egovernment.moa.util.FileUtils; -import at.gv.egovernment.moa.util.URLDecoder; - -import junit.framework.TestCase; - -/* - * @author Paul Ivancsics - * @version $Id$ - */ -public class URLDecoderTest extends TestCase { - - public void test() throws Exception { - String s = "immerZUA0129<>%==$$%&/()@?{()=} \\\"äöüÄÖÜ?§"; - String senc = URLEncoder.encode(s); - String sdec = URLDecoder.decode(senc, "ISO-8859-1"); - assertEquals(s, sdec); - } - public void testUTF8() throws Exception { - String s = new String(FileUtils.readFile("data/test/xml/CreateXMLSignature/CreateXMLSignatureResponse.xml")); - String senc = URLEncoder.encode(s); - String sdec = URLDecoder.decode(senc, "UTF-8"); - String sutf8 = FileUtils.readFile("data/test/xml/CreateXMLSignature/CreateXMLSignatureResponse.xml", "UTF-8"); - assertEquals(sutf8, sdec); - } -} diff --git a/common/src/test/at/gv/egovernment/moa/util/URLEncoderTest.java b/common/src/test/at/gv/egovernment/moa/util/URLEncoderTest.java deleted file mode 100644 index 43238c51f..000000000 --- a/common/src/test/at/gv/egovernment/moa/util/URLEncoderTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package test.at.gv.egovernment.moa.util; - -import at.gv.egovernment.moa.util.FileUtils; -import at.gv.egovernment.moa.util.URLDecoder; -import at.gv.egovernment.moa.util.URLEncoder; -import junit.framework.TestCase; - -/* - * @author Paul Ivancsics - * @version $Id$ - */ -public class URLEncoderTest extends TestCase { - - public void testUnchangedString() throws Exception { - String s = "AZaz0123456789.-*_"; - String senc = URLEncoder.encode(s, "UTF-8"); - assertEquals(s, senc); - } - public void testAumlUTF8() throws Exception { - String s = "ä"; - String senc = URLEncoder.encode(s, "UTF-8"); - assertEquals("%C3%A4", senc); - } - public void testEncodeDecode() throws Exception { - String s = "AZaz09.-*_ <>%=$%&/()@?{}[]\\\"'äöüÄÖÜߧ"; - String senc = URLEncoder.encode(s, "UTF-8"); - String sdec = URLDecoder.decode(senc, "UTF-8"); - assertEquals(s, sdec); - } - public void testCertInfo() throws Exception { - String s = new String(FileUtils.readFile("data/test/xml/VerifyXMLSignature/CertInfoVerifyXMLSignatureRequest.xml", "UTF-8")); - String senc = URLEncoder.encode(s, "UTF-8"); - String sdec = URLDecoder.decode(senc, "UTF-8"); - assertEquals(s, sdec); - } - /*public void testJDK14() throws Exception { - String s = new String(FileUtils.readFile("data/test/xml/VerifyXMLSignature/CertInfoVerifyXMLSignatureRequest.xml", "UTF-8")); - String senc = URLEncoder.encode(s, "UTF-8"); - String senc14 = java.net.URLEncoder.encode(s, "UTF-8"); - assertEquals(senc, senc14); - }*/ - -} diff --git a/common/src/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java b/common/src/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java deleted file mode 100644 index 7986fe540..000000000 --- a/common/src/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java +++ /dev/null @@ -1,99 +0,0 @@ -package test.at.gv.egovernment.moa.util; -import java.io.FileInputStream; -import java.io.InputStream; - -import org.apache.xerces.parsers.DOMParser; -import org.apache.xerces.parsers.XMLGrammarPreparser; -import org.apache.xerces.util.SymbolTable; -import org.apache.xerces.util.XMLGrammarPoolImpl; -import org.apache.xerces.xni.grammars.Grammar; -import org.apache.xerces.xni.grammars.XMLGrammarDescription; -import org.apache.xerces.xni.parser.XMLInputSource; -import org.xml.sax.InputSource; - -import test.at.gv.egovernment.moa.MOATestCase; - -import at.gv.egovernment.moa.util.Constants; - - -/** - * Experimentation with Xerces grammar caching. - * - * Used the Xerces sample 'XMLGrammarBuilder' as a starting point. - * - * @author Patrick Peck - * @version $Id$ - */ -public class XMLGrammarBuilderTest extends MOATestCase { - - private static final String GRAMMAR_POOL = - org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX - + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; - - protected static final String NAMESPACES_FEATURE_ID = - "http://xml.org/sax/features/namespaces"; - protected static final String VALIDATION_FEATURE_ID = - "http://xml.org/sax/features/validation"; - protected static final String SCHEMA_VALIDATION_FEATURE_ID = - "http://apache.org/xml/features/validation/schema"; - protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID = - "http://apache.org/xml/features/validation/schema-full-checking"; - - private static final int BIG_PRIME = 2039; - private SymbolTable symbolTable; - private XMLGrammarPoolImpl grammarPool; - - /** - * Constructor for XMLGrammarBuilderTest. - * @param name - */ - public XMLGrammarBuilderTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - XMLGrammarPreparser preparser; - - // set up symbol table and grammar pool - symbolTable = new SymbolTable(BIG_PRIME); - grammarPool = new XMLGrammarPoolImpl(); - preparser = new XMLGrammarPreparser(symbolTable); - preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); - preparser.setProperty(GRAMMAR_POOL, grammarPool); - preparser.setFeature(NAMESPACES_FEATURE_ID, true); - preparser.setFeature(VALIDATION_FEATURE_ID, true); - // now we can still do schema features just in case, - // so long as it's our configuraiton...... - preparser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); - preparseSchemaResource( - preparser, - Constants.DSIG_SCHEMA_LOCATION, - "/resources/schemas/xmldsig-core-schema.xsd"); - } - - private static Grammar preparseSchemaResource( - XMLGrammarPreparser preparser, - String systemId, - String resource) - throws Exception { - - InputStream is = XMLGrammarBuilderTest.class.getResourceAsStream(resource); - return preparser.preparseGrammar( - XMLGrammarDescription.XML_SCHEMA, - new XMLInputSource(null, systemId, null, is, null)); - } - - public void testParseValidating() throws Exception { - DOMParser parser = new DOMParser(symbolTable, grammarPool); - - parser.setFeature(NAMESPACES_FEATURE_ID, true); - parser.setFeature(VALIDATION_FEATURE_ID, true); - parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); - - parser.parse( - new InputSource( - new FileInputStream(TESTDATA_ROOT + "xml/dsigTransform/base64.xml"))); - parser.getDocument(); - } - -} diff --git a/common/src/test/at/gv/egovernment/moa/util/XPathUtilsTest.java b/common/src/test/at/gv/egovernment/moa/util/XPathUtilsTest.java deleted file mode 100644 index 559494300..000000000 --- a/common/src/test/at/gv/egovernment/moa/util/XPathUtilsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package test.at.gv.egovernment.moa.util; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; - -import test.at.gv.egovernment.moa.MOATestCase; - -import at.gv.egovernment.moa.util.XPathUtils; - - -/** - * @author Patrick Peck - * @version $Id$ - */ -public class XPathUtilsTest extends MOATestCase { - - private Document doc1; - - /** - * Constructor for XPathUtilsTest. - * @param name - */ - public XPathUtilsTest(String name) { - super(name); - } - - /** - * @see TestCase#setUp() - */ - protected void setUp() throws Exception { - super.setUp(); - doc1 = - parseXml(TESTDATA_ROOT + "xml/VerifyXMLSignature/Req000.xml"); - } - - public void testSelectNodeList() throws Exception { - NodeList nodes; - - nodes = - XPathUtils.selectNodeList( - doc1.getDocumentElement(), - doc1.getDocumentElement(), - "/VerifyXMLSignatureRequest"); - assertEquals(1, nodes.getLength()); - nodes = - XPathUtils.selectNodeList( - doc1.getDocumentElement(), - "//dsig:Signature"); - assertEquals(1, nodes.getLength()); - } - -} -- cgit v1.2.3 From 97f071cfd2e51b1060946f503d06e03e8bdc5a8e Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 8 Aug 2007 07:46:13 +0000 Subject: More modifications to suite the new maven based build process. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@910 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../properties/common_messages_de.properties | 16 + .../src/resources/resources/schemas/Core-1.2.xsd | 881 ++++++++++++++ .../resources/resources/schemas/Core.20020225.xsd | 399 +++++++ .../resources/resources/schemas/Core.20020831.xsd | 153 +++ .../resources/schemas/ECDSAKeyValue.ancient.xsd | 122 ++ .../resources/schemas/ECDSAKeyValue.wrong.xsd | 122 ++ .../resources/resources/schemas/ECDSAKeyValue.xsd | 122 ++ .../resources/schemas/MOA-ID-Configuration-1.2.xsd | 350 ++++++ .../resources/schemas/MOA-ID-Configuration-1.3.xsd | 424 +++++++ .../resources/schemas/MOA-ID-Configuration-1.4.xsd | 505 ++++++++ .../resources/resources/schemas/MOA-SPSS-1.3.xsd | 469 ++++++++ .../resources/schemas/MOA-SPSS-config-1.3.xsd | 253 ++++ .../resources/resources/schemas/MOAIdentities.xsd | 51 + .../src/resources/resources/schemas/PersonData.xsd | 426 +++++++ .../resources/schemas/PersonData_20_en_moaWID.xsd | 1229 ++++++++++++++++++++ .../resources/resources/schemas/PersonName-1_2.xsd | 115 ++ .../resources/schemas/PostalAddress-1_2.xsd | 95 ++ .../resources/schemas/TelcomNumber-1_0.xsd | 89 ++ .../resources/schemas/XMLSchema-instance.xsd | 37 + .../src/resources/resources/schemas/XMLSchema.dtd | 402 +++++++ .../schemas/cs-sstc-schema-assertion-01.xsd | 194 +++ .../schemas/cs-sstc-schema-protocol-01.xsd | 127 ++ .../src/resources/resources/schemas/datatypes.dtd | 203 ++++ .../schemas/exclusive-canonicalization.xsd | 22 + common/src/resources/resources/schemas/xml.xsd | 83 ++ .../resources/schemas/xmldsig-core-schema.xsd | 264 +++++ .../resources/schemas/xmldsig-filter2.xsd | 38 + 27 files changed, 7191 insertions(+) create mode 100644 common/src/resources/resources/properties/common_messages_de.properties create mode 100644 common/src/resources/resources/schemas/Core-1.2.xsd create mode 100644 common/src/resources/resources/schemas/Core.20020225.xsd create mode 100644 common/src/resources/resources/schemas/Core.20020831.xsd create mode 100644 common/src/resources/resources/schemas/ECDSAKeyValue.ancient.xsd create mode 100644 common/src/resources/resources/schemas/ECDSAKeyValue.wrong.xsd create mode 100644 common/src/resources/resources/schemas/ECDSAKeyValue.xsd create mode 100644 common/src/resources/resources/schemas/MOA-ID-Configuration-1.2.xsd create mode 100644 common/src/resources/resources/schemas/MOA-ID-Configuration-1.3.xsd create mode 100644 common/src/resources/resources/schemas/MOA-ID-Configuration-1.4.xsd create mode 100644 common/src/resources/resources/schemas/MOA-SPSS-1.3.xsd create mode 100644 common/src/resources/resources/schemas/MOA-SPSS-config-1.3.xsd create mode 100644 common/src/resources/resources/schemas/MOAIdentities.xsd create mode 100644 common/src/resources/resources/schemas/PersonData.xsd create mode 100644 common/src/resources/resources/schemas/PersonData_20_en_moaWID.xsd create mode 100644 common/src/resources/resources/schemas/PersonName-1_2.xsd create mode 100644 common/src/resources/resources/schemas/PostalAddress-1_2.xsd create mode 100644 common/src/resources/resources/schemas/TelcomNumber-1_0.xsd create mode 100644 common/src/resources/resources/schemas/XMLSchema-instance.xsd create mode 100644 common/src/resources/resources/schemas/XMLSchema.dtd create mode 100644 common/src/resources/resources/schemas/cs-sstc-schema-assertion-01.xsd create mode 100644 common/src/resources/resources/schemas/cs-sstc-schema-protocol-01.xsd create mode 100644 common/src/resources/resources/schemas/datatypes.dtd create mode 100644 common/src/resources/resources/schemas/exclusive-canonicalization.xsd create mode 100644 common/src/resources/resources/schemas/xml.xsd create mode 100644 common/src/resources/resources/schemas/xmldsig-core-schema.xsd create mode 100644 common/src/resources/resources/schemas/xmldsig-filter2.xsd (limited to 'common/src') diff --git a/common/src/resources/resources/properties/common_messages_de.properties b/common/src/resources/resources/properties/common_messages_de.properties new file mode 100644 index 000000000..ac05b7996 --- /dev/null +++ b/common/src/resources/resources/properties/common_messages_de.properties @@ -0,0 +1,16 @@ +# This file contains exception messages in the standard Java properties +# format. The messages may contain formatting patterns as definied in the +# java.text.MessageFormat class. + + +# +# Messages private to the MOA common subsystem +# + +parser.00=Leichter Fehler beim Parsen: {0}, SystemID={1}, Zeile={2}, Spalte={3} +parser.01=Fehler beim Parsen: {0}, SystemID={1}, Zeile={2}, Spalte={3} +parser.02=Schwerer Fehler beim Parsen: {0}, SystemID={1}, Zeile={2}, Spalte={3} + +xpath.00=Fehler beim Auswerten des XPath-Ausdruckes: {0} + +datetime.00=Fehler beim Parsen der DateTime \ No newline at end of file diff --git a/common/src/resources/resources/schemas/Core-1.2.xsd b/common/src/resources/resources/schemas/Core-1.2.xsd new file mode 100644 index 000000000..864fee6d5 --- /dev/null +++ b/common/src/resources/resources/schemas/Core-1.2.xsd @@ -0,0 +1,881 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/Core.20020225.xsd b/common/src/resources/resources/schemas/Core.20020225.xsd new file mode 100644 index 000000000..5dd2836a0 --- /dev/null +++ b/common/src/resources/resources/schemas/Core.20020225.xsd @@ -0,0 +1,399 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/Core.20020831.xsd b/common/src/resources/resources/schemas/Core.20020831.xsd new file mode 100644 index 000000000..6ec40be63 --- /dev/null +++ b/common/src/resources/resources/schemas/Core.20020831.xsd @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/ECDSAKeyValue.ancient.xsd b/common/src/resources/resources/schemas/ECDSAKeyValue.ancient.xsd new file mode 100644 index 000000000..833d327f2 --- /dev/null +++ b/common/src/resources/resources/schemas/ECDSAKeyValue.ancient.xsd @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/ECDSAKeyValue.wrong.xsd b/common/src/resources/resources/schemas/ECDSAKeyValue.wrong.xsd new file mode 100644 index 000000000..db83c9df5 --- /dev/null +++ b/common/src/resources/resources/schemas/ECDSAKeyValue.wrong.xsd @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/ECDSAKeyValue.xsd b/common/src/resources/resources/schemas/ECDSAKeyValue.xsd new file mode 100644 index 000000000..7a01b23d1 --- /dev/null +++ b/common/src/resources/resources/schemas/ECDSAKeyValue.xsd @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/MOA-ID-Configuration-1.2.xsd b/common/src/resources/resources/schemas/MOA-ID-Configuration-1.2.xsd new file mode 100644 index 000000000..4b018db64 --- /dev/null +++ b/common/src/resources/resources/schemas/MOA-ID-Configuration-1.2.xsd @@ -0,0 +1,350 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der + Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der + Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. + Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der + Proxy-Komponente zur Auth-Komponente (vgl. + AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die + Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann + für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA + (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem + Security-Layer + + + + + + das Attribut filename verweist auf eine Datei mit globalem + Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo + werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks + inkludiert + + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA + SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der + AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; + wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; + wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben + werden; wird das Element nicht verwendet dann wird MOA-SP über das API + aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der + Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des + AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des + IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per + X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + + + + + + enthält Parameter über die OA, die die + Authentisierungs-Komponente betreffen + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der + TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für + die TLS-Client-Authentisierung verwendetwird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/MOA-ID-Configuration-1.3.xsd b/common/src/resources/resources/schemas/MOA-ID-Configuration-1.3.xsd new file mode 100644 index 000000000..66c6e1832 --- /dev/null +++ b/common/src/resources/resources/schemas/MOA-ID-Configuration-1.3.xsd @@ -0,0 +1,424 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der + Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der + Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. + Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der + Proxy-Komponente zur Auth-Komponente (vgl. + AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die + Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann + für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA + (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem + Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA + SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der + AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; + wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; + wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben + werden; wird das Element nicht verwendet dann wird MOA-SP über das API + aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der + Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des + AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des + IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per + X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + + + das Attribut filename verweist auf eine Datei mit globalem + Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo + werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks + inkludiert + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + + + + enthält Parameter über die OA, die die + Authentisierungs-Komponente betreffen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der + TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für + die TLS-Client-Authentisierung verwendetwird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/MOA-ID-Configuration-1.4.xsd b/common/src/resources/resources/schemas/MOA-ID-Configuration-1.4.xsd new file mode 100644 index 000000000..66a9c0ed4 --- /dev/null +++ b/common/src/resources/resources/schemas/MOA-ID-Configuration-1.4.xsd @@ -0,0 +1,505 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der + Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der + Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. + Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der + Proxy-Komponente zur Auth-Komponente (vgl. + AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die + Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann + für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA + (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem + Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA + SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der + AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; + wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; + wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben + werden; wird das Element nicht verwendet dann wird MOA-SP über das API + aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der + Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des + AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des + IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per + X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen + + + + + + + das Attribut filename verweist auf eine Datei mit globalem + Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo + werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks + inkludiert + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + Verifikation zusätzlicher Infoboxen + + + + + Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen + + + + + + + + + + Parameter für Ãœberprüfung weiterer Infoboxen + + + + + + optionalervName, der für Fehlermeldungen verwendet werden soll; + z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird + das Identifier-Attribut verwendet + + + + + TrustProfil, das für die Ãœberprüfung der Infobox + verwendet werden soll + + + + + Validatorklasse, die für die Prüfung der Infobox + verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname + vom Default Package- und Klassennamen abweichen + + + + + + Infobox spezifische Parameter, die der jeweiligen Prüfapplikation + übergeben werden + + + + + + + + + + + + + + + + + + + Spezifiziert die Lage von XML Schemas + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die + Authentisierungs-Komponente betreffen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der + TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für + die TLS-Client-Authentisierung verwendetwird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/MOA-SPSS-1.3.xsd b/common/src/resources/resources/schemas/MOA-SPSS-1.3.xsd new file mode 100644 index 000000000..756b51279 --- /dev/null +++ b/common/src/resources/resources/schemas/MOA-SPSS-1.3.xsd @@ -0,0 +1,469 @@ + + + + + + + + + + + + + + + + + + + + Ermöglichung der Stapelsignatur durch wiederholte Angabe dieses Elements + + + + + + + + + + + + + + + + + + + Auswahl: Entweder explizite Angabe des Signaturorts sowie ggf. sinnvoller Supplements im Zshg. mit der Signaturumgebung, oder Verweis auf ein benanntes Profil + + + + + + + + + + + + + + + + + + Kardinalität 1..oo erlaubt die Antwort auf eine Stapelsignatur-Anfrage + + + + Resultat, falls die Signaturerstellung erfolgreich war + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert + + + + + + + + + + + only ds:X509Data and RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any;publicAuthority is included as X509Data/any + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pro dsig:Reference-Element in der zu überprüfenden XML-Signatur muss hier ein ReferenceInfo-Element erscheinen. Die Reihenfolge der einzelnen ReferenceInfo Elemente entspricht jener der dsig:Reference Elemente in der XML-Signatur. + + + + + + + + + + mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert + + + + + + + + + + + only ds:X509Data and ds:RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any; PublicAuthority is included as X509Data/any + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Auswahl: Entweder explizite Angabe EINER Transformationskette inklusive ggf. sinnvoller Supplements oder Verweis auf ein benanntes Profil + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Resultat, falls die Signaturerstellung gescheitert ist + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ein oder mehrere Transformationswege können von der Applikation an MOA mitgeteilt werden. Die zu prüfende Signatur hat zumindest einem dieser Transformationswege zu entsprechen. Die Angabe kann explizit oder als Profilbezeichner erfolgen. + + + + + Profilbezeichner für einen Transformationsweg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Die Angabe des Transformationsparameters (explizit oder als Hashwert) kann unterlassen werden, wenn die Applikation von der Unveränderlichkeit des Inhalts der in "Transformationsparamter", Attribut "URI" angegebenen URI ausgehen kann. + + + + Der Transformationsparameter explizit angegeben. + + + + + Der Hashwert des Transformationsparameters. + + + + + + + + + + + + + + + + + + + + + + Explizite Angabe des Transformationswegs + + + + + + + Alle impliziten Transformationsparameter, die zum Durchlaufen der oben angeführten Transformationskette bekannt sein müssen, müssen hier angeführt werden. Das Attribut "URI" bezeichnet den Transformationsparameter in exakt jener Weise, wie er in der zu überprüfenden Signatur gebraucht wird. + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/MOA-SPSS-config-1.3.xsd b/common/src/resources/resources/schemas/MOA-SPSS-config-1.3.xsd new file mode 100644 index 000000000..8ab3d62aa --- /dev/null +++ b/common/src/resources/resources/schemas/MOA-SPSS-config-1.3.xsd @@ -0,0 +1,253 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/MOAIdentities.xsd b/common/src/resources/resources/schemas/MOAIdentities.xsd new file mode 100644 index 000000000..de9d9d4e4 --- /dev/null +++ b/common/src/resources/resources/schemas/MOAIdentities.xsd @@ -0,0 +1,51 @@ + + + + + + MOAIdentities provides a mapping from identities to parameters used in the XMLLoginParameterResolver of MOA-ID + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/PersonData.xsd b/common/src/resources/resources/schemas/PersonData.xsd new file mode 100644 index 000000000..0e3bc6b3b --- /dev/null +++ b/common/src/resources/resources/schemas/PersonData.xsd @@ -0,0 +1,426 @@ + + + + + + + + + + + + + unique identifier + + + + + actual value of the identifier. + + + + + + + + + + + + type of value (eg 'ZMR', 'SV-Nummer', 'Martrikelnummer', database identification, ...) + + + + + authority, which is reponsible for generation of the identifier (eg university in case of 'MatrikelNummer') + + + + + any additional properties + + + + + + + + + + element of person type + + + + + main structure of person data + + + + + unique identification entities + + + + + + + + + + element of physical person type + + + + + physical person + + + + + + + data related to the person's name + + + + + Former name, Artist name, changes of Given name ... + + + + + + + + + + + + status of a person in the cycle of life + + + + + gender + + + + + date of birth + + + + + place of birth + + + + + country of birth + + + + + nationality of Person (Staatsbürgerschaft) + + + + + confession (religion) of Person + + + + + relatives (parents, ...) + + + + + + type of the relationship + + + + + + + + + any additional properties + + + + + + + + + element of corporate body type + + + + + juridical person, organisation + + + + + + + category (eg organisation, function, sector, ...) + + + + + name of corporate body (whole name) + + + + + alternative names of corporate body (abbreviations, short name, synonyms, ...) + + + + + type of company (eg AG, OHG, ...) + + + + + part of an organisation, see also X.500 ou (eg departement, section, branch, ...) + + + + + any additional properties + + + + + + + + + + element of signed person datastructure type + + + + + signed person datastructure. The first Identification elements (from the base type) denote the record as such (e.g. database key for this record) - not to be mistaken for identifiers of the person or of an address (they have their own Identification elements). + + + + + + + + + one or more electronic signatures applied on fields above + + + + + + + + any additional properties + + + + + + + + + + + + + simple type for sex (gender) of person + + + + + + + + + + simple type for dates (union), which may omit day and/or month + + + + + + simple type for marital status of a person + + + + + + + + + + + pattern type for enlargement of type definitions + + + + + + + + known relations (family + functional) + + + + + + + + + + + + + + + + known + any other relation + + + + + + known types of alternative names + + + + + + + + + + + + known + any other alternative name types + + + + + + + element of address type + + + + + main structure of address data + + + + + unique identification entities + + + + + + + + + element of postal address type + + + + + postal address + + + + + + + type of address - category (eg 'Wohnsitz', 'Zentrale', ...) + + + + + + any additional properties + + + + + + + + + element of telephone address type + + + + + phone numbers + + + + + + + type of phononumber - category (eg 'Festnetz', 'Mobile', 'fax', ...) + + + + + phonenumber + + + + + any additional properties + + + + + + + + + element of internet address type + + + + + internet based communication + + + + + + + certificate for secure communication + + + + + email-Address, Web, FTP, LDAP, ... + + + + + any additional properties + + + + + + + diff --git a/common/src/resources/resources/schemas/PersonData_20_en_moaWID.xsd b/common/src/resources/resources/schemas/PersonData_20_en_moaWID.xsd new file mode 100644 index 000000000..cf8f796db --- /dev/null +++ b/common/src/resources/resources/schemas/PersonData_20_en_moaWID.xsd @@ -0,0 +1,1229 @@ + + + + + + + + + This version of person deploys only global elements. All types derived from abstract types have been replaced by substitution groups + + + + + dummy abstract Peson Data element needed for bi-lingual schema (substitution groups) + + + + + element of signed person datastructure type + + + + + element of signed person datastructure type + + + + + + + + + + + + + + + + + + + element of person type, essential abstract, subsitute PhysicalPerson or CorporateBody instead or use with xsi:type="..." + + + + + + element of physical person type, dreived from Person (abstract) + + + + + element of physical person type, dreived from Person (abstract) + + + + + element of corporate body type, derived from Person + + + + + element of corporate body type, derived from Person + + + + + + data related to the person's name + + + + + data related to the person's name + + + + + Former name, Artist name, changes of Given name ..., compare AlternativName + + + + + + + + + + + + relatives (parents, ...), compare Verwandter + + + + + + type of the relationship, compare Verwandschftsgrad + + + + + + + + + + element of address type, essentially abstract. Use InternetAddress, TelephoneAddress, PostalAddress, TypedPostalAddress instead, or use Address with xsi:type Attribute + + + + + Postal or ZMR Address, compare PostAdresse + + + + + Postal or ZMR Address, compare PostAdresse + + + + + Typed Postal or ZMR Address, compare TypisiertePostAdresse + + + + + InternetAdress such as e-mail or website, compare InternetAdresse + + + + + Typed TelephoneAddress, compare TelefonAdresse + + + + + National or international bank connection, compare Bankverbindung + + + + + + possibility to include common austrian primary keys in human readable way, english translation not available + + + + + + + + + + + + + + + + + + + + + + + + Ergänzungsregister für nicht-natürliche Personen (CorporateBody) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + teletyper or telephone for the hearing impaired + + + + + + status of a person in the cycle of life, compare Familienstand + + + + + gender, comapre Geschlecht + + + + + date of birth, compare Geburtsdatum + + + + + date of death, compare Sterbedatum + + + + + place of birth, compare Geburtsort + + + + + country of birth, compare Geburtsland + + + + + state of birth, comapre Geburtsbundesland + + + + + nationality of Person, compare Staatsangehoerigkeit. attention! New Fomrat is complex, string value accepted for compatibility only + + + + + confession (religion) of Person - xs:token? gibt es wirklich keine Staaten mit Leerzeichen im Namen? + + + + + occupation, compare Beruf + + + + + + compare InternationalerLaendercode + + + + + compare NationalNummer + + + + + compare Vorwahl + + + + + compare Anschlussnummer + + + + + Complete number, ready formated - e.g. +43 1 5131345 4664 compare FormatierteNummer + + + + + compare Klappe + + + + + unique identifier + + + + + + signed person datastructure. The first Identification elements (from the base type) denote the record as such (e.g. database key for this record) - not to be mistaken for identifiers of the person or of an address (they have their own Identification elements). + + + + + + + + + one or more electronic signatures applied on fields above + + + + + container for your Information needs. Contained Elements must reside in a different Namespace + + + + + + any additional properties + + + + + + + + + + + + signed person datastructure. The first Identification elements (from the base type) denote the record as such (e.g. database key for this record) - not to be mistaken for identifiers of the person or of an address (they have their own Identification elements). + + + + + + + + + one or more electronic signatures applied on fields above + + + + + container for your Information needs. Contained Elements must reside in a different Namespace + + + + + + any additional properties + + + + + + + + + + + + + + + + + unique identifier + + + + + actual value of the identifier. + + + + + + + + + + + + type of value (eg 'ZMR', 'SV-Nummer', 'Martrikelnummer', database identification, ...) + + + + + authority, which is reponsible for generation of the identifier (eg university in case of 'MatrikelNummer') + + + + + any additional properties + + + + + + + + + main structure of person data + + + + + unique identification entities + + + + + + + + + + physical person, compare NatuerlichePersonTyp + + + + + + + + + + + + + + + + + + + + + any additional properties + + + + + + + + + physical person, compare NatuerlichePersonTyp + + + + + + + + + + + + + any additional properties + + + + + + + + + juridical person, organisation, compare NichtNatuerlichePersonTyp + + + + + + + URI pointing to a predefined Class of CorporateBodies, compare Typ + + + + + name of corporate body (whole name), compare VollerName + + + + + alternative names of corporate body (abbreviations, short name, synonyms, ...), comapre AlternativName + + + + + type of company (eg AG, OHG, ...), URI pointing to predefined LegalForm, compare Rechtsform + + + + + part of an organisation, see also X.500 ou (eg departement, section, branch, ...) , compare Organisation + + + + + + any additional properties + + + + + + + + + juridical person, organisation, compare NichtNatuerlichePersonTyp + + + + + + + URI pointing to a predefined Class of CorporateBodies, compare Typ + + + + + name of corporate body (whole name), compare VollerName + + + + + type of company (eg AG, OHG, ...), URI pointing to predefined LegalForm, compare Rechtsform + + + + + part of an organisation, see also X.500 ou (eg departement, section, branch, ...) , compare Organisation + + + + + any additional properties + + + + + + + + + container for parts of a name, comapre PersonenNameTyp + + + + + Complete Name (including Affixes) of the Person, especially useful for names from different cultural environments + + + + + + + + + + + + + + + + + + + + + Every given name should be contained inside a GivenName Tag. If that is not possible due to dabase contraints, ... putting several given names inside one GivenName Element is acceptable + + + + + A Person in possesion of more than one GivenName frequently preferrs the use of a Name other than the first GivenName + + + + + MiddleNames are not commonly found in central Europe. The field is mainly for compatibility reasons + + + + + Every family name should be contained inside a FamilyName Tag. If that is not possible due to dabase contraints, ... putting several family names inside one FamilyName Element is acceptable + + + + + + + + + + + + + + + + + + + + + Inlcudes all Information that is not exactly a name: academic or aristocratic titles, ... the new position attribute can contain a suffx or prefix value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + container for parts of a name, comapre PersonenNameTyp + + + + + Every given name should be contained inside a GivenName Tag. If that is not possible due to dabase contraints, ... putting several given names inside one GivenName Element is acceptable + + + + + Every family name should be contained inside a FamilyName Tag. If that is not possible due to dabase contraints, ... putting several family names inside one FamilyName Element is acceptable + + + + + + + + + + + + + + + + + + + + + Inlcudes all Information that is not exactly a name: academic or aristocratic titles, ... the new position attribute can contain a suffx or prefix value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + comapre, StaatsangehoerigkeitTyp + + + + + + + + + + + + + + + + + + compare BankverbindungTyp + + + + + Account holder, compare Inhaber + + + + + compare BankName + + + + + + compare NationaleBankverbindung + + + + + + compare Kontonummer + + + + + compare BLZ + + + + + + + + compare InternationaleBankverbindung + + + + + + compare IBAN + + + + + comapre BIC + + + + + + + + + + + main structure of address data + + + + + unique identification entities + + + + + + + + + postal address with type information, compare TypisiertePostAdresseTyp + + + + + + + type of address - category (eg 'Wohnsitz', 'Zentrale', ...) + + + + + + any additional properties + + + + + + + + + compare PostAdresseTyp + + + + + + + Code for the country, use ISO or internatinal Postalstandard, compare Staatscode + + + + + + + + + + Name of the country, use ISO Name, or international Postal Standard, compare Staatsname + + + + + ZIP, compare Postleitzahl + + + + + compare Region + + + + + compare Bundesland + + + + + compare Gemeinde + + + + + compare Gemeindekennzahl + + + + + ZMR use, compare Ortschaft + + + + + ZMR use, comapre OrtschaftZweisprachig + + + + + + + + + + + + + + zmr use only + + + + + zmr use only + + + + + + Addressregister database keys used to identify Addresses + + + + + + + + + + + + + + + If Addressis used outside of PersonData a recipient can be specified + + + + + + + + rather OrganizationUnit e.G Sales Departement + + + + + e.g. Smith Ltd + + + + + + + + + + + + + + + + + + + + + + compare PostAdresseTyp + + + + + + + Code for the country, use ISO or internatinal Postalstandard, compare Staatscode + + + + + + + + + + Name of the country, use ISO Name, or international Postal Standard, compare Staatsname + + + + + ZIP, compare Postleitzahl + + + + + compare Gemeinde + + + + + + + + if streetname not available use name of Ortschaft + + + + + + + + + + + + + + + + + + + + + + + + + e.g. e-mail, webiste, compare InternetAdresseTyp + + + + + + + certificate for secure communication + + + + + URI: email-Address, Web, FTP, LDAP, ..., comapre Adress + + + + + any additional properties + + + + + + + + + phone numbers, conmpare TelephoneAdresseTyp + + + + + + + type of phononumber - category (eg 'Festnetz', 'Mobile', 'fax', ...) + + + + + phonenumber + + + + + any additional properties + + + + + + + + + like TelephoneAddresseType but with additional smsEnabled attribute + + + + + + + + + + formated number or set of telephone number parts + + + + + + + + + set of telephone number parts + + + + + + + + + + + + + simple type for sex (gender) of person + + + + + + + + + + simple type for dates (union), which may omit day and/or month + + + + + + simple type for dates (union), which may omit day and/or month + + + + + + simple type for marital status of a person + + + + + + + + + + + pattern type for enlargement of type definitions. Contents as follows +x:sometext or 12345 or _ or other symbols + + + + + + + + + known relations (family + functional) + + + + + + + + + + + + + + + + known + any other relation + + + + + + known types of alternative names + + + + + + + + + + + + known + any other alternative name types + + + + + + + zmr use only + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/PersonName-1_2.xsd b/common/src/resources/resources/schemas/PersonName-1_2.xsd new file mode 100644 index 000000000..347ed3d7f --- /dev/null +++ b/common/src/resources/resources/schemas/PersonName-1_2.xsd @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/PostalAddress-1_2.xsd b/common/src/resources/resources/schemas/PostalAddress-1_2.xsd new file mode 100644 index 000000000..b3d89abbb --- /dev/null +++ b/common/src/resources/resources/schemas/PostalAddress-1_2.xsd @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/TelcomNumber-1_0.xsd b/common/src/resources/resources/schemas/TelcomNumber-1_0.xsd new file mode 100644 index 000000000..f89702aeb --- /dev/null +++ b/common/src/resources/resources/schemas/TelcomNumber-1_0.xsd @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/XMLSchema-instance.xsd b/common/src/resources/resources/schemas/XMLSchema-instance.xsd new file mode 100644 index 000000000..f47577b8a --- /dev/null +++ b/common/src/resources/resources/schemas/XMLSchema-instance.xsd @@ -0,0 +1,37 @@ + + + + + + + +]> + + + +

          XML Schema instance namespace

          +

          See the XML Schema + Recommendation for an introduction

          + + +
          + $Date: 2001/03/16 20:25:57 $
          + $Id: XMLSchema-instance.xsd,v 1.4 2001/03/16 20:25:57 ht Exp $ + + + +

          This schema should never be used as such: + the XML + Schema Recommendation forbids the declaration of + attributes in this namespace

          +
          +
          + + + + + + diff --git a/common/src/resources/resources/schemas/XMLSchema.dtd b/common/src/resources/resources/schemas/XMLSchema.dtd new file mode 100644 index 000000000..e8e8f7625 --- /dev/null +++ b/common/src/resources/resources/schemas/XMLSchema.dtd @@ -0,0 +1,402 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%xs-datatypes; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/cs-sstc-schema-assertion-01.xsd b/common/src/resources/resources/schemas/cs-sstc-schema-assertion-01.xsd new file mode 100644 index 000000000..8bc5af147 --- /dev/null +++ b/common/src/resources/resources/schemas/cs-sstc-schema-assertion-01.xsd @@ -0,0 +1,194 @@ + + + + + + + Document identifier: cs-sstc-schema-assertion-01 + Location: http://www.oasis-open.org/committees/security/docs/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/cs-sstc-schema-protocol-01.xsd b/common/src/resources/resources/schemas/cs-sstc-schema-protocol-01.xsd new file mode 100644 index 000000000..ecad05b0f --- /dev/null +++ b/common/src/resources/resources/schemas/cs-sstc-schema-protocol-01.xsd @@ -0,0 +1,127 @@ + + + + + + + + Document identifier: cs-sstc-schema-protocol-01 + Location: http://www.oasis-open.org/committees/security/docs/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/datatypes.dtd b/common/src/resources/resources/schemas/datatypes.dtd new file mode 100644 index 000000000..8e48553be --- /dev/null +++ b/common/src/resources/resources/schemas/datatypes.dtd @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/exclusive-canonicalization.xsd b/common/src/resources/resources/schemas/exclusive-canonicalization.xsd new file mode 100644 index 000000000..d4a2d82ec --- /dev/null +++ b/common/src/resources/resources/schemas/exclusive-canonicalization.xsd @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file diff --git a/common/src/resources/resources/schemas/xml.xsd b/common/src/resources/resources/schemas/xml.xsd new file mode 100644 index 000000000..79dbc02ba --- /dev/null +++ b/common/src/resources/resources/schemas/xml.xsd @@ -0,0 +1,83 @@ + + + + + + + See http://www.w3.org/XML/1998/namespace.html and + http://www.w3.org/TR/REC-xml for information about this namespace. + + + + + This schema defines attributes and an attribute group + suitable for use by + schemas wishing to allow xml:base, xml:lang or xml:space attributes + on elements they define. + + To enable this, such a schema must import this schema + for the XML namespace, e.g. as follows: + <schema . . .> + . . . + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2001/03/xml.xsd"/> + + Subsequently, qualified reference to any of the attributes + or the group defined below will have the desired effect, e.g. + + <type . . .> + . . . + <attributeGroup ref="xml:specialAttrs"/> + + will define a type which will schema-validate an instance + element with any of those attributes + + + + In keeping with the XML Schema WG's standard versioning + policy, this schema document will persist at + http://www.w3.org/2001/03/xml.xsd. + At the date of issue it can also be found at + http://www.w3.org/2001/xml.xsd. + The schema document at that URI may however change in the future, + in order to remain compatible with the latest version of XML Schema + itself. In other words, if the XML Schema namespace changes, the version + of this document at + http://www.w3.org/2001/xml.xsd will change + accordingly; the version at + http://www.w3.org/2001/03/xml.xsd will not change. + + + + + + In due course, we should install the relevant ISO 2- and 3-letter + codes as the enumerated possible values . . . + + + + + + + + + + + + + + + See http://www.w3.org/TR/xmlbase/ for + information about this attribute. + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/xmldsig-core-schema.xsd b/common/src/resources/resources/schemas/xmldsig-core-schema.xsd new file mode 100644 index 000000000..a7e302373 --- /dev/null +++ b/common/src/resources/resources/schemas/xmldsig-core-schema.xsd @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/resources/resources/schemas/xmldsig-filter2.xsd b/common/src/resources/resources/schemas/xmldsig-filter2.xsd new file mode 100644 index 000000000..330eafd19 --- /dev/null +++ b/common/src/resources/resources/schemas/xmldsig-filter2.xsd @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From 0482f005b4afc060e42674b1ea67157026002ec8 Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 8 Aug 2007 08:21:48 +0000 Subject: More modifications to suit the maven build process. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@911 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../properties/common_messages_de.properties | 16 + .../main/resources/resources/schemas/Core-1.2.xsd | 881 ++++++++++++++ .../resources/resources/schemas/Core.20020225.xsd | 399 +++++++ .../resources/resources/schemas/Core.20020831.xsd | 153 +++ .../resources/schemas/ECDSAKeyValue.ancient.xsd | 122 ++ .../resources/schemas/ECDSAKeyValue.wrong.xsd | 122 ++ .../resources/resources/schemas/ECDSAKeyValue.xsd | 122 ++ .../resources/schemas/MOA-ID-Configuration-1.2.xsd | 350 ++++++ .../resources/schemas/MOA-ID-Configuration-1.3.xsd | 424 +++++++ .../resources/schemas/MOA-ID-Configuration-1.4.xsd | 505 ++++++++ .../resources/resources/schemas/MOA-SPSS-1.3.xsd | 469 ++++++++ .../resources/schemas/MOA-SPSS-config-1.3.xsd | 253 ++++ .../resources/resources/schemas/MOAIdentities.xsd | 51 + .../resources/resources/schemas/PersonData.xsd | 426 +++++++ .../resources/schemas/PersonData_20_en_moaWID.xsd | 1229 ++++++++++++++++++++ .../resources/resources/schemas/PersonName-1_2.xsd | 115 ++ .../resources/schemas/PostalAddress-1_2.xsd | 95 ++ .../resources/schemas/TelcomNumber-1_0.xsd | 89 ++ .../resources/schemas/XMLSchema-instance.xsd | 37 + .../main/resources/resources/schemas/XMLSchema.dtd | 402 +++++++ .../schemas/cs-sstc-schema-assertion-01.xsd | 194 +++ .../schemas/cs-sstc-schema-protocol-01.xsd | 127 ++ .../main/resources/resources/schemas/datatypes.dtd | 203 ++++ .../schemas/exclusive-canonicalization.xsd | 22 + .../src/main/resources/resources/schemas/xml.xsd | 83 ++ .../resources/schemas/xmldsig-core-schema.xsd | 264 +++++ .../resources/schemas/xmldsig-filter2.xsd | 38 + .../properties/common_messages_de.properties | 16 - .../src/resources/resources/schemas/Core-1.2.xsd | 881 -------------- .../resources/resources/schemas/Core.20020225.xsd | 399 ------- .../resources/resources/schemas/Core.20020831.xsd | 153 --- .../resources/schemas/ECDSAKeyValue.ancient.xsd | 122 -- .../resources/schemas/ECDSAKeyValue.wrong.xsd | 122 -- .../resources/resources/schemas/ECDSAKeyValue.xsd | 122 -- .../resources/schemas/MOA-ID-Configuration-1.2.xsd | 350 ------ .../resources/schemas/MOA-ID-Configuration-1.3.xsd | 424 ------- .../resources/schemas/MOA-ID-Configuration-1.4.xsd | 505 -------- .../resources/resources/schemas/MOA-SPSS-1.3.xsd | 469 -------- .../resources/schemas/MOA-SPSS-config-1.3.xsd | 253 ---- .../resources/resources/schemas/MOAIdentities.xsd | 51 - .../src/resources/resources/schemas/PersonData.xsd | 426 ------- .../resources/schemas/PersonData_20_en_moaWID.xsd | 1229 -------------------- .../resources/resources/schemas/PersonName-1_2.xsd | 115 -- .../resources/schemas/PostalAddress-1_2.xsd | 95 -- .../resources/schemas/TelcomNumber-1_0.xsd | 89 -- .../resources/schemas/XMLSchema-instance.xsd | 37 - .../src/resources/resources/schemas/XMLSchema.dtd | 402 ------- .../schemas/cs-sstc-schema-assertion-01.xsd | 194 --- .../schemas/cs-sstc-schema-protocol-01.xsd | 127 -- .../src/resources/resources/schemas/datatypes.dtd | 203 ---- .../schemas/exclusive-canonicalization.xsd | 22 - common/src/resources/resources/schemas/xml.xsd | 83 -- .../resources/schemas/xmldsig-core-schema.xsd | 264 ----- .../resources/schemas/xmldsig-filter2.xsd | 38 - 54 files changed, 7191 insertions(+), 7191 deletions(-) create mode 100644 common/src/main/resources/resources/properties/common_messages_de.properties create mode 100644 common/src/main/resources/resources/schemas/Core-1.2.xsd create mode 100644 common/src/main/resources/resources/schemas/Core.20020225.xsd create mode 100644 common/src/main/resources/resources/schemas/Core.20020831.xsd create mode 100644 common/src/main/resources/resources/schemas/ECDSAKeyValue.ancient.xsd create mode 100644 common/src/main/resources/resources/schemas/ECDSAKeyValue.wrong.xsd create mode 100644 common/src/main/resources/resources/schemas/ECDSAKeyValue.xsd create mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.2.xsd create mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.3.xsd create mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.xsd create mode 100644 common/src/main/resources/resources/schemas/MOA-SPSS-1.3.xsd create mode 100644 common/src/main/resources/resources/schemas/MOA-SPSS-config-1.3.xsd create mode 100644 common/src/main/resources/resources/schemas/MOAIdentities.xsd create mode 100644 common/src/main/resources/resources/schemas/PersonData.xsd create mode 100644 common/src/main/resources/resources/schemas/PersonData_20_en_moaWID.xsd create mode 100644 common/src/main/resources/resources/schemas/PersonName-1_2.xsd create mode 100644 common/src/main/resources/resources/schemas/PostalAddress-1_2.xsd create mode 100644 common/src/main/resources/resources/schemas/TelcomNumber-1_0.xsd create mode 100644 common/src/main/resources/resources/schemas/XMLSchema-instance.xsd create mode 100644 common/src/main/resources/resources/schemas/XMLSchema.dtd create mode 100644 common/src/main/resources/resources/schemas/cs-sstc-schema-assertion-01.xsd create mode 100644 common/src/main/resources/resources/schemas/cs-sstc-schema-protocol-01.xsd create mode 100644 common/src/main/resources/resources/schemas/datatypes.dtd create mode 100644 common/src/main/resources/resources/schemas/exclusive-canonicalization.xsd create mode 100644 common/src/main/resources/resources/schemas/xml.xsd create mode 100644 common/src/main/resources/resources/schemas/xmldsig-core-schema.xsd create mode 100644 common/src/main/resources/resources/schemas/xmldsig-filter2.xsd delete mode 100644 common/src/resources/resources/properties/common_messages_de.properties delete mode 100644 common/src/resources/resources/schemas/Core-1.2.xsd delete mode 100644 common/src/resources/resources/schemas/Core.20020225.xsd delete mode 100644 common/src/resources/resources/schemas/Core.20020831.xsd delete mode 100644 common/src/resources/resources/schemas/ECDSAKeyValue.ancient.xsd delete mode 100644 common/src/resources/resources/schemas/ECDSAKeyValue.wrong.xsd delete mode 100644 common/src/resources/resources/schemas/ECDSAKeyValue.xsd delete mode 100644 common/src/resources/resources/schemas/MOA-ID-Configuration-1.2.xsd delete mode 100644 common/src/resources/resources/schemas/MOA-ID-Configuration-1.3.xsd delete mode 100644 common/src/resources/resources/schemas/MOA-ID-Configuration-1.4.xsd delete mode 100644 common/src/resources/resources/schemas/MOA-SPSS-1.3.xsd delete mode 100644 common/src/resources/resources/schemas/MOA-SPSS-config-1.3.xsd delete mode 100644 common/src/resources/resources/schemas/MOAIdentities.xsd delete mode 100644 common/src/resources/resources/schemas/PersonData.xsd delete mode 100644 common/src/resources/resources/schemas/PersonData_20_en_moaWID.xsd delete mode 100644 common/src/resources/resources/schemas/PersonName-1_2.xsd delete mode 100644 common/src/resources/resources/schemas/PostalAddress-1_2.xsd delete mode 100644 common/src/resources/resources/schemas/TelcomNumber-1_0.xsd delete mode 100644 common/src/resources/resources/schemas/XMLSchema-instance.xsd delete mode 100644 common/src/resources/resources/schemas/XMLSchema.dtd delete mode 100644 common/src/resources/resources/schemas/cs-sstc-schema-assertion-01.xsd delete mode 100644 common/src/resources/resources/schemas/cs-sstc-schema-protocol-01.xsd delete mode 100644 common/src/resources/resources/schemas/datatypes.dtd delete mode 100644 common/src/resources/resources/schemas/exclusive-canonicalization.xsd delete mode 100644 common/src/resources/resources/schemas/xml.xsd delete mode 100644 common/src/resources/resources/schemas/xmldsig-core-schema.xsd delete mode 100644 common/src/resources/resources/schemas/xmldsig-filter2.xsd (limited to 'common/src') diff --git a/common/src/main/resources/resources/properties/common_messages_de.properties b/common/src/main/resources/resources/properties/common_messages_de.properties new file mode 100644 index 000000000..ac05b7996 --- /dev/null +++ b/common/src/main/resources/resources/properties/common_messages_de.properties @@ -0,0 +1,16 @@ +# This file contains exception messages in the standard Java properties +# format. The messages may contain formatting patterns as definied in the +# java.text.MessageFormat class. + + +# +# Messages private to the MOA common subsystem +# + +parser.00=Leichter Fehler beim Parsen: {0}, SystemID={1}, Zeile={2}, Spalte={3} +parser.01=Fehler beim Parsen: {0}, SystemID={1}, Zeile={2}, Spalte={3} +parser.02=Schwerer Fehler beim Parsen: {0}, SystemID={1}, Zeile={2}, Spalte={3} + +xpath.00=Fehler beim Auswerten des XPath-Ausdruckes: {0} + +datetime.00=Fehler beim Parsen der DateTime \ No newline at end of file diff --git a/common/src/main/resources/resources/schemas/Core-1.2.xsd b/common/src/main/resources/resources/schemas/Core-1.2.xsd new file mode 100644 index 000000000..864fee6d5 --- /dev/null +++ b/common/src/main/resources/resources/schemas/Core-1.2.xsd @@ -0,0 +1,881 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/Core.20020225.xsd b/common/src/main/resources/resources/schemas/Core.20020225.xsd new file mode 100644 index 000000000..5dd2836a0 --- /dev/null +++ b/common/src/main/resources/resources/schemas/Core.20020225.xsd @@ -0,0 +1,399 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/Core.20020831.xsd b/common/src/main/resources/resources/schemas/Core.20020831.xsd new file mode 100644 index 000000000..6ec40be63 --- /dev/null +++ b/common/src/main/resources/resources/schemas/Core.20020831.xsd @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/ECDSAKeyValue.ancient.xsd b/common/src/main/resources/resources/schemas/ECDSAKeyValue.ancient.xsd new file mode 100644 index 000000000..833d327f2 --- /dev/null +++ b/common/src/main/resources/resources/schemas/ECDSAKeyValue.ancient.xsd @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/ECDSAKeyValue.wrong.xsd b/common/src/main/resources/resources/schemas/ECDSAKeyValue.wrong.xsd new file mode 100644 index 000000000..db83c9df5 --- /dev/null +++ b/common/src/main/resources/resources/schemas/ECDSAKeyValue.wrong.xsd @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/ECDSAKeyValue.xsd b/common/src/main/resources/resources/schemas/ECDSAKeyValue.xsd new file mode 100644 index 000000000..7a01b23d1 --- /dev/null +++ b/common/src/main/resources/resources/schemas/ECDSAKeyValue.xsd @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.2.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.2.xsd new file mode 100644 index 000000000..4b018db64 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.2.xsd @@ -0,0 +1,350 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der + Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der + Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. + Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der + Proxy-Komponente zur Auth-Komponente (vgl. + AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die + Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann + für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA + (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem + Security-Layer + + + + + + das Attribut filename verweist auf eine Datei mit globalem + Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo + werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks + inkludiert + + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA + SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der + AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; + wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; + wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben + werden; wird das Element nicht verwendet dann wird MOA-SP über das API + aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der + Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des + AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des + IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per + X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + + + + + + enthält Parameter über die OA, die die + Authentisierungs-Komponente betreffen + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der + TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für + die TLS-Client-Authentisierung verwendetwird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.3.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.3.xsd new file mode 100644 index 000000000..66c6e1832 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.3.xsd @@ -0,0 +1,424 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der + Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der + Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. + Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der + Proxy-Komponente zur Auth-Komponente (vgl. + AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die + Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann + für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA + (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem + Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA + SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der + AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; + wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; + wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben + werden; wird das Element nicht verwendet dann wird MOA-SP über das API + aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der + Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des + AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des + IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per + X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + + + das Attribut filename verweist auf eine Datei mit globalem + Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo + werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks + inkludiert + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + + + + enthält Parameter über die OA, die die + Authentisierungs-Komponente betreffen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der + TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für + die TLS-Client-Authentisierung verwendetwird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.xsd new file mode 100644 index 000000000..66a9c0ed4 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.xsd @@ -0,0 +1,505 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der + Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der + Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. + Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der + Proxy-Komponente zur Auth-Komponente (vgl. + AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die + Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann + für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA + (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem + Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA + SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der + AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; + wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; + wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben + werden; wird das Element nicht verwendet dann wird MOA-SP über das API + aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der + Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des + AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des + IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per + X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen + + + + + + + das Attribut filename verweist auf eine Datei mit globalem + Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo + werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks + inkludiert + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + Verifikation zusätzlicher Infoboxen + + + + + Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen + + + + + + + + + + Parameter für Ãœberprüfung weiterer Infoboxen + + + + + + optionalervName, der für Fehlermeldungen verwendet werden soll; + z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird + das Identifier-Attribut verwendet + + + + + TrustProfil, das für die Ãœberprüfung der Infobox + verwendet werden soll + + + + + Validatorklasse, die für die Prüfung der Infobox + verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname + vom Default Package- und Klassennamen abweichen + + + + + + Infobox spezifische Parameter, die der jeweiligen Prüfapplikation + übergeben werden + + + + + + + + + + + + + + + + + + + Spezifiziert die Lage von XML Schemas + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die + Authentisierungs-Komponente betreffen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der + TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für + die TLS-Client-Authentisierung verwendetwird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/MOA-SPSS-1.3.xsd b/common/src/main/resources/resources/schemas/MOA-SPSS-1.3.xsd new file mode 100644 index 000000000..756b51279 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-SPSS-1.3.xsd @@ -0,0 +1,469 @@ + + + + + + + + + + + + + + + + + + + + Ermöglichung der Stapelsignatur durch wiederholte Angabe dieses Elements + + + + + + + + + + + + + + + + + + + Auswahl: Entweder explizite Angabe des Signaturorts sowie ggf. sinnvoller Supplements im Zshg. mit der Signaturumgebung, oder Verweis auf ein benanntes Profil + + + + + + + + + + + + + + + + + + Kardinalität 1..oo erlaubt die Antwort auf eine Stapelsignatur-Anfrage + + + + Resultat, falls die Signaturerstellung erfolgreich war + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert + + + + + + + + + + + only ds:X509Data and RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any;publicAuthority is included as X509Data/any + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pro dsig:Reference-Element in der zu überprüfenden XML-Signatur muss hier ein ReferenceInfo-Element erscheinen. Die Reihenfolge der einzelnen ReferenceInfo Elemente entspricht jener der dsig:Reference Elemente in der XML-Signatur. + + + + + + + + + + mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert + + + + + + + + + + + only ds:X509Data and ds:RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any; PublicAuthority is included as X509Data/any + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Auswahl: Entweder explizite Angabe EINER Transformationskette inklusive ggf. sinnvoller Supplements oder Verweis auf ein benanntes Profil + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Resultat, falls die Signaturerstellung gescheitert ist + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ein oder mehrere Transformationswege können von der Applikation an MOA mitgeteilt werden. Die zu prüfende Signatur hat zumindest einem dieser Transformationswege zu entsprechen. Die Angabe kann explizit oder als Profilbezeichner erfolgen. + + + + + Profilbezeichner für einen Transformationsweg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Die Angabe des Transformationsparameters (explizit oder als Hashwert) kann unterlassen werden, wenn die Applikation von der Unveränderlichkeit des Inhalts der in "Transformationsparamter", Attribut "URI" angegebenen URI ausgehen kann. + + + + Der Transformationsparameter explizit angegeben. + + + + + Der Hashwert des Transformationsparameters. + + + + + + + + + + + + + + + + + + + + + + Explizite Angabe des Transformationswegs + + + + + + + Alle impliziten Transformationsparameter, die zum Durchlaufen der oben angeführten Transformationskette bekannt sein müssen, müssen hier angeführt werden. Das Attribut "URI" bezeichnet den Transformationsparameter in exakt jener Weise, wie er in der zu überprüfenden Signatur gebraucht wird. + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.3.xsd b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.3.xsd new file mode 100644 index 000000000..8ab3d62aa --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.3.xsd @@ -0,0 +1,253 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/MOAIdentities.xsd b/common/src/main/resources/resources/schemas/MOAIdentities.xsd new file mode 100644 index 000000000..de9d9d4e4 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOAIdentities.xsd @@ -0,0 +1,51 @@ + + + + + + MOAIdentities provides a mapping from identities to parameters used in the XMLLoginParameterResolver of MOA-ID + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/PersonData.xsd b/common/src/main/resources/resources/schemas/PersonData.xsd new file mode 100644 index 000000000..0e3bc6b3b --- /dev/null +++ b/common/src/main/resources/resources/schemas/PersonData.xsd @@ -0,0 +1,426 @@ + + + + + + + + + + + + + unique identifier + + + + + actual value of the identifier. + + + + + + + + + + + + type of value (eg 'ZMR', 'SV-Nummer', 'Martrikelnummer', database identification, ...) + + + + + authority, which is reponsible for generation of the identifier (eg university in case of 'MatrikelNummer') + + + + + any additional properties + + + + + + + + + + element of person type + + + + + main structure of person data + + + + + unique identification entities + + + + + + + + + + element of physical person type + + + + + physical person + + + + + + + data related to the person's name + + + + + Former name, Artist name, changes of Given name ... + + + + + + + + + + + + status of a person in the cycle of life + + + + + gender + + + + + date of birth + + + + + place of birth + + + + + country of birth + + + + + nationality of Person (Staatsbürgerschaft) + + + + + confession (religion) of Person + + + + + relatives (parents, ...) + + + + + + type of the relationship + + + + + + + + + any additional properties + + + + + + + + + element of corporate body type + + + + + juridical person, organisation + + + + + + + category (eg organisation, function, sector, ...) + + + + + name of corporate body (whole name) + + + + + alternative names of corporate body (abbreviations, short name, synonyms, ...) + + + + + type of company (eg AG, OHG, ...) + + + + + part of an organisation, see also X.500 ou (eg departement, section, branch, ...) + + + + + any additional properties + + + + + + + + + + element of signed person datastructure type + + + + + signed person datastructure. The first Identification elements (from the base type) denote the record as such (e.g. database key for this record) - not to be mistaken for identifiers of the person or of an address (they have their own Identification elements). + + + + + + + + + one or more electronic signatures applied on fields above + + + + + + + + any additional properties + + + + + + + + + + + + + simple type for sex (gender) of person + + + + + + + + + + simple type for dates (union), which may omit day and/or month + + + + + + simple type for marital status of a person + + + + + + + + + + + pattern type for enlargement of type definitions + + + + + + + + known relations (family + functional) + + + + + + + + + + + + + + + + known + any other relation + + + + + + known types of alternative names + + + + + + + + + + + + known + any other alternative name types + + + + + + + element of address type + + + + + main structure of address data + + + + + unique identification entities + + + + + + + + + element of postal address type + + + + + postal address + + + + + + + type of address - category (eg 'Wohnsitz', 'Zentrale', ...) + + + + + + any additional properties + + + + + + + + + element of telephone address type + + + + + phone numbers + + + + + + + type of phononumber - category (eg 'Festnetz', 'Mobile', 'fax', ...) + + + + + phonenumber + + + + + any additional properties + + + + + + + + + element of internet address type + + + + + internet based communication + + + + + + + certificate for secure communication + + + + + email-Address, Web, FTP, LDAP, ... + + + + + any additional properties + + + + + + + diff --git a/common/src/main/resources/resources/schemas/PersonData_20_en_moaWID.xsd b/common/src/main/resources/resources/schemas/PersonData_20_en_moaWID.xsd new file mode 100644 index 000000000..cf8f796db --- /dev/null +++ b/common/src/main/resources/resources/schemas/PersonData_20_en_moaWID.xsd @@ -0,0 +1,1229 @@ + + + + + + + + + This version of person deploys only global elements. All types derived from abstract types have been replaced by substitution groups + + + + + dummy abstract Peson Data element needed for bi-lingual schema (substitution groups) + + + + + element of signed person datastructure type + + + + + element of signed person datastructure type + + + + + + + + + + + + + + + + + + + element of person type, essential abstract, subsitute PhysicalPerson or CorporateBody instead or use with xsi:type="..." + + + + + + element of physical person type, dreived from Person (abstract) + + + + + element of physical person type, dreived from Person (abstract) + + + + + element of corporate body type, derived from Person + + + + + element of corporate body type, derived from Person + + + + + + data related to the person's name + + + + + data related to the person's name + + + + + Former name, Artist name, changes of Given name ..., compare AlternativName + + + + + + + + + + + + relatives (parents, ...), compare Verwandter + + + + + + type of the relationship, compare Verwandschftsgrad + + + + + + + + + + element of address type, essentially abstract. Use InternetAddress, TelephoneAddress, PostalAddress, TypedPostalAddress instead, or use Address with xsi:type Attribute + + + + + Postal or ZMR Address, compare PostAdresse + + + + + Postal or ZMR Address, compare PostAdresse + + + + + Typed Postal or ZMR Address, compare TypisiertePostAdresse + + + + + InternetAdress such as e-mail or website, compare InternetAdresse + + + + + Typed TelephoneAddress, compare TelefonAdresse + + + + + National or international bank connection, compare Bankverbindung + + + + + + possibility to include common austrian primary keys in human readable way, english translation not available + + + + + + + + + + + + + + + + + + + + + + + + Ergänzungsregister für nicht-natürliche Personen (CorporateBody) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + teletyper or telephone for the hearing impaired + + + + + + status of a person in the cycle of life, compare Familienstand + + + + + gender, comapre Geschlecht + + + + + date of birth, compare Geburtsdatum + + + + + date of death, compare Sterbedatum + + + + + place of birth, compare Geburtsort + + + + + country of birth, compare Geburtsland + + + + + state of birth, comapre Geburtsbundesland + + + + + nationality of Person, compare Staatsangehoerigkeit. attention! New Fomrat is complex, string value accepted for compatibility only + + + + + confession (religion) of Person - xs:token? gibt es wirklich keine Staaten mit Leerzeichen im Namen? + + + + + occupation, compare Beruf + + + + + + compare InternationalerLaendercode + + + + + compare NationalNummer + + + + + compare Vorwahl + + + + + compare Anschlussnummer + + + + + Complete number, ready formated - e.g. +43 1 5131345 4664 compare FormatierteNummer + + + + + compare Klappe + + + + + unique identifier + + + + + + signed person datastructure. The first Identification elements (from the base type) denote the record as such (e.g. database key for this record) - not to be mistaken for identifiers of the person or of an address (they have their own Identification elements). + + + + + + + + + one or more electronic signatures applied on fields above + + + + + container for your Information needs. Contained Elements must reside in a different Namespace + + + + + + any additional properties + + + + + + + + + + + + signed person datastructure. The first Identification elements (from the base type) denote the record as such (e.g. database key for this record) - not to be mistaken for identifiers of the person or of an address (they have their own Identification elements). + + + + + + + + + one or more electronic signatures applied on fields above + + + + + container for your Information needs. Contained Elements must reside in a different Namespace + + + + + + any additional properties + + + + + + + + + + + + + + + + + unique identifier + + + + + actual value of the identifier. + + + + + + + + + + + + type of value (eg 'ZMR', 'SV-Nummer', 'Martrikelnummer', database identification, ...) + + + + + authority, which is reponsible for generation of the identifier (eg university in case of 'MatrikelNummer') + + + + + any additional properties + + + + + + + + + main structure of person data + + + + + unique identification entities + + + + + + + + + + physical person, compare NatuerlichePersonTyp + + + + + + + + + + + + + + + + + + + + + any additional properties + + + + + + + + + physical person, compare NatuerlichePersonTyp + + + + + + + + + + + + + any additional properties + + + + + + + + + juridical person, organisation, compare NichtNatuerlichePersonTyp + + + + + + + URI pointing to a predefined Class of CorporateBodies, compare Typ + + + + + name of corporate body (whole name), compare VollerName + + + + + alternative names of corporate body (abbreviations, short name, synonyms, ...), comapre AlternativName + + + + + type of company (eg AG, OHG, ...), URI pointing to predefined LegalForm, compare Rechtsform + + + + + part of an organisation, see also X.500 ou (eg departement, section, branch, ...) , compare Organisation + + + + + + any additional properties + + + + + + + + + juridical person, organisation, compare NichtNatuerlichePersonTyp + + + + + + + URI pointing to a predefined Class of CorporateBodies, compare Typ + + + + + name of corporate body (whole name), compare VollerName + + + + + type of company (eg AG, OHG, ...), URI pointing to predefined LegalForm, compare Rechtsform + + + + + part of an organisation, see also X.500 ou (eg departement, section, branch, ...) , compare Organisation + + + + + any additional properties + + + + + + + + + container for parts of a name, comapre PersonenNameTyp + + + + + Complete Name (including Affixes) of the Person, especially useful for names from different cultural environments + + + + + + + + + + + + + + + + + + + + + Every given name should be contained inside a GivenName Tag. If that is not possible due to dabase contraints, ... putting several given names inside one GivenName Element is acceptable + + + + + A Person in possesion of more than one GivenName frequently preferrs the use of a Name other than the first GivenName + + + + + MiddleNames are not commonly found in central Europe. The field is mainly for compatibility reasons + + + + + Every family name should be contained inside a FamilyName Tag. If that is not possible due to dabase contraints, ... putting several family names inside one FamilyName Element is acceptable + + + + + + + + + + + + + + + + + + + + + Inlcudes all Information that is not exactly a name: academic or aristocratic titles, ... the new position attribute can contain a suffx or prefix value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + container for parts of a name, comapre PersonenNameTyp + + + + + Every given name should be contained inside a GivenName Tag. If that is not possible due to dabase contraints, ... putting several given names inside one GivenName Element is acceptable + + + + + Every family name should be contained inside a FamilyName Tag. If that is not possible due to dabase contraints, ... putting several family names inside one FamilyName Element is acceptable + + + + + + + + + + + + + + + + + + + + + Inlcudes all Information that is not exactly a name: academic or aristocratic titles, ... the new position attribute can contain a suffx or prefix value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + comapre, StaatsangehoerigkeitTyp + + + + + + + + + + + + + + + + + + compare BankverbindungTyp + + + + + Account holder, compare Inhaber + + + + + compare BankName + + + + + + compare NationaleBankverbindung + + + + + + compare Kontonummer + + + + + compare BLZ + + + + + + + + compare InternationaleBankverbindung + + + + + + compare IBAN + + + + + comapre BIC + + + + + + + + + + + main structure of address data + + + + + unique identification entities + + + + + + + + + postal address with type information, compare TypisiertePostAdresseTyp + + + + + + + type of address - category (eg 'Wohnsitz', 'Zentrale', ...) + + + + + + any additional properties + + + + + + + + + compare PostAdresseTyp + + + + + + + Code for the country, use ISO or internatinal Postalstandard, compare Staatscode + + + + + + + + + + Name of the country, use ISO Name, or international Postal Standard, compare Staatsname + + + + + ZIP, compare Postleitzahl + + + + + compare Region + + + + + compare Bundesland + + + + + compare Gemeinde + + + + + compare Gemeindekennzahl + + + + + ZMR use, compare Ortschaft + + + + + ZMR use, comapre OrtschaftZweisprachig + + + + + + + + + + + + + + zmr use only + + + + + zmr use only + + + + + + Addressregister database keys used to identify Addresses + + + + + + + + + + + + + + + If Addressis used outside of PersonData a recipient can be specified + + + + + + + + rather OrganizationUnit e.G Sales Departement + + + + + e.g. Smith Ltd + + + + + + + + + + + + + + + + + + + + + + compare PostAdresseTyp + + + + + + + Code for the country, use ISO or internatinal Postalstandard, compare Staatscode + + + + + + + + + + Name of the country, use ISO Name, or international Postal Standard, compare Staatsname + + + + + ZIP, compare Postleitzahl + + + + + compare Gemeinde + + + + + + + + if streetname not available use name of Ortschaft + + + + + + + + + + + + + + + + + + + + + + + + + e.g. e-mail, webiste, compare InternetAdresseTyp + + + + + + + certificate for secure communication + + + + + URI: email-Address, Web, FTP, LDAP, ..., comapre Adress + + + + + any additional properties + + + + + + + + + phone numbers, conmpare TelephoneAdresseTyp + + + + + + + type of phononumber - category (eg 'Festnetz', 'Mobile', 'fax', ...) + + + + + phonenumber + + + + + any additional properties + + + + + + + + + like TelephoneAddresseType but with additional smsEnabled attribute + + + + + + + + + + formated number or set of telephone number parts + + + + + + + + + set of telephone number parts + + + + + + + + + + + + + simple type for sex (gender) of person + + + + + + + + + + simple type for dates (union), which may omit day and/or month + + + + + + simple type for dates (union), which may omit day and/or month + + + + + + simple type for marital status of a person + + + + + + + + + + + pattern type for enlargement of type definitions. Contents as follows +x:sometext or 12345 or _ or other symbols + + + + + + + + + known relations (family + functional) + + + + + + + + + + + + + + + + known + any other relation + + + + + + known types of alternative names + + + + + + + + + + + + known + any other alternative name types + + + + + + + zmr use only + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/PersonName-1_2.xsd b/common/src/main/resources/resources/schemas/PersonName-1_2.xsd new file mode 100644 index 000000000..347ed3d7f --- /dev/null +++ b/common/src/main/resources/resources/schemas/PersonName-1_2.xsd @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/PostalAddress-1_2.xsd b/common/src/main/resources/resources/schemas/PostalAddress-1_2.xsd new file mode 100644 index 000000000..b3d89abbb --- /dev/null +++ b/common/src/main/resources/resources/schemas/PostalAddress-1_2.xsd @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/TelcomNumber-1_0.xsd b/common/src/main/resources/resources/schemas/TelcomNumber-1_0.xsd new file mode 100644 index 000000000..f89702aeb --- /dev/null +++ b/common/src/main/resources/resources/schemas/TelcomNumber-1_0.xsd @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/XMLSchema-instance.xsd b/common/src/main/resources/resources/schemas/XMLSchema-instance.xsd new file mode 100644 index 000000000..f47577b8a --- /dev/null +++ b/common/src/main/resources/resources/schemas/XMLSchema-instance.xsd @@ -0,0 +1,37 @@ + + + + + + + +]> + + + +

          XML Schema instance namespace

          +

          See the XML Schema + Recommendation for an introduction

          + + +
          + $Date: 2001/03/16 20:25:57 $
          + $Id: XMLSchema-instance.xsd,v 1.4 2001/03/16 20:25:57 ht Exp $ +
          +
          + +

          This schema should never be used as such: + the XML + Schema Recommendation forbids the declaration of + attributes in this namespace

          +
          +
          + + + + + +
          diff --git a/common/src/main/resources/resources/schemas/XMLSchema.dtd b/common/src/main/resources/resources/schemas/XMLSchema.dtd new file mode 100644 index 000000000..e8e8f7625 --- /dev/null +++ b/common/src/main/resources/resources/schemas/XMLSchema.dtd @@ -0,0 +1,402 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%xs-datatypes; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/cs-sstc-schema-assertion-01.xsd b/common/src/main/resources/resources/schemas/cs-sstc-schema-assertion-01.xsd new file mode 100644 index 000000000..8bc5af147 --- /dev/null +++ b/common/src/main/resources/resources/schemas/cs-sstc-schema-assertion-01.xsd @@ -0,0 +1,194 @@ + + + + + + + Document identifier: cs-sstc-schema-assertion-01 + Location: http://www.oasis-open.org/committees/security/docs/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/cs-sstc-schema-protocol-01.xsd b/common/src/main/resources/resources/schemas/cs-sstc-schema-protocol-01.xsd new file mode 100644 index 000000000..ecad05b0f --- /dev/null +++ b/common/src/main/resources/resources/schemas/cs-sstc-schema-protocol-01.xsd @@ -0,0 +1,127 @@ + + + + + + + + Document identifier: cs-sstc-schema-protocol-01 + Location: http://www.oasis-open.org/committees/security/docs/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/datatypes.dtd b/common/src/main/resources/resources/schemas/datatypes.dtd new file mode 100644 index 000000000..8e48553be --- /dev/null +++ b/common/src/main/resources/resources/schemas/datatypes.dtd @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/exclusive-canonicalization.xsd b/common/src/main/resources/resources/schemas/exclusive-canonicalization.xsd new file mode 100644 index 000000000..d4a2d82ec --- /dev/null +++ b/common/src/main/resources/resources/schemas/exclusive-canonicalization.xsd @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file diff --git a/common/src/main/resources/resources/schemas/xml.xsd b/common/src/main/resources/resources/schemas/xml.xsd new file mode 100644 index 000000000..79dbc02ba --- /dev/null +++ b/common/src/main/resources/resources/schemas/xml.xsd @@ -0,0 +1,83 @@ + + + + + + + See http://www.w3.org/XML/1998/namespace.html and + http://www.w3.org/TR/REC-xml for information about this namespace. + + + + + This schema defines attributes and an attribute group + suitable for use by + schemas wishing to allow xml:base, xml:lang or xml:space attributes + on elements they define. + + To enable this, such a schema must import this schema + for the XML namespace, e.g. as follows: + <schema . . .> + . . . + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2001/03/xml.xsd"/> + + Subsequently, qualified reference to any of the attributes + or the group defined below will have the desired effect, e.g. + + <type . . .> + . . . + <attributeGroup ref="xml:specialAttrs"/> + + will define a type which will schema-validate an instance + element with any of those attributes + + + + In keeping with the XML Schema WG's standard versioning + policy, this schema document will persist at + http://www.w3.org/2001/03/xml.xsd. + At the date of issue it can also be found at + http://www.w3.org/2001/xml.xsd. + The schema document at that URI may however change in the future, + in order to remain compatible with the latest version of XML Schema + itself. In other words, if the XML Schema namespace changes, the version + of this document at + http://www.w3.org/2001/xml.xsd will change + accordingly; the version at + http://www.w3.org/2001/03/xml.xsd will not change. + + + + + + In due course, we should install the relevant ISO 2- and 3-letter + codes as the enumerated possible values . . . + + + + + + + + + + + + + + + See http://www.w3.org/TR/xmlbase/ for + information about this attribute. + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/xmldsig-core-schema.xsd b/common/src/main/resources/resources/schemas/xmldsig-core-schema.xsd new file mode 100644 index 000000000..a7e302373 --- /dev/null +++ b/common/src/main/resources/resources/schemas/xmldsig-core-schema.xsd @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/xmldsig-filter2.xsd b/common/src/main/resources/resources/schemas/xmldsig-filter2.xsd new file mode 100644 index 000000000..330eafd19 --- /dev/null +++ b/common/src/main/resources/resources/schemas/xmldsig-filter2.xsd @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/resources/resources/properties/common_messages_de.properties b/common/src/resources/resources/properties/common_messages_de.properties deleted file mode 100644 index ac05b7996..000000000 --- a/common/src/resources/resources/properties/common_messages_de.properties +++ /dev/null @@ -1,16 +0,0 @@ -# This file contains exception messages in the standard Java properties -# format. The messages may contain formatting patterns as definied in the -# java.text.MessageFormat class. - - -# -# Messages private to the MOA common subsystem -# - -parser.00=Leichter Fehler beim Parsen: {0}, SystemID={1}, Zeile={2}, Spalte={3} -parser.01=Fehler beim Parsen: {0}, SystemID={1}, Zeile={2}, Spalte={3} -parser.02=Schwerer Fehler beim Parsen: {0}, SystemID={1}, Zeile={2}, Spalte={3} - -xpath.00=Fehler beim Auswerten des XPath-Ausdruckes: {0} - -datetime.00=Fehler beim Parsen der DateTime \ No newline at end of file diff --git a/common/src/resources/resources/schemas/Core-1.2.xsd b/common/src/resources/resources/schemas/Core-1.2.xsd deleted file mode 100644 index 864fee6d5..000000000 --- a/common/src/resources/resources/schemas/Core-1.2.xsd +++ /dev/null @@ -1,881 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/Core.20020225.xsd b/common/src/resources/resources/schemas/Core.20020225.xsd deleted file mode 100644 index 5dd2836a0..000000000 --- a/common/src/resources/resources/schemas/Core.20020225.xsd +++ /dev/null @@ -1,399 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/Core.20020831.xsd b/common/src/resources/resources/schemas/Core.20020831.xsd deleted file mode 100644 index 6ec40be63..000000000 --- a/common/src/resources/resources/schemas/Core.20020831.xsd +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/ECDSAKeyValue.ancient.xsd b/common/src/resources/resources/schemas/ECDSAKeyValue.ancient.xsd deleted file mode 100644 index 833d327f2..000000000 --- a/common/src/resources/resources/schemas/ECDSAKeyValue.ancient.xsd +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/ECDSAKeyValue.wrong.xsd b/common/src/resources/resources/schemas/ECDSAKeyValue.wrong.xsd deleted file mode 100644 index db83c9df5..000000000 --- a/common/src/resources/resources/schemas/ECDSAKeyValue.wrong.xsd +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/ECDSAKeyValue.xsd b/common/src/resources/resources/schemas/ECDSAKeyValue.xsd deleted file mode 100644 index 7a01b23d1..000000000 --- a/common/src/resources/resources/schemas/ECDSAKeyValue.xsd +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/MOA-ID-Configuration-1.2.xsd b/common/src/resources/resources/schemas/MOA-ID-Configuration-1.2.xsd deleted file mode 100644 index 4b018db64..000000000 --- a/common/src/resources/resources/schemas/MOA-ID-Configuration-1.2.xsd +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter der - Authentisierungs-Komponente - - - - - enthält Konfigurationsparameter der - Proxy-Komponente - - - - - - enthält Parameter für die Kommunikation zw. - Proxykomponente und Authenttisierungskomponente - - - - - - enthält Parameter für die SOAP-Verbindung von der - Proxy-Komponente zur Auth-Komponente (vgl. - AuthComponent/MOA-SP/ConnectionParameter) - - - - - - - - - - - enthält Parameter für die OA - - - - - - - - - - - - - spezifiziert den Algorithmus ("pkix" oder "chaining") für die - Zertifikatspfadvalidierung - - - - - - ein vom SystemDefaultMode abweichender ChiningMode kann - für jeden TrustAnchor gesetzt werden - - - - - - - - - - - - - - - - verweist auf ein Verzeichnis, das vertrauenswürdige CA - (Zwischen-CA, Wurzel-CA) Zertifikate enthält. - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter für die Kommunikation mit dem - Security-Layer - - - - - - das Attribut filename verweist auf eine Datei mit globalem - Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo - werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks - inkludiert - - - - - - - - - - - enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA - SP Modul - - - - - - enthält Parameter für die SOAP-Verbindung von der - AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; - wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; - wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben - werden; wird das Element nicht verwendet dann wird MOA-SP über das API - aufgerufen - - - - - enthält Parameter für die Ãœberprüfung der - Personenbindung - - - - - - - - - - enthält Parameter für die Ãœberprüfung des - AUTH-Blocks - - - - - - - - - - - - - - enthält Informationen über akzeptierte Signers des - IdentityLinks - - - - - - akzeptierte Signer des IdentityLinks werden per - X509SubjectName (Kodierung nach RFC 2253) identifiziert - - - - - - - - - - - - - enthält Parameter über die OA, die die - Authentisierungs-Komponente betreffen - - - - - - - - - - enthält Parameter über die OA, die die Proxy-Komponente - betreffen - - - - - - enthält Parameter über die OA, die die Proxy-Komponente - betreffen - - - - - - - - - - - - - - - - - URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der - TLS-Verbindung enthält (keine CA-Zertifikate) - - - - - - - - - - - - URL zu einem KeyStore, der den privaten Schlüssel, der für - die TLS-Client-Authentisierung verwendetwird, enthält - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/MOA-ID-Configuration-1.3.xsd b/common/src/resources/resources/schemas/MOA-ID-Configuration-1.3.xsd deleted file mode 100644 index 66c6e1832..000000000 --- a/common/src/resources/resources/schemas/MOA-ID-Configuration-1.3.xsd +++ /dev/null @@ -1,424 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter der - Authentisierungs-Komponente - - - - - enthält Konfigurationsparameter der - Proxy-Komponente - - - - - - enthält Parameter für die Kommunikation zw. - Proxykomponente und Authenttisierungskomponente - - - - - - enthält Parameter für die SOAP-Verbindung von der - Proxy-Komponente zur Auth-Komponente (vgl. - AuthComponent/MOA-SP/ConnectionParameter) - - - - - - - - - - - enthält Parameter für die OA - - - - - - - - - - - - - - - - - - - - - spezifiziert den Algorithmus ("pkix" oder "chaining") für die - Zertifikatspfadvalidierung - - - - - - ein vom SystemDefaultMode abweichender ChiningMode kann - für jeden TrustAnchor gesetzt werden - - - - - - - - - - - - - - - - verweist auf ein Verzeichnis, das vertrauenswürdige CA - (Zwischen-CA, Wurzel-CA) Zertifikate enthält. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter für die Kommunikation mit dem - Security-Layer - - - - - - - - - - enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA - SP Modul - - - - - - enthält Parameter für die SOAP-Verbindung von der - AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; - wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; - wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben - werden; wird das Element nicht verwendet dann wird MOA-SP über das API - aufgerufen - - - - - enthält Parameter für die Ãœberprüfung der - Personenbindung - - - - - - - - - - enthält Parameter für die Ãœberprüfung des - AUTH-Blocks - - - - - - - - - - - - - - enthält Informationen über akzeptierte Signers des - IdentityLinks - - - - - - akzeptierte Signer des IdentityLinks werden per - X509SubjectName (Kodierung nach RFC 2253) identifiziert - - - - - - - - - - das Attribut filename verweist auf eine Datei mit globalem - Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo - werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks - inkludiert - - - - - - - - - - - - das Attribut URL spezifiziert die Lage des Templates - - - - - - - - - enthält Parameter über die OA, die die - Authentisierungs-Komponente betreffen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter über die OA, die die Proxy-Komponente - betreffen - - - - - - enthält Parameter über die OA, die die Proxy-Komponente - betreffen - - - - - - - - - - - - - - - - - - URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der - TLS-Verbindung enthält (keine CA-Zertifikate) - - - - - - - - - - - - URL zu einem KeyStore, der den privaten Schlüssel, der für - die TLS-Client-Authentisierung verwendetwird, enthält - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/MOA-ID-Configuration-1.4.xsd b/common/src/resources/resources/schemas/MOA-ID-Configuration-1.4.xsd deleted file mode 100644 index 66a9c0ed4..000000000 --- a/common/src/resources/resources/schemas/MOA-ID-Configuration-1.4.xsd +++ /dev/null @@ -1,505 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter der - Authentisierungs-Komponente - - - - - enthält Konfigurationsparameter der - Proxy-Komponente - - - - - - enthält Parameter für die Kommunikation zw. - Proxykomponente und Authenttisierungskomponente - - - - - - enthält Parameter für die SOAP-Verbindung von der - Proxy-Komponente zur Auth-Komponente (vgl. - AuthComponent/MOA-SP/ConnectionParameter) - - - - - - - - - - - enthält Parameter für die OA - - - - - - - - - - - - - - - - - - - - - - spezifiziert den Algorithmus ("pkix" oder "chaining") für die - Zertifikatspfadvalidierung - - - - - - ein vom SystemDefaultMode abweichender ChiningMode kann - für jeden TrustAnchor gesetzt werden - - - - - - - - - - - - - - - - verweist auf ein Verzeichnis, das vertrauenswürdige CA - (Zwischen-CA, Wurzel-CA) Zertifikate enthält. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter für die Kommunikation mit dem - Security-Layer - - - - - - - - - - enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA - SP Modul - - - - - - enthält Parameter für die SOAP-Verbindung von der - AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; - wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; - wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben - werden; wird das Element nicht verwendet dann wird MOA-SP über das API - aufgerufen - - - - - enthält Parameter für die Ãœberprüfung der - Personenbindung - - - - - - - - - - enthält Parameter für die Ãœberprüfung des - AUTH-Blocks - - - - - - - - - - - - - - enthält Informationen über akzeptierte Signers des - IdentityLinks - - - - - - akzeptierte Signer des IdentityLinks werden per - X509SubjectName (Kodierung nach RFC 2253) identifiziert - - - - - - - - enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen - - - - - - - das Attribut filename verweist auf eine Datei mit globalem - Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo - werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks - inkludiert - - - - - - - - - - - - das Attribut URL spezifiziert die Lage des Templates - - - - - - Verifikation zusätzlicher Infoboxen - - - - - Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen - - - - - - - - - - Parameter für Ãœberprüfung weiterer Infoboxen - - - - - - optionalervName, der für Fehlermeldungen verwendet werden soll; - z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird - das Identifier-Attribut verwendet - - - - - TrustProfil, das für die Ãœberprüfung der Infobox - verwendet werden soll - - - - - Validatorklasse, die für die Prüfung der Infobox - verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname - vom Default Package- und Klassennamen abweichen - - - - - - Infobox spezifische Parameter, die der jeweiligen Prüfapplikation - übergeben werden - - - - - - - - - - - - - - - - - - - Spezifiziert die Lage von XML Schemas - - - - - - - - - - - - - - - - enthält Parameter über die OA, die die - Authentisierungs-Komponente betreffen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter über die OA, die die Proxy-Komponente - betreffen - - - - - - enthält Parameter über die OA, die die Proxy-Komponente - betreffen - - - - - - - - - - - - - - - - - - URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der - TLS-Verbindung enthält (keine CA-Zertifikate) - - - - - - - - - - - - URL zu einem KeyStore, der den privaten Schlüssel, der für - die TLS-Client-Authentisierung verwendetwird, enthält - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/MOA-SPSS-1.3.xsd b/common/src/resources/resources/schemas/MOA-SPSS-1.3.xsd deleted file mode 100644 index 756b51279..000000000 --- a/common/src/resources/resources/schemas/MOA-SPSS-1.3.xsd +++ /dev/null @@ -1,469 +0,0 @@ - - - - - - - - - - - - - - - - - - - - Ermöglichung der Stapelsignatur durch wiederholte Angabe dieses Elements - - - - - - - - - - - - - - - - - - - Auswahl: Entweder explizite Angabe des Signaturorts sowie ggf. sinnvoller Supplements im Zshg. mit der Signaturumgebung, oder Verweis auf ein benanntes Profil - - - - - - - - - - - - - - - - - - Kardinalität 1..oo erlaubt die Antwort auf eine Stapelsignatur-Anfrage - - - - Resultat, falls die Signaturerstellung erfolgreich war - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert - - - - - - - - - - - only ds:X509Data and RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any;publicAuthority is included as X509Data/any - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Pro dsig:Reference-Element in der zu überprüfenden XML-Signatur muss hier ein ReferenceInfo-Element erscheinen. Die Reihenfolge der einzelnen ReferenceInfo Elemente entspricht jener der dsig:Reference Elemente in der XML-Signatur. - - - - - - - - - - mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert - - - - - - - - - - - only ds:X509Data and ds:RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any; PublicAuthority is included as X509Data/any - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Auswahl: Entweder explizite Angabe EINER Transformationskette inklusive ggf. sinnvoller Supplements oder Verweis auf ein benanntes Profil - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Resultat, falls die Signaturerstellung gescheitert ist - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ein oder mehrere Transformationswege können von der Applikation an MOA mitgeteilt werden. Die zu prüfende Signatur hat zumindest einem dieser Transformationswege zu entsprechen. Die Angabe kann explizit oder als Profilbezeichner erfolgen. - - - - - Profilbezeichner für einen Transformationsweg - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Die Angabe des Transformationsparameters (explizit oder als Hashwert) kann unterlassen werden, wenn die Applikation von der Unveränderlichkeit des Inhalts der in "Transformationsparamter", Attribut "URI" angegebenen URI ausgehen kann. - - - - Der Transformationsparameter explizit angegeben. - - - - - Der Hashwert des Transformationsparameters. - - - - - - - - - - - - - - - - - - - - - - Explizite Angabe des Transformationswegs - - - - - - - Alle impliziten Transformationsparameter, die zum Durchlaufen der oben angeführten Transformationskette bekannt sein müssen, müssen hier angeführt werden. Das Attribut "URI" bezeichnet den Transformationsparameter in exakt jener Weise, wie er in der zu überprüfenden Signatur gebraucht wird. - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/MOA-SPSS-config-1.3.xsd b/common/src/resources/resources/schemas/MOA-SPSS-config-1.3.xsd deleted file mode 100644 index 8ab3d62aa..000000000 --- a/common/src/resources/resources/schemas/MOA-SPSS-config-1.3.xsd +++ /dev/null @@ -1,253 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/MOAIdentities.xsd b/common/src/resources/resources/schemas/MOAIdentities.xsd deleted file mode 100644 index de9d9d4e4..000000000 --- a/common/src/resources/resources/schemas/MOAIdentities.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - MOAIdentities provides a mapping from identities to parameters used in the XMLLoginParameterResolver of MOA-ID - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/PersonData.xsd b/common/src/resources/resources/schemas/PersonData.xsd deleted file mode 100644 index 0e3bc6b3b..000000000 --- a/common/src/resources/resources/schemas/PersonData.xsd +++ /dev/null @@ -1,426 +0,0 @@ - - - - - - - - - - - - - unique identifier - - - - - actual value of the identifier. - - - - - - - - - - - - type of value (eg 'ZMR', 'SV-Nummer', 'Martrikelnummer', database identification, ...) - - - - - authority, which is reponsible for generation of the identifier (eg university in case of 'MatrikelNummer') - - - - - any additional properties - - - - - - - - - - element of person type - - - - - main structure of person data - - - - - unique identification entities - - - - - - - - - - element of physical person type - - - - - physical person - - - - - - - data related to the person's name - - - - - Former name, Artist name, changes of Given name ... - - - - - - - - - - - - status of a person in the cycle of life - - - - - gender - - - - - date of birth - - - - - place of birth - - - - - country of birth - - - - - nationality of Person (Staatsbürgerschaft) - - - - - confession (religion) of Person - - - - - relatives (parents, ...) - - - - - - type of the relationship - - - - - - - - - any additional properties - - - - - - - - - element of corporate body type - - - - - juridical person, organisation - - - - - - - category (eg organisation, function, sector, ...) - - - - - name of corporate body (whole name) - - - - - alternative names of corporate body (abbreviations, short name, synonyms, ...) - - - - - type of company (eg AG, OHG, ...) - - - - - part of an organisation, see also X.500 ou (eg departement, section, branch, ...) - - - - - any additional properties - - - - - - - - - - element of signed person datastructure type - - - - - signed person datastructure. The first Identification elements (from the base type) denote the record as such (e.g. database key for this record) - not to be mistaken for identifiers of the person or of an address (they have their own Identification elements). - - - - - - - - - one or more electronic signatures applied on fields above - - - - - - - - any additional properties - - - - - - - - - - - - - simple type for sex (gender) of person - - - - - - - - - - simple type for dates (union), which may omit day and/or month - - - - - - simple type for marital status of a person - - - - - - - - - - - pattern type for enlargement of type definitions - - - - - - - - known relations (family + functional) - - - - - - - - - - - - - - - - known + any other relation - - - - - - known types of alternative names - - - - - - - - - - - - known + any other alternative name types - - - - - - - element of address type - - - - - main structure of address data - - - - - unique identification entities - - - - - - - - - element of postal address type - - - - - postal address - - - - - - - type of address - category (eg 'Wohnsitz', 'Zentrale', ...) - - - - - - any additional properties - - - - - - - - - element of telephone address type - - - - - phone numbers - - - - - - - type of phononumber - category (eg 'Festnetz', 'Mobile', 'fax', ...) - - - - - phonenumber - - - - - any additional properties - - - - - - - - - element of internet address type - - - - - internet based communication - - - - - - - certificate for secure communication - - - - - email-Address, Web, FTP, LDAP, ... - - - - - any additional properties - - - - - - - diff --git a/common/src/resources/resources/schemas/PersonData_20_en_moaWID.xsd b/common/src/resources/resources/schemas/PersonData_20_en_moaWID.xsd deleted file mode 100644 index cf8f796db..000000000 --- a/common/src/resources/resources/schemas/PersonData_20_en_moaWID.xsd +++ /dev/null @@ -1,1229 +0,0 @@ - - - - - - - - - This version of person deploys only global elements. All types derived from abstract types have been replaced by substitution groups - - - - - dummy abstract Peson Data element needed for bi-lingual schema (substitution groups) - - - - - element of signed person datastructure type - - - - - element of signed person datastructure type - - - - - - - - - - - - - - - - - - - element of person type, essential abstract, subsitute PhysicalPerson or CorporateBody instead or use with xsi:type="..." - - - - - - element of physical person type, dreived from Person (abstract) - - - - - element of physical person type, dreived from Person (abstract) - - - - - element of corporate body type, derived from Person - - - - - element of corporate body type, derived from Person - - - - - - data related to the person's name - - - - - data related to the person's name - - - - - Former name, Artist name, changes of Given name ..., compare AlternativName - - - - - - - - - - - - relatives (parents, ...), compare Verwandter - - - - - - type of the relationship, compare Verwandschftsgrad - - - - - - - - - - element of address type, essentially abstract. Use InternetAddress, TelephoneAddress, PostalAddress, TypedPostalAddress instead, or use Address with xsi:type Attribute - - - - - Postal or ZMR Address, compare PostAdresse - - - - - Postal or ZMR Address, compare PostAdresse - - - - - Typed Postal or ZMR Address, compare TypisiertePostAdresse - - - - - InternetAdress such as e-mail or website, compare InternetAdresse - - - - - Typed TelephoneAddress, compare TelefonAdresse - - - - - National or international bank connection, compare Bankverbindung - - - - - - possibility to include common austrian primary keys in human readable way, english translation not available - - - - - - - - - - - - - - - - - - - - - - - - Ergänzungsregister für nicht-natürliche Personen (CorporateBody) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - teletyper or telephone for the hearing impaired - - - - - - status of a person in the cycle of life, compare Familienstand - - - - - gender, comapre Geschlecht - - - - - date of birth, compare Geburtsdatum - - - - - date of death, compare Sterbedatum - - - - - place of birth, compare Geburtsort - - - - - country of birth, compare Geburtsland - - - - - state of birth, comapre Geburtsbundesland - - - - - nationality of Person, compare Staatsangehoerigkeit. attention! New Fomrat is complex, string value accepted for compatibility only - - - - - confession (religion) of Person - xs:token? gibt es wirklich keine Staaten mit Leerzeichen im Namen? - - - - - occupation, compare Beruf - - - - - - compare InternationalerLaendercode - - - - - compare NationalNummer - - - - - compare Vorwahl - - - - - compare Anschlussnummer - - - - - Complete number, ready formated - e.g. +43 1 5131345 4664 compare FormatierteNummer - - - - - compare Klappe - - - - - unique identifier - - - - - - signed person datastructure. The first Identification elements (from the base type) denote the record as such (e.g. database key for this record) - not to be mistaken for identifiers of the person or of an address (they have their own Identification elements). - - - - - - - - - one or more electronic signatures applied on fields above - - - - - container for your Information needs. Contained Elements must reside in a different Namespace - - - - - - any additional properties - - - - - - - - - - - - signed person datastructure. The first Identification elements (from the base type) denote the record as such (e.g. database key for this record) - not to be mistaken for identifiers of the person or of an address (they have their own Identification elements). - - - - - - - - - one or more electronic signatures applied on fields above - - - - - container for your Information needs. Contained Elements must reside in a different Namespace - - - - - - any additional properties - - - - - - - - - - - - - - - - - unique identifier - - - - - actual value of the identifier. - - - - - - - - - - - - type of value (eg 'ZMR', 'SV-Nummer', 'Martrikelnummer', database identification, ...) - - - - - authority, which is reponsible for generation of the identifier (eg university in case of 'MatrikelNummer') - - - - - any additional properties - - - - - - - - - main structure of person data - - - - - unique identification entities - - - - - - - - - - physical person, compare NatuerlichePersonTyp - - - - - - - - - - - - - - - - - - - - - any additional properties - - - - - - - - - physical person, compare NatuerlichePersonTyp - - - - - - - - - - - - - any additional properties - - - - - - - - - juridical person, organisation, compare NichtNatuerlichePersonTyp - - - - - - - URI pointing to a predefined Class of CorporateBodies, compare Typ - - - - - name of corporate body (whole name), compare VollerName - - - - - alternative names of corporate body (abbreviations, short name, synonyms, ...), comapre AlternativName - - - - - type of company (eg AG, OHG, ...), URI pointing to predefined LegalForm, compare Rechtsform - - - - - part of an organisation, see also X.500 ou (eg departement, section, branch, ...) , compare Organisation - - - - - - any additional properties - - - - - - - - - juridical person, organisation, compare NichtNatuerlichePersonTyp - - - - - - - URI pointing to a predefined Class of CorporateBodies, compare Typ - - - - - name of corporate body (whole name), compare VollerName - - - - - type of company (eg AG, OHG, ...), URI pointing to predefined LegalForm, compare Rechtsform - - - - - part of an organisation, see also X.500 ou (eg departement, section, branch, ...) , compare Organisation - - - - - any additional properties - - - - - - - - - container for parts of a name, comapre PersonenNameTyp - - - - - Complete Name (including Affixes) of the Person, especially useful for names from different cultural environments - - - - - - - - - - - - - - - - - - - - - Every given name should be contained inside a GivenName Tag. If that is not possible due to dabase contraints, ... putting several given names inside one GivenName Element is acceptable - - - - - A Person in possesion of more than one GivenName frequently preferrs the use of a Name other than the first GivenName - - - - - MiddleNames are not commonly found in central Europe. The field is mainly for compatibility reasons - - - - - Every family name should be contained inside a FamilyName Tag. If that is not possible due to dabase contraints, ... putting several family names inside one FamilyName Element is acceptable - - - - - - - - - - - - - - - - - - - - - Inlcudes all Information that is not exactly a name: academic or aristocratic titles, ... the new position attribute can contain a suffx or prefix value - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - container for parts of a name, comapre PersonenNameTyp - - - - - Every given name should be contained inside a GivenName Tag. If that is not possible due to dabase contraints, ... putting several given names inside one GivenName Element is acceptable - - - - - Every family name should be contained inside a FamilyName Tag. If that is not possible due to dabase contraints, ... putting several family names inside one FamilyName Element is acceptable - - - - - - - - - - - - - - - - - - - - - Inlcudes all Information that is not exactly a name: academic or aristocratic titles, ... the new position attribute can contain a suffx or prefix value - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - comapre, StaatsangehoerigkeitTyp - - - - - - - - - - - - - - - - - - compare BankverbindungTyp - - - - - Account holder, compare Inhaber - - - - - compare BankName - - - - - - compare NationaleBankverbindung - - - - - - compare Kontonummer - - - - - compare BLZ - - - - - - - - compare InternationaleBankverbindung - - - - - - compare IBAN - - - - - comapre BIC - - - - - - - - - - - main structure of address data - - - - - unique identification entities - - - - - - - - - postal address with type information, compare TypisiertePostAdresseTyp - - - - - - - type of address - category (eg 'Wohnsitz', 'Zentrale', ...) - - - - - - any additional properties - - - - - - - - - compare PostAdresseTyp - - - - - - - Code for the country, use ISO or internatinal Postalstandard, compare Staatscode - - - - - - - - - - Name of the country, use ISO Name, or international Postal Standard, compare Staatsname - - - - - ZIP, compare Postleitzahl - - - - - compare Region - - - - - compare Bundesland - - - - - compare Gemeinde - - - - - compare Gemeindekennzahl - - - - - ZMR use, compare Ortschaft - - - - - ZMR use, comapre OrtschaftZweisprachig - - - - - - - - - - - - - - zmr use only - - - - - zmr use only - - - - - - Addressregister database keys used to identify Addresses - - - - - - - - - - - - - - - If Addressis used outside of PersonData a recipient can be specified - - - - - - - - rather OrganizationUnit e.G Sales Departement - - - - - e.g. Smith Ltd - - - - - - - - - - - - - - - - - - - - - - compare PostAdresseTyp - - - - - - - Code for the country, use ISO or internatinal Postalstandard, compare Staatscode - - - - - - - - - - Name of the country, use ISO Name, or international Postal Standard, compare Staatsname - - - - - ZIP, compare Postleitzahl - - - - - compare Gemeinde - - - - - - - - if streetname not available use name of Ortschaft - - - - - - - - - - - - - - - - - - - - - - - - - e.g. e-mail, webiste, compare InternetAdresseTyp - - - - - - - certificate for secure communication - - - - - URI: email-Address, Web, FTP, LDAP, ..., comapre Adress - - - - - any additional properties - - - - - - - - - phone numbers, conmpare TelephoneAdresseTyp - - - - - - - type of phononumber - category (eg 'Festnetz', 'Mobile', 'fax', ...) - - - - - phonenumber - - - - - any additional properties - - - - - - - - - like TelephoneAddresseType but with additional smsEnabled attribute - - - - - - - - - - formated number or set of telephone number parts - - - - - - - - - set of telephone number parts - - - - - - - - - - - - - simple type for sex (gender) of person - - - - - - - - - - simple type for dates (union), which may omit day and/or month - - - - - - simple type for dates (union), which may omit day and/or month - - - - - - simple type for marital status of a person - - - - - - - - - - - pattern type for enlargement of type definitions. Contents as follows -x:sometext or 12345 or _ or other symbols - - - - - - - - - known relations (family + functional) - - - - - - - - - - - - - - - - known + any other relation - - - - - - known types of alternative names - - - - - - - - - - - - known + any other alternative name types - - - - - - - zmr use only - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/PersonName-1_2.xsd b/common/src/resources/resources/schemas/PersonName-1_2.xsd deleted file mode 100644 index 347ed3d7f..000000000 --- a/common/src/resources/resources/schemas/PersonName-1_2.xsd +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/PostalAddress-1_2.xsd b/common/src/resources/resources/schemas/PostalAddress-1_2.xsd deleted file mode 100644 index b3d89abbb..000000000 --- a/common/src/resources/resources/schemas/PostalAddress-1_2.xsd +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/TelcomNumber-1_0.xsd b/common/src/resources/resources/schemas/TelcomNumber-1_0.xsd deleted file mode 100644 index f89702aeb..000000000 --- a/common/src/resources/resources/schemas/TelcomNumber-1_0.xsd +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/XMLSchema-instance.xsd b/common/src/resources/resources/schemas/XMLSchema-instance.xsd deleted file mode 100644 index f47577b8a..000000000 --- a/common/src/resources/resources/schemas/XMLSchema-instance.xsd +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - -]> - - - -

          XML Schema instance namespace

          -

          See the XML Schema - Recommendation for an introduction

          - - -
          - $Date: 2001/03/16 20:25:57 $
          - $Id: XMLSchema-instance.xsd,v 1.4 2001/03/16 20:25:57 ht Exp $ -
          -
          - -

          This schema should never be used as such: - the XML - Schema Recommendation forbids the declaration of - attributes in this namespace

          -
          -
          - - - - - -
          diff --git a/common/src/resources/resources/schemas/XMLSchema.dtd b/common/src/resources/resources/schemas/XMLSchema.dtd deleted file mode 100644 index e8e8f7625..000000000 --- a/common/src/resources/resources/schemas/XMLSchema.dtd +++ /dev/null @@ -1,402 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -%xs-datatypes; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/cs-sstc-schema-assertion-01.xsd b/common/src/resources/resources/schemas/cs-sstc-schema-assertion-01.xsd deleted file mode 100644 index 8bc5af147..000000000 --- a/common/src/resources/resources/schemas/cs-sstc-schema-assertion-01.xsd +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - Document identifier: cs-sstc-schema-assertion-01 - Location: http://www.oasis-open.org/committees/security/docs/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/cs-sstc-schema-protocol-01.xsd b/common/src/resources/resources/schemas/cs-sstc-schema-protocol-01.xsd deleted file mode 100644 index ecad05b0f..000000000 --- a/common/src/resources/resources/schemas/cs-sstc-schema-protocol-01.xsd +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - Document identifier: cs-sstc-schema-protocol-01 - Location: http://www.oasis-open.org/committees/security/docs/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/datatypes.dtd b/common/src/resources/resources/schemas/datatypes.dtd deleted file mode 100644 index 8e48553be..000000000 --- a/common/src/resources/resources/schemas/datatypes.dtd +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/exclusive-canonicalization.xsd b/common/src/resources/resources/schemas/exclusive-canonicalization.xsd deleted file mode 100644 index d4a2d82ec..000000000 --- a/common/src/resources/resources/schemas/exclusive-canonicalization.xsd +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/common/src/resources/resources/schemas/xml.xsd b/common/src/resources/resources/schemas/xml.xsd deleted file mode 100644 index 79dbc02ba..000000000 --- a/common/src/resources/resources/schemas/xml.xsd +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - See http://www.w3.org/XML/1998/namespace.html and - http://www.w3.org/TR/REC-xml for information about this namespace. - - - - - This schema defines attributes and an attribute group - suitable for use by - schemas wishing to allow xml:base, xml:lang or xml:space attributes - on elements they define. - - To enable this, such a schema must import this schema - for the XML namespace, e.g. as follows: - <schema . . .> - . . . - <import namespace="http://www.w3.org/XML/1998/namespace" - schemaLocation="http://www.w3.org/2001/03/xml.xsd"/> - - Subsequently, qualified reference to any of the attributes - or the group defined below will have the desired effect, e.g. - - <type . . .> - . . . - <attributeGroup ref="xml:specialAttrs"/> - - will define a type which will schema-validate an instance - element with any of those attributes - - - - In keeping with the XML Schema WG's standard versioning - policy, this schema document will persist at - http://www.w3.org/2001/03/xml.xsd. - At the date of issue it can also be found at - http://www.w3.org/2001/xml.xsd. - The schema document at that URI may however change in the future, - in order to remain compatible with the latest version of XML Schema - itself. In other words, if the XML Schema namespace changes, the version - of this document at - http://www.w3.org/2001/xml.xsd will change - accordingly; the version at - http://www.w3.org/2001/03/xml.xsd will not change. - - - - - - In due course, we should install the relevant ISO 2- and 3-letter - codes as the enumerated possible values . . . - - - - - - - - - - - - - - - See http://www.w3.org/TR/xmlbase/ for - information about this attribute. - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/xmldsig-core-schema.xsd b/common/src/resources/resources/schemas/xmldsig-core-schema.xsd deleted file mode 100644 index a7e302373..000000000 --- a/common/src/resources/resources/schemas/xmldsig-core-schema.xsd +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/src/resources/resources/schemas/xmldsig-filter2.xsd b/common/src/resources/resources/schemas/xmldsig-filter2.xsd deleted file mode 100644 index 330eafd19..000000000 --- a/common/src/resources/resources/schemas/xmldsig-filter2.xsd +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file -- cgit v1.2.3 From 4e12d1df5daab1f7600fa3a58e6fc535375224ff Mon Sep 17 00:00:00 2001 From: pdanner Date: Mon, 10 Sep 2007 15:16:34 +0000 Subject: moved test classes, cashing of resolved entities git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1002 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../at/gv/egovernment/moa/util/StreamUtils.java | 45 ++++++ .../java/test/at/gv/egovernment/moa/AllTests.java | 38 +++++ .../test/at/gv/egovernment/moa/MOATestCase.java | 75 ++++++++++ .../at/gv/egovernment/moa/util/DOMUtilsTest.java | 137 ++++++++++++++++++ .../gv/egovernment/moa/util/DateTimeUtilsTest.java | 104 ++++++++++++++ .../gv/egovernment/moa/util/KeyStoreUtilsTest.java | 90 ++++++++++++ .../at/gv/egovernment/moa/util/SSLUtilsTest.java | 160 +++++++++++++++++++++ .../at/gv/egovernment/moa/util/URLDecoderTest.java | 29 ++++ .../at/gv/egovernment/moa/util/URLEncoderTest.java | 43 ++++++ .../moa/util/XMLGrammarBuilderTest.java | 99 +++++++++++++ .../at/gv/egovernment/moa/util/XPathUtilsTest.java | 51 +++++++ 11 files changed, 871 insertions(+) create mode 100644 common/src/test/java/test/at/gv/egovernment/moa/AllTests.java create mode 100644 common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java create mode 100644 common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java create mode 100644 common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java create mode 100644 common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java create mode 100644 common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java create mode 100644 common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java create mode 100644 common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java create mode 100644 common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java create mode 100644 common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java index a22f1c2a8..3b1a6b56b 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java @@ -3,6 +3,7 @@ package at.gv.egovernment.moa.util; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import java.io.PrintStream; /** @@ -88,10 +89,17 @@ public class StreamUtils { * @throws IOException on any exception thrown */ public static byte[] readStream(InputStream in) throws IOException { + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + copyStream(in, out, null); + + /* ByteArrayOutputStream out = new ByteArrayOutputStream(); int b; while ((b = in.read()) >= 0) out.write(b); + + */ in.close(); return out.toByteArray(); } @@ -106,14 +114,51 @@ public class StreamUtils { * @throws IOException on any exception thrown */ public static String readStream(InputStream in, String encoding) throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + copyStream(in, out, null); + + /* ByteArrayOutputStream out = new ByteArrayOutputStream(); int b; while ((b = in.read()) >= 0) out.write(b); + */ in.close(); return out.toString(encoding); } + /** + * Reads all data (until EOF is reached) from the given source to the + * destination stream. If the destination stream is null, all data is dropped. + * It uses the given buffer to read data and forward it. If the buffer is + * null, this method allocates a buffer. + * + * @param source The stream providing the data. + * @param destination The stream that takes the data. If this is null, all + * data from source will be read and discarded. + * @param buffer The buffer to use for forwarding. If it is null, the method + * allocates a buffer. + * @exception IOException If reading from the source or writing to the + * destination fails. + */ + private static void copyStream(InputStream source, OutputStream destination, byte[] buffer) throws IOException { + if (source == null) { + throw new NullPointerException("Argument \"source\" must not be null."); + } + if (buffer == null) { + buffer = new byte[8192]; + } + + if (destination != null) { + int bytesRead; + while ((bytesRead = source.read(buffer)) >= 0) { + destination.write(buffer, 0, bytesRead); + } + } else { + while (source.read(buffer) >= 0); + } + } + /** * Gets the stack trace of the Throwable passed in as a string. * @param t The Throwable. diff --git a/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java b/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java new file mode 100644 index 000000000..00e2c505f --- /dev/null +++ b/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java @@ -0,0 +1,38 @@ +package test.at.gv.egovernment.moa; + +import test.at.gv.egovernment.moa.util.DOMUtilsTest; +import test.at.gv.egovernment.moa.util.DateTimeUtilsTest; +import test.at.gv.egovernment.moa.util.KeyStoreUtilsTest; +import test.at.gv.egovernment.moa.util.SSLUtilsTest; +import test.at.gv.egovernment.moa.util.XPathUtilsTest; + +import junit.awtui.TestRunner; +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * @author patrick + * @version $Id$ + */ +public class AllTests { + + public static Test suite() { + TestSuite suite = new TestSuite(); + + suite.addTestSuite(DOMUtilsTest.class); + suite.addTestSuite(DateTimeUtilsTest.class); + suite.addTestSuite(XPathUtilsTest.class); + suite.addTestSuite(KeyStoreUtilsTest.class); + suite.addTestSuite(SSLUtilsTest.class); + + return suite; + } + + public static void main(String[] args) { + try { + TestRunner.run(AllTests.class); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java b/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java new file mode 100644 index 000000000..86ea2ee6c --- /dev/null +++ b/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java @@ -0,0 +1,75 @@ +package test.at.gv.egovernment.moa; + +import java.io.FileInputStream; +import java.io.StringReader; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Document; + +import org.xml.sax.InputSource; + +import junit.framework.TestCase; + +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; + +/** + * Base class for MOA test cases. + * + * Provides some utility functions. + * + * @author Patrick Peck + * @version $Id$ + */ +public class MOATestCase extends TestCase { + + protected static final String TESTDATA_ROOT = "data/test/"; + + /** + * Constructor for MOATestCase. + * @param arg0 + */ + public MOATestCase(String name) { + super(name); + } + + /** + * Parse an XML file non-validating. + */ + public static Document parseXml(String fileName) throws Exception { + return DOMUtils.parseDocument( + new FileInputStream(fileName), + false, + null, + null); + } + + /** + * Parse an XML validating with a given file name. + * + * Uses the local schema resources. + */ + public static Document parseXmlValidating(String fileName) throws Exception { + return DOMUtils.parseDocument( + new FileInputStream(fileName), + true, + Constants.ALL_SCHEMA_LOCATIONS, + null); + } + + /** + * Parse an XML from a String. + */ + public static Document parseXmlString(String xml) throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder; + + factory.setNamespaceAware(true); + builder = factory.newDocumentBuilder(); + + return builder.parse(new InputSource(new StringReader(xml))); + } + +} diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java new file mode 100644 index 000000000..eb3ad1a5c --- /dev/null +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java @@ -0,0 +1,137 @@ +package test.at.gv.egovernment.moa.util; +import java.io.FileInputStream; +import java.util.Map; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import test.at.gv.egovernment.moa.*; + +import at.gv.egovernment.moa.util.Constants; +import at.gv.egovernment.moa.util.DOMUtils; + +/** + * @author Patrick Peck + * @version $Id$ + */ +public class DOMUtilsTest extends MOATestCase { + private static final String TESTDATA_BASE = TESTDATA_ROOT + "xml/"; + private static boolean grammarsInitialized = false; + + /** + * Constructor for DOMUtilsTest. + * @param name + */ + public DOMUtilsTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + if (!grammarsInitialized) { + // preparse XML schema + DOMUtils.addSchemaToPool( + getClass().getResourceAsStream(Constants.XML_SCHEMA_LOCATION), + Constants.XML_NS_URI); + // preparse XMLDsig Filter2 schema + DOMUtils.addSchemaToPool( + getClass().getResourceAsStream(Constants.DSIG_FILTER2_SCHEMA_LOCATION), + Constants.DSIG_FILTER2_NS_URI); + // preparse XMLDsig schema + DOMUtils.addSchemaToPool( + getClass().getResourceAsStream(Constants.DSIG_SCHEMA_LOCATION), + Constants.DSIG_NS_URI); + // preparse MOA schema + DOMUtils.addSchemaToPool( + getClass().getResourceAsStream(Constants.MOA_SCHEMA_LOCATION), + Constants.MOA_NS_URI); + grammarsInitialized = true; + } + } + + private Document parse(String fileName) throws Exception { + return DOMUtils.parseDocument( + new FileInputStream(fileName), + true, + Constants.ALL_SCHEMA_LOCATIONS, + null); + } + + public void testParseCreateXMLSignature() throws Exception { + parse(TESTDATA_BASE + "CreateXMLSignature/TestGeneratorCX2.005.Req.xml"); + parse(TESTDATA_BASE + "CreateXMLSignature/Req000.xml"); + parse(TESTDATA_BASE + "CreateXMLSignature/Req001.xml"); + parse(TESTDATA_BASE + "CreateXMLSignature/Req002.xml"); + parse(TESTDATA_BASE + "CreateXMLSignature/Req004.xml"); + } + + public void testParseVerifyCMSSignature() throws Exception { + parse(TESTDATA_BASE + "VerifyCMSSignature/Req000.xml"); + } + + public void testParseVerifyXMLSignature() throws Exception { + parse(TESTDATA_BASE + "VerifyXMLSignature/Req000.xml"); + parse(TESTDATA_BASE + "VerifyXMLSignature/Req001.xml"); + parse(TESTDATA_BASE + "VerifyXMLSignature/Req002.xml"); + parse(TESTDATA_BASE + "VerifyXMLSignature/TestGeneratorVX.002.Req.xml"); + //parse(TESTDATA_BASE + "VerifyXMLSignature/TestGeneratorVX.006.Req.xml"); + parse(TESTDATA_BASE + "VerifyXMLSignature/VerifySAMLRequest.xml"); + } + + public void testParseInfobox() throws Exception { + parse(TESTDATA_BASE + "Infobox/InfoboxReadResponseMOA4.xml"); + parse(TESTDATA_BASE + "Infobox/InfoboxReadResponse.xml"); + } + + + private Document parsePlain(String fileName) throws Exception { + return DOMUtils.parseDocument( + new FileInputStream(fileName), + false, + null, + null); + } + + public void testValidateCreateXMLSignature() throws Exception { + Document doc; + boolean valid; + + // test a valid request + doc = parsePlain(TESTDATA_BASE + "CreateXMLSignature/Req000.xml"); + valid = + DOMUtils.validateElement( + doc.getDocumentElement(), + Constants.ALL_SCHEMA_LOCATIONS, + null); + assertTrue(valid); + + // test an invalid request + doc = parsePlain(TESTDATA_BASE + "CreateXMLSignature/invalid.xml"); + try { + valid = + DOMUtils.validateElement( + doc.getDocumentElement(), + Constants.ALL_SCHEMA_LOCATIONS, + null); + fail(); + } catch (Exception e) { + } + } + + public void testGetNamespaceDeclarations() throws Exception { + Document doc; + NodeList nl; + Element elem; + Map nsDecls; + + doc = parse(TESTDATA_BASE + "VerifyXMLSignature/Req002.xml"); + nl = doc.getElementsByTagNameNS(Constants.DSIG_NS_URI, "Reference"); + elem = (Element) nl.item(0); + nsDecls = DOMUtils.getNamespaceDeclarations(elem); + + assertEquals(2, nsDecls.size()); + assertEquals(Constants.DSIG_NS_URI, nsDecls.get("dsig")); + assertEquals(Constants.MOA_NS_URI, nsDecls.get("")); + } + +} diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java new file mode 100644 index 000000000..da6b29b1c --- /dev/null +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java @@ -0,0 +1,104 @@ +package test.at.gv.egovernment.moa.util; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +import junit.framework.TestCase; + +import at.gv.egovernment.moa.util.DateTimeUtils; + +/** + * @author Patrick Peck + * @version $Id$ + */ +public class DateTimeUtilsTest extends TestCase { + + /** + * Constructor for DateTimeUtilsTest. + * @param arg0 + */ + public DateTimeUtilsTest(String arg0) { + super(arg0); + } + + public void testParseDateTimeValid() throws Exception { + Date date; + DateFormat format = SimpleDateFormat.getDateTimeInstance(); + String dateStr; + + format.setTimeZone(TimeZone.getTimeZone("GMT")); + date = DateTimeUtils.parseDateTime("+1971-12-12T06:30:15"); + date.setTime(date.getTime() + TimeZone.getDefault().getRawOffset()); + dateStr = format.format(date); + assertEquals("12.12.1971 06:30:15", dateStr); + + date = DateTimeUtils.parseDateTime("2000-01-01T23:59:59.012Z"); + dateStr = format.format(date); + assertEquals("01.01.2000 23:59:59", dateStr); + + date = DateTimeUtils.parseDateTime("2003-05-20T12:17:30-05:00"); + dateStr = format.format(date); + assertEquals("20.05.2003 17:17:30", dateStr); + + + date = DateTimeUtils.parseDateTime("2002-02-02T02:02:02.33+04:30"); + dateStr = format.format(date); + assertEquals("01.02.2002 21:32:02", dateStr); + } + + public void testParseDateTimeInvalid() { + try { + DateTimeUtils.parseDateTime("+1971-12-12T6:30:15"); + fail(); + } catch (ParseException e) { + } + + try { + DateTimeUtils.parseDateTime("2000-01-0123:59:59.999999Z"); + fail(); + } catch (ParseException e) { + } + + try { + DateTimeUtils.parseDateTime("2003-05-20T12:17:3005:00"); + fail(); + } catch (ParseException e) { + } + + try { + DateTimeUtils.parseDateTime(" 2002-02-02T02:02:02.33+04:00"); + fail(); + } catch (ParseException e) { + } + + } + + public void testBuildDateTimeGMTMinus3() { + String should = "2002-01-01T01:01:01-03:00"; + doTestBuildDateTime(2002, 1, 1, 1, 1, 1, "GMT-03:00", should); + } + public void testBuildDateTimeMEZSommerzeit() { + String should = "2002-07-31T23:59:59+02:00"; + doTestBuildDateTime(2002, 7, 31, 23, 59, 59, "GMT+01:00", should); + } + public void testBuildDateTimeGMT() { + String should = "2002-01-01T01:01:01"; + doTestBuildDateTime(2002, 1, 1, 1, 1, 1, "GMT+00:00", should); + } + private void doTestBuildDateTime( + int year, int month, int day, + int hour, int min, int sec, + String timeZone, String dateTimeShould) { + + Calendar cal = new GregorianCalendar(TimeZone.getTimeZone(timeZone)); + cal.set(year,month, day, hour, min, sec); + cal.set(Calendar.MILLISECOND, 0); + String dateTimeBuilt = DateTimeUtils.buildDateTime(cal); + assertEquals(dateTimeShould, dateTimeBuilt); + } + +} diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java new file mode 100644 index 000000000..a6d1847ce --- /dev/null +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java @@ -0,0 +1,90 @@ +package test.at.gv.egovernment.moa.util; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.math.BigInteger; +import java.security.KeyStore; +import java.security.Security; +import java.security.cert.X509Certificate; +import java.util.Enumeration; + +import at.gv.egovernment.moa.util.KeyStoreUtils; + +import junit.framework.TestCase; + +/** + * @author Paul Ivancsics + * @version $Id$ + */ +public class KeyStoreUtilsTest extends TestCase { + private String tmpDir = "tmp/KeyStoreUtilsTest"; + private String tmpDirURL = "file:" + tmpDir; + + public KeyStoreUtilsTest(String arg0) { + super(arg0); + } + + protected void setUp() throws Exception { + Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + new File(tmpDir).mkdirs(); + } + protected void tearDown() throws Exception { + new File(tmpDir).delete(); + } + public void testCreateKeyStoreJKS() throws Exception { + String[] certFilenames = new String[] { + "data/test/security/server-certs/baltimore.cer" + }; + KeyStore ks = KeyStoreUtils.createKeyStore("jks", certFilenames); + assertEquals(1, ks.size()); + X509Certificate cert = (X509Certificate)ks.getCertificate("0"); + assertEquals(3424, cert.getSerialNumber().intValue()); + } + public void testCreateKeyStorePKCS12() throws Exception { + String[] certFilenames = new String[] { + "data/test/security/server-certs/baltimore.cer" + }; + KeyStore ks = KeyStoreUtils.createKeyStore("pkcs12", certFilenames); + assertEquals(1, ks.size()); + X509Certificate cert = (X509Certificate)ks.getCertificate("0"); + assertEquals(3424, cert.getSerialNumber().intValue()); + } + public void testCreateKeyStoreFromCertificateDirectory() throws Exception { + // copy certificate files to a temporary directory, + // omitting the "CVS" directory in the source directory + copyCertificates("data/test/security/server-certs", tmpDir); + KeyStore ks = KeyStoreUtils.createKeyStoreFromCertificateDirectory("jks", tmpDirURL); + assertEquals(2, ks.size()); + X509Certificate cert0 = (X509Certificate)ks.getCertificate("0"); + X509Certificate cert1 = (X509Certificate)ks.getCertificate("1"); + assertTrue(3424 == cert0.getSerialNumber().intValue() || 3424 == cert1.getSerialNumber().intValue()); + } + private void copyCertificates(String from, String to) throws IOException { + String[] fromList = new File(from).list(); + for (int i = 0; i < fromList.length; i++) { + File fromFile = new File(from + File.separator + fromList[i]); + if (fromFile.isFile()) { + String toFile = to + "/" + fromList[i]; + FileInputStream in = new FileInputStream(fromFile); + FileOutputStream out = new FileOutputStream(toFile); + for (int ch = in.read(); ch >= 0; ch = in.read()) + out.write(ch); + out.close(); + in.close(); + } + } + + } + public void testLoadKeyStore() throws Exception { + String keyStoreURL = "file:data/test/security/client-certs/sicher-demo(buergerkarte).p12"; + KeyStore ks = KeyStoreUtils.loadKeyStore("pkcs12", keyStoreURL, "buergerkarte"); + assertEquals(1, ks.size()); + Enumeration aliases = ks.aliases(); + String alias = (String)aliases.nextElement(); + X509Certificate cert = (X509Certificate)ks.getCertificate(alias); + assertEquals(new BigInteger("1044289238331").intValue(), cert.getSerialNumber().intValue()); + } + +} diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java new file mode 100644 index 000000000..7e55cb7d0 --- /dev/null +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java @@ -0,0 +1,160 @@ +package test.at.gv.egovernment.moa.util; + +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.security.KeyStore; +import java.security.Security; + +import javax.net.ssl.SSLException; +import javax.net.ssl.SSLSocketFactory; + +import com.sun.net.ssl.HostnameVerifier; +import com.sun.net.ssl.HttpsURLConnection; + +import at.gv.egovernment.moa.util.KeyStoreUtils; +import at.gv.egovernment.moa.util.SSLUtils; + +import junit.framework.TestCase; + +/** + * @author Paul Ivancsics + * @version $Id$ + */ +public class SSLUtilsTest extends TestCase { + + public SSLUtilsTest(String arg0) { + super(arg0); + } + + + protected void setUp() throws Exception { + //System.setProperty("javax.net.debug", "all"); + Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); + System.setProperty("https.cipherSuites", "SSL_DHE_DSS_WITH_DES_CBC_SHA,SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA,SSL_RSA_WITH_DES_CBC_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_RSA_EXPORT_WITH_RC4_40_MD5"); + } + + public void testGetSSLSocketFactoryBaltimoreOK() throws Exception { + doTestGetSSLSocketFactory( + "GET", + "https://www.baltimore.com/", + false, + "file:data/test/security/cacerts+gt_cybertrust_root", + "changeit", + true); + } + public void testGetSSLSocketFactoryBaltimoreNOK() throws Exception { + doTestGetSSLSocketFactory( + "GET", + "https://www.baltimore.com/", + false, + "file:data/test/security/cacerts", + "changeit", + false); + } + public void testGetSSLSocketFactoryVerisignOK() throws Exception { + doTestGetSSLSocketFactory( + "GET", + "https://www.verisign.com/", + false, + "file:data/test/security/cacerts", + "changeit", + true); + } + public void testGetSSLSocketFactoryVerisignNoTruststoreOK() throws Exception { + doTestGetSSLSocketFactory( + "GET", + "https://www.verisign.com/", + false, + null, + null, + true); + } + public void testGetSSLSocketFactoryLocalhostOK() throws Exception { + String urlString = "https://localhost:8443/moa-id-auth/index.jsp"; + doTestGetSSLSocketFactory( + "GET", + urlString, + true, + "file:data/test/security/server.keystore.tomcat", + "changeit", + true); + } + public void testGetSSLSocketFactoryLocalhostNOK() throws Exception { + String urlString = "https://localhost:8443/moa-id-auth/index.jsp"; + doTestGetSSLSocketFactory( + "GET", + urlString, + true, + null, + null, + false); + } + + public void doTestGetSSLSocketFactory( + String requestMethod, + String urlString, + boolean useHostnameVerifierHack, + String truststoreurl, + String trustpassword, + boolean shouldOk + ) throws Exception { + + doTestGetSSLSocketFactory( + requestMethod, urlString, useHostnameVerifierHack, truststoreurl, trustpassword, null, null, null, shouldOk); + } + public void doTestGetSSLSocketFactory( + String requestMethod, + String urlString, + boolean useHostnameVerifierHack, + String truststoreurl, + String trustpassword, + String keystoretype, + String keystoreurl, + String keypassword, + boolean shouldOk + ) throws Exception { + + KeyStore truststore = null; + if (truststoreurl != null) + truststore = KeyStoreUtils.loadKeyStore("jks", truststoreurl, trustpassword); + SSLSocketFactory sf = SSLUtils.getSSLSocketFactory( + truststore, keystoretype, keystoreurl, keypassword); + System.out.println(requestMethod + " " + urlString); + + URL url = new URL(urlString); + HttpsURLConnection conn = (HttpsURLConnection)url.openConnection(); + conn.setRequestMethod(requestMethod); + conn.setDoInput(true); + conn.setDoOutput(true); + conn.setUseCaches(false); + conn.setAllowUserInteraction(false); + conn.setSSLSocketFactory(sf); + if (useHostnameVerifierHack) + conn.setHostnameVerifier(new HostnameVerifierHack()); + try { + conn.connect(); + assertTrue(shouldOk); + assertEquals(200, conn.getResponseCode()); + conn.disconnect(); + } + catch (SSLException ex) { + assertFalse(shouldOk); + } + } + private byte[] readTruststore(String filename) throws IOException { + if (filename == null) + return null; + FileInputStream in = new FileInputStream(filename); + byte[] buffer = new byte[in.available()]; + in.read(buffer); + in.close(); + return buffer; + } + private class HostnameVerifierHack implements HostnameVerifier { + public boolean verify(String arg0, String arg1) { + return true; + } + } +} diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java new file mode 100644 index 000000000..b6ea0e152 --- /dev/null +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java @@ -0,0 +1,29 @@ +package test.at.gv.egovernment.moa.util; + +import java.net.URLEncoder; + +import at.gv.egovernment.moa.util.FileUtils; +import at.gv.egovernment.moa.util.URLDecoder; + +import junit.framework.TestCase; + +/* + * @author Paul Ivancsics + * @version $Id$ + */ +public class URLDecoderTest extends TestCase { + + public void test() throws Exception { + String s = "immerZUA0129<>%==$$%&/()@?{()=} \\\"äöüÄÖÜ?§"; + String senc = URLEncoder.encode(s); + String sdec = URLDecoder.decode(senc, "ISO-8859-1"); + assertEquals(s, sdec); + } + public void testUTF8() throws Exception { + String s = new String(FileUtils.readFile("data/test/xml/CreateXMLSignature/CreateXMLSignatureResponse.xml")); + String senc = URLEncoder.encode(s); + String sdec = URLDecoder.decode(senc, "UTF-8"); + String sutf8 = FileUtils.readFile("data/test/xml/CreateXMLSignature/CreateXMLSignatureResponse.xml", "UTF-8"); + assertEquals(sutf8, sdec); + } +} diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java new file mode 100644 index 000000000..43238c51f --- /dev/null +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java @@ -0,0 +1,43 @@ +package test.at.gv.egovernment.moa.util; + +import at.gv.egovernment.moa.util.FileUtils; +import at.gv.egovernment.moa.util.URLDecoder; +import at.gv.egovernment.moa.util.URLEncoder; +import junit.framework.TestCase; + +/* + * @author Paul Ivancsics + * @version $Id$ + */ +public class URLEncoderTest extends TestCase { + + public void testUnchangedString() throws Exception { + String s = "AZaz0123456789.-*_"; + String senc = URLEncoder.encode(s, "UTF-8"); + assertEquals(s, senc); + } + public void testAumlUTF8() throws Exception { + String s = "ä"; + String senc = URLEncoder.encode(s, "UTF-8"); + assertEquals("%C3%A4", senc); + } + public void testEncodeDecode() throws Exception { + String s = "AZaz09.-*_ <>%=$%&/()@?{}[]\\\"'äöüÄÖÜߧ"; + String senc = URLEncoder.encode(s, "UTF-8"); + String sdec = URLDecoder.decode(senc, "UTF-8"); + assertEquals(s, sdec); + } + public void testCertInfo() throws Exception { + String s = new String(FileUtils.readFile("data/test/xml/VerifyXMLSignature/CertInfoVerifyXMLSignatureRequest.xml", "UTF-8")); + String senc = URLEncoder.encode(s, "UTF-8"); + String sdec = URLDecoder.decode(senc, "UTF-8"); + assertEquals(s, sdec); + } + /*public void testJDK14() throws Exception { + String s = new String(FileUtils.readFile("data/test/xml/VerifyXMLSignature/CertInfoVerifyXMLSignatureRequest.xml", "UTF-8")); + String senc = URLEncoder.encode(s, "UTF-8"); + String senc14 = java.net.URLEncoder.encode(s, "UTF-8"); + assertEquals(senc, senc14); + }*/ + +} diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java new file mode 100644 index 000000000..7986fe540 --- /dev/null +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java @@ -0,0 +1,99 @@ +package test.at.gv.egovernment.moa.util; +import java.io.FileInputStream; +import java.io.InputStream; + +import org.apache.xerces.parsers.DOMParser; +import org.apache.xerces.parsers.XMLGrammarPreparser; +import org.apache.xerces.util.SymbolTable; +import org.apache.xerces.util.XMLGrammarPoolImpl; +import org.apache.xerces.xni.grammars.Grammar; +import org.apache.xerces.xni.grammars.XMLGrammarDescription; +import org.apache.xerces.xni.parser.XMLInputSource; +import org.xml.sax.InputSource; + +import test.at.gv.egovernment.moa.MOATestCase; + +import at.gv.egovernment.moa.util.Constants; + + +/** + * Experimentation with Xerces grammar caching. + * + * Used the Xerces sample 'XMLGrammarBuilder' as a starting point. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XMLGrammarBuilderTest extends MOATestCase { + + private static final String GRAMMAR_POOL = + org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX + + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; + + protected static final String NAMESPACES_FEATURE_ID = + "http://xml.org/sax/features/namespaces"; + protected static final String VALIDATION_FEATURE_ID = + "http://xml.org/sax/features/validation"; + protected static final String SCHEMA_VALIDATION_FEATURE_ID = + "http://apache.org/xml/features/validation/schema"; + protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID = + "http://apache.org/xml/features/validation/schema-full-checking"; + + private static final int BIG_PRIME = 2039; + private SymbolTable symbolTable; + private XMLGrammarPoolImpl grammarPool; + + /** + * Constructor for XMLGrammarBuilderTest. + * @param name + */ + public XMLGrammarBuilderTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + XMLGrammarPreparser preparser; + + // set up symbol table and grammar pool + symbolTable = new SymbolTable(BIG_PRIME); + grammarPool = new XMLGrammarPoolImpl(); + preparser = new XMLGrammarPreparser(symbolTable); + preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); + preparser.setProperty(GRAMMAR_POOL, grammarPool); + preparser.setFeature(NAMESPACES_FEATURE_ID, true); + preparser.setFeature(VALIDATION_FEATURE_ID, true); + // now we can still do schema features just in case, + // so long as it's our configuraiton...... + preparser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); + preparseSchemaResource( + preparser, + Constants.DSIG_SCHEMA_LOCATION, + "/resources/schemas/xmldsig-core-schema.xsd"); + } + + private static Grammar preparseSchemaResource( + XMLGrammarPreparser preparser, + String systemId, + String resource) + throws Exception { + + InputStream is = XMLGrammarBuilderTest.class.getResourceAsStream(resource); + return preparser.preparseGrammar( + XMLGrammarDescription.XML_SCHEMA, + new XMLInputSource(null, systemId, null, is, null)); + } + + public void testParseValidating() throws Exception { + DOMParser parser = new DOMParser(symbolTable, grammarPool); + + parser.setFeature(NAMESPACES_FEATURE_ID, true); + parser.setFeature(VALIDATION_FEATURE_ID, true); + parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true); + + parser.parse( + new InputSource( + new FileInputStream(TESTDATA_ROOT + "xml/dsigTransform/base64.xml"))); + parser.getDocument(); + } + +} diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java new file mode 100644 index 000000000..559494300 --- /dev/null +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java @@ -0,0 +1,51 @@ +package test.at.gv.egovernment.moa.util; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; + +import test.at.gv.egovernment.moa.MOATestCase; + +import at.gv.egovernment.moa.util.XPathUtils; + + +/** + * @author Patrick Peck + * @version $Id$ + */ +public class XPathUtilsTest extends MOATestCase { + + private Document doc1; + + /** + * Constructor for XPathUtilsTest. + * @param name + */ + public XPathUtilsTest(String name) { + super(name); + } + + /** + * @see TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + doc1 = + parseXml(TESTDATA_ROOT + "xml/VerifyXMLSignature/Req000.xml"); + } + + public void testSelectNodeList() throws Exception { + NodeList nodes; + + nodes = + XPathUtils.selectNodeList( + doc1.getDocumentElement(), + doc1.getDocumentElement(), + "/VerifyXMLSignatureRequest"); + assertEquals(1, nodes.getLength()); + nodes = + XPathUtils.selectNodeList( + doc1.getDocumentElement(), + "//dsig:Signature"); + assertEquals(1, nodes.getLength()); + } + +} -- cgit v1.2.3 From 83f01ddf24d98dbb5df41fb627a14edee2d57df7 Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 17 Oct 2007 16:18:44 +0000 Subject: Implemented and integrated party representation and integrated mandates as per default available Now Eclipse projects are available. The Web Tools Platform can be used to run the web applications git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1014 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/Constants.java | 7 +- .../at/gv/egovernment/moa/util/StringUtils.java | 6 +- .../schemas/MOA-ID-Configuration-1.4.2.xsd | 506 +++++++++++++++++++++ 3 files changed, 514 insertions(+), 5 deletions(-) create mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index 5c1314296..d1edbc38d 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -23,13 +23,16 @@ public interface Constants { public static final String STB_NS_URI = "http://reference.e-government.gv.at/namespace/standardtextblock/20041105#"; - /** Prefix used for the Mandate XML namespace */ + /** Prefix used for the standard text block XML namespace */ public static final String STB_PREFIX = "stb"; /** URI of the MOA XML namespace. */ public static final String MOA_NS_URI = "http://reference.e-government.gv.at/namespace/moa/20020822#"; + /** Name of the mandates infobox */ + public static final String INFOBOXIDENTIFIER_MANDATES = "Mandates"; + /** Prefix used for the Mandate XML namespace */ public static final String MD_PREFIX = "md"; @@ -78,7 +81,7 @@ public interface Constants { /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.4.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.4.2.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java index 61b1a18ea..82c10d90f 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java @@ -87,11 +87,11 @@ public class StringUtils { * Replaces each substring of string s that matches the given * search string by the given replace string. * - * @param s The string where the replacment should take place. + * @param s The string where the replacement should take place. * @param search The pattern that should be replaced. * @param replace The string that should replace all each search * string within s. - * @return A string whrer all occurrence of search are + * @return A string where all occurrence of search are * replaced with replace. */ public static String replaceAll (String s, String search, String replace) @@ -153,7 +153,7 @@ public class StringUtils { * @return XML expression, XML declaration removed */ public static String removeXMLDeclaration(String xmlString) { - if (xmlString.startsWith(" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der + Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der + Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. + Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der + Proxy-Komponente zur Auth-Komponente (vgl. + AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die + Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann + für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA + (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem + Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA + SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der + AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; + wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; + wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben + werden; wird das Element nicht verwendet dann wird MOA-SP über das API + aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der + Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des + AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des + IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per + X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen + + + + + + + das Attribut filename verweist auf eine Datei mit globalem + Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo + werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks + inkludiert + + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + Verifikation zusätzlicher Infoboxen + + + + + Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen + + + + + + + + + + Parameter für Ãœberprüfung weiterer Infoboxen + + + + + + optionalervName, der für Fehlermeldungen verwendet werden soll; + z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird + das Identifier-Attribut verwendet + + + + + TrustProfil, das für die Ãœberprüfung der Infobox + verwendet werden soll + + + + + Validatorklasse, die für die Prüfung der Infobox + verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname + vom Default Package- und Klassennamen abweichen + + + + + + Infobox spezifische Parameter, die der jeweiligen Prüfapplikation + übergeben werden + + + + + + + + + + + + + + + + + + + Spezifiziert die Lage von XML Schemas + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die + Authentisierungs-Komponente betreffen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente + betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der + TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für + die TLS-Client-Authentisierung verwendetwird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 114acd7687c92e9f2202536c6172b10266d7e949 Mon Sep 17 00:00:00 2001 From: pdanner Date: Fri, 19 Oct 2007 07:06:49 +0000 Subject: Enabled more debug information git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1024 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common/src') diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd index 5a87e3fde..43ab377d0 100644 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd @@ -185,6 +185,8 @@ + + -- cgit v1.2.3 From 04c84754f2898848a0ac61f4bf2d4412b6600d19 Mon Sep 17 00:00:00 2001 From: pdanner Date: Fri, 19 Oct 2007 07:18:14 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1025 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd index 43ab377d0..16ff4a564 100644 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd @@ -186,7 +186,7 @@ - + -- cgit v1.2.3 From de1331212b42603ed762ec69c234b32a71fa764d Mon Sep 17 00:00:00 2001 From: pdanner Date: Fri, 16 Nov 2007 15:18:03 +0000 Subject: Refined Eclipse WTP settings; changed standard configuration git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1041 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../schemas/MOA-ID-Configuration-1.4.2.xsd | 1107 +++++++++++--------- 1 file changed, 607 insertions(+), 500 deletions(-) (limited to 'common/src') diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd index 16ff4a564..4488a1eda 100644 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd @@ -1,508 +1,615 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter der - Authentisierungs-Komponente - - - - - enthält Konfigurationsparameter der - Proxy-Komponente - - - - - - enthält Parameter für die Kommunikation zw. - Proxykomponente und Authenttisierungskomponente - - - - - - enthält Parameter für die SOAP-Verbindung von der - Proxy-Komponente zur Auth-Komponente (vgl. - AuthComponent/MOA-SP/ConnectionParameter) - - - - - - - - - - - enthält Parameter für die OA - - - - - - - - - - - - - - - - - - - - - - spezifiziert den Algorithmus ("pkix" oder "chaining") für die - Zertifikatspfadvalidierung - - - - - - ein vom SystemDefaultMode abweichender ChiningMode kann - für jeden TrustAnchor gesetzt werden - - - - - - - - - - - - - - - - verweist auf ein Verzeichnis, das vertrauenswürdige CA - (Zwischen-CA, Wurzel-CA) Zertifikate enthält. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter für die Kommunikation mit dem - Security-Layer - - - - - - - - - - enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA - SP Modul - - - - - - enthält Parameter für die SOAP-Verbindung von der - AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; - wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; - wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben - werden; wird das Element nicht verwendet dann wird MOA-SP über das API - aufgerufen - - - - - enthält Parameter für die Ãœberprüfung der - Personenbindung - - - - - - - - - - enthält Parameter für die Ãœberprüfung des - AUTH-Blocks - - - - - - - - - - - - - - enthält Informationen über akzeptierte Signers des - IdentityLinks - - - - - - akzeptierte Signer des IdentityLinks werden per - X509SubjectName (Kodierung nach RFC 2253) identifiziert - - - - - - - - enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen - - - - - - - das Attribut filename verweist auf eine Datei mit globalem - Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo - werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks - inkludiert - - - - - - - - - - - - - das Attribut URL spezifiziert die Lage des Templates - - - - - - Verifikation zusätzlicher Infoboxen - - - - - Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen - - - - - - - - - - Parameter für Ãœberprüfung weiterer Infoboxen - - - - - - optionalervName, der für Fehlermeldungen verwendet werden soll; - z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird - das Identifier-Attribut verwendet - - - - - TrustProfil, das für die Ãœberprüfung der Infobox - verwendet werden soll - - - - - Validatorklasse, die für die Prüfung der Infobox - verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname - vom Default Package- und Klassennamen abweichen - - - - - - Infobox spezifische Parameter, die der jeweiligen Prüfapplikation - übergeben werden - - - - - - - - - - - - - - - - - - - Spezifiziert die Lage von XML Schemas - - - - - - - - - - - - - - - - enthält Parameter über die OA, die die - Authentisierungs-Komponente betreffen - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der Proxy-Komponente zur Auth-Komponente (vgl. AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben werden; wird das Element nicht verwendet dann wird MOA-SP über das API aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen + + + + + + + das Attribut filename verweist auf eine Datei mit globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks inkludiert + + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + Verifikation zusätzlicher Infoboxen + + + + + Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen + + + + + + + + + + Parameter für Ãœberprüfung weiterer Infoboxen + + + + + + + Parameter zur Ãœberprüfung einzelner Infoboxen + + + + + optionalervName, der für Fehlermeldungen verwendet werden soll; z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird das Identifier-Attribut verwendet + + + + + TrustProfil, das für die Ãœberprüfung der Infobox verwendet werden soll + + + + + Validatorklasse, die für die Prüfung der Infobox verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname vom Default Package- und Klassennamen abweichen + + + + + + Infobox spezifische Parameter, die der jeweiligen Prüfapplikation übergeben werden + + + + + + + + + + Infobox spezifische Parameter, die der Prüfapplikation für berufliche Parteienvertretung übergeben werden. Dies ist logisch Teil der ApplicationSpecificParameters, kann jedoch aufgrund der Strukturierung validierend geparst werden und dadurch wird eine funktionierende Konfiguration bei Programmstart garantiert. + + + + + + Legt fest ob Machtgeber und Machtnehmer in den Anmeldedaten ausgetauscht werden sollen. Lediglich die übermittelte Vollmacht gibt dann Aufschluss darüber, dass eine Vertretung vorliegt. Ziel dieses Schalters ist, dass bisherige Applikationen mit Vollmachten und beruflicher Parteienvertretung nachgerüstet werden können, ohne der Erfordernis Änderungen durchführen zu müssen. + + + + + Falls Infoboxinhalte für die berufliche Parteienvertretung in der Vollmachten Infobox "mandates" abgelegt werden und Vertretung für berufliche Parteienvertreter aktiviert ist, so kann mit diesem Schalter die Vollmachtsprüfung für normale Vollmachten deaktiviert werden. Damit wird erreicht, dass mittels der Vollmachten Infobox ausschließlich berufliche Parteienvertretung aktiviert ist. Dieser Schalter ist nur für die Vollmachten Infobox "mandates" relevant. + + + + + Eigentlicher Konfigurationsteil für berufliche Parteienvertretung + + + + + + + + + + + + + + Spezifiziert die Lage von XML Schemas + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Authentisierungs-Komponente betreffen + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter über die OA, die die Proxy-Komponente - betreffen - - - - - - enthält Parameter über die OA, die die Proxy-Komponente - betreffen - - - - - - - - - - - - - - - - - - URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der - TLS-Verbindung enthält (keine CA-Zertifikate) - - - - - - - - - - - - URL zu einem KeyStore, der den privaten Schlüssel, der für - die TLS-Client-Authentisierung verwendetwird, enthält - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendetwird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + + + + Kommentar + + + + Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll + + + + + + + + Default InputProcessor. Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + Default Wert für Formularanzeige. Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular zur vervollständigung der Vertretenendaten immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + Default Verbindungsparameter zum SZR-Gateway (für den EGIZ-Demonstrator im internen Netzwerk: https://129.27.142.5:8443/szr-gateway/services/MandateCreation) + + + + + Falls keine speziellen beruflichen ParteienvertreterInnen definiert sind (Element kommt nicht vor), werden ausschließlich standardisierte Vollmachten mit einer MandateID="*" akzeptiert + + + + + + + + + Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + + Optionale Verbindungsparameter zu speziellem (SZR-)Gateway + + + + + + OID der Parteienvertretung lt. "Object Identifier der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID muss mit der MandateID der übermittelten standardisierten Vollmacht übereinstimmen. Eine Parteienvertretung für standardisierte Vollmachten mit der MandateID "*" muss nicht definiert werden und erlaubt eine allgemeine berufliche Parteienvertretung mit Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels dieses Attributs zu definieren + + + + + + Legt fest, ob berufliche Parteienvertretung für natürliche Personen erlaubt ist + + + + + + + + Legt fest, ob berufliche Parteienvertretung für juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht vertreten darf und dieser Wert aus diesem Grund dort false sein muss) + + + + + + + + Beschreibender Text, der an Stelle des Standardtexts bei der Signatur der Anmeldedaten im Falle einer vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt wird + + + + -- cgit v1.2.3 From 9e82ef61d10d91ee25bf964ef85f815b1756ee1b Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 21 Nov 2007 08:10:27 +0000 Subject: Fixed schema because element content in InputProcessorType was not allowed git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1043 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../resources/schemas/MOA-ID-Configuration-1.4.2.xsd | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'common/src') diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd index 4488a1eda..c0ceb1d2e 100644 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd @@ -518,14 +518,15 @@ - - Kommentar - - - - Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll - - + + + + + Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll + + + + -- cgit v1.2.3 From 923c7b6da9eb81500c29e2a68ffc0f4a863d90d7 Mon Sep 17 00:00:00 2001 From: pdanner Date: Tue, 15 Jan 2008 17:26:00 +0000 Subject: Minor enhancements git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1056 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd index c0ceb1d2e..360789834 100644 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.2.xsd @@ -472,7 +472,7 @@ - URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendetwird, enthält + URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendet wird, enthält -- cgit v1.2.3 From 8a0a31c377fbf2873714df580e7ddf8e248e2011 Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 16 Jan 2008 13:36:18 +0000 Subject: Preparation for 1.4.3 release (changed project version) git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1058 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/Constants.java | 2 +- .../schemas/MOA-ID-Configuration-1.4.3.xsd | 611 +++++++++++++++++++++ 2 files changed, 612 insertions(+), 1 deletion(-) create mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.3.xsd (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index d1edbc38d..d82947e3f 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -81,7 +81,7 @@ public interface Constants { /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.4.2.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.4.3.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.3.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.3.xsd new file mode 100644 index 000000000..02183819c --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.3.xsd @@ -0,0 +1,611 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der Proxy-Komponente zur Auth-Komponente (vgl. AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben werden; wird das Element nicht verwendet dann wird MOA-SP über das API aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen + + + + + + + das Attribut filename verweist auf eine Datei mit globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks inkludiert + + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + Verifikation zusätzlicher Infoboxen + + + + + Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen + + + + + + + + + + Parameter für Ãœberprüfung weiterer Infoboxen + + + + + + + Parameter zur Ãœberprüfung einzelner Infoboxen + + + + + optionalervName, der für Fehlermeldungen verwendet werden soll; z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird das Identifier-Attribut verwendet + + + + + TrustProfil, das für die Ãœberprüfung der Infobox verwendet werden soll + + + + + Validatorklasse, die für die Prüfung der Infobox verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname vom Default Package- und Klassennamen abweichen + + + + + + Infobox spezifische Parameter, die der jeweiligen Prüfapplikation übergeben werden + + + + + + + + + + Infobox spezifische Parameter, die der Prüfapplikation für berufliche Parteienvertretung übergeben werden. Dies ist logisch Teil der ApplicationSpecificParameters, kann jedoch aufgrund der Strukturierung validierend geparst werden und dadurch wird eine funktionierende Konfiguration bei Programmstart garantiert. + + + + + + Falls Infoboxinhalte für die berufliche Parteienvertretung in der Vollmachten Infobox "mandates" abgelegt werden und Vertretung für berufliche Parteienvertreter aktiviert ist, so kann mit diesem Schalter die Vollmachtsprüfung für normale Vollmachten deaktiviert werden. Damit wird erreicht, dass mittels der Vollmachten Infobox ausschließlich berufliche Parteienvertretung aktiviert ist. Dieser Schalter ist nur für die Vollmachten Infobox "mandates" relevant. + + + + + Eigentlicher Konfigurationsteil für berufliche Parteienvertretung + + + + + + + + + + + + + + Spezifiziert die Lage von XML Schemas + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Authentisierungs-Komponente betreffen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendet wird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + + + + + + + Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll + + + + + + + + + + Default InputProcessor. Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + Default Wert für Formularanzeige. Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular zur vervollständigung der Vertretenendaten immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + Default Verbindungsparameter zum SZR-Gateway (für den EGIZ-Demonstrator im internen Netzwerk: https://129.27.142.5:8443/szr-gateway/services/MandateCreation) + + + + + Falls keine speziellen beruflichen ParteienvertreterInnen definiert sind (Element kommt nicht vor), werden ausschließlich standardisierte Vollmachten mit einer MandateID="*" akzeptiert + + + + + + + + + Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + + Optionale Verbindungsparameter zu speziellem (SZR-)Gateway + + + + + + OID der Parteienvertretung lt. "Object Identifier der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID muss mit der MandateID der übermittelten standardisierten Vollmacht übereinstimmen. Eine Parteienvertretung für standardisierte Vollmachten mit der MandateID "*" muss nicht definiert werden und erlaubt eine allgemeine berufliche Parteienvertretung mit Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels dieses Attributs zu definieren + + + + + + Legt fest, ob berufliche Parteienvertretung für natürliche Personen erlaubt ist + + + + + + + + Legt fest, ob berufliche Parteienvertretung für juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht vertreten darf und dieser Wert aus diesem Grund dort false sein muss) + + + + + + + + Beschreibender Text, der an Stelle des Standardtexts bei der Signatur der Anmeldedaten im Falle einer vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt wird + + + + + -- cgit v1.2.3 From b00fd777ba1c564b1f4b3fdf14ec4d23ff80c1ea Mon Sep 17 00:00:00 2001 From: spuchmann Date: Thu, 8 May 2008 14:04:44 +0000 Subject: added PermitFileURIs; removing unnecessary dependencies to Sun's JSSE git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1071 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/Constants.java | 4 +- .../resources/schemas/MOA-SPSS-config-1.4.3.xsd | 312 +++++++++++++++++++++ 2 files changed, 314 insertions(+), 2 deletions(-) create mode 100644 common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.3.xsd (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index d82947e3f..887363fdd 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -77,11 +77,11 @@ public interface Constants { /** Local location of the MOA configuration XML schema definition. */ public static final String MOA_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-config-1.3.xsd"; + SCHEMA_ROOT + "MOA-SPSS-config-1.4.3.xsd"; /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.4.3.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.3.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = diff --git a/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.3.xsd b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.3.xsd new file mode 100644 index 000000000..2b2f1d689 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.3.xsd @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 41d3d9445ef37a8adda750c65fa586f2c0d645d2 Mon Sep 17 00:00:00 2001 From: spuchmann Date: Fri, 16 May 2008 20:06:34 +0000 Subject: raised version to 1.4.3-1 fixed moa-id schema in Constants.java git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1078 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/main/java/at/gv/egovernment/moa/util/Constants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index 887363fdd..487ae2d79 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -81,7 +81,7 @@ public interface Constants { /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.3.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.4.3.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = -- cgit v1.2.3 From 3bbc64da1cd1a70fd255442574b354dad49bf3ed Mon Sep 17 00:00:00 2001 From: pdanner Date: Tue, 3 Jun 2008 12:37:28 +0000 Subject: Changes for load balancing and szr-gateway communication git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1082 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.3.xsd | 1 + 1 file changed, 1 insertion(+) (limited to 'common/src') diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.3.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.3.xsd index 02183819c..570bebd37 100644 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.3.xsd +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.3.xsd @@ -179,6 +179,7 @@ + -- cgit v1.2.3 From c6060a2fb6adae58ff8e865448d07bcc2b702ebb Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 27 Aug 2008 17:15:09 +0000 Subject: Removed invalid source file headers. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1086 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../at/gv/egovernment/moa/util/StringUtils.java | 24 ---------------------- 1 file changed, 24 deletions(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java index 82c10d90f..b91007498 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java @@ -1,27 +1,3 @@ -// Copyright (C) 2002 IAIK -// email: jce-info@iaik.tu-graz.ac.at -// -// All rights reserved. -// -// This source is provided for inspection purposes and recompilation only, -// unless specified differently in a contract with IAIK. This source has to -// be kept in strict confidence and must not be disclosed to any third party -// under any circumstances. Redistribution in source and binary forms, with -// or without modification, are permitted in any case! -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -// SUCH DAMAGE. -// - package at.gv.egovernment.moa.util; import java.util.StringTokenizer; -- cgit v1.2.3 From afcd856e186b9fd5d8dfcb0f3e6f3599ca920b51 Mon Sep 17 00:00:00 2001 From: mcentner Date: Thu, 28 Aug 2008 07:55:59 +0000 Subject: Added copyright and license header to all java source files. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1087 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../main/java/at/gv/egovernment/moa/logging/LogMsg.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/logging/Logger.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/logging/LoggingContext.java | 15 +++++++++++++++ .../gv/egovernment/moa/logging/LoggingContextManager.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/Base64Utils.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/BoolUtils.java | 15 +++++++++++++++ .../java/at/gv/egovernment/moa/util/CollectionUtils.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/Constants.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/DOMUtils.java | 15 +++++++++++++++ .../java/at/gv/egovernment/moa/util/DateTimeUtils.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/util/EntityResolverChain.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/FileUtils.java | 15 +++++++++++++++ .../java/at/gv/egovernment/moa/util/KeyStoreUtils.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/util/MOADefaultHandler.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/util/MOAEntityResolver.java | 15 +++++++++++++++ .../java/at/gv/egovernment/moa/util/MOAErrorHandler.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/MOATimer.java | 15 +++++++++++++++ .../java/at/gv/egovernment/moa/util/MessageProvider.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/Messages.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/util/NodeIteratorAdapter.java | 15 +++++++++++++++ .../java/at/gv/egovernment/moa/util/NodeListAdapter.java | 15 +++++++++++++++ .../java/at/gv/egovernment/moa/util/OutputXML2File.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/util/ResourceBundleChain.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/SSLUtils.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/util/StreamEntityResolver.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/StreamUtils.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/StringUtils.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/URLDecoder.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/URLEncoder.java | 15 +++++++++++++++ .../java/at/gv/egovernment/moa/util/XPathException.java | 15 +++++++++++++++ .../main/java/at/gv/egovernment/moa/util/XPathUtils.java | 15 +++++++++++++++ .../test/java/test/at/gv/egovernment/moa/AllTests.java | 15 +++++++++++++++ .../test/java/test/at/gv/egovernment/moa/MOATestCase.java | 15 +++++++++++++++ .../test/at/gv/egovernment/moa/util/DOMUtilsTest.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/util/DateTimeUtilsTest.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/util/KeyStoreUtilsTest.java | 15 +++++++++++++++ .../test/at/gv/egovernment/moa/util/SSLUtilsTest.java | 15 +++++++++++++++ .../test/at/gv/egovernment/moa/util/URLDecoderTest.java | 15 +++++++++++++++ .../test/at/gv/egovernment/moa/util/URLEncoderTest.java | 15 +++++++++++++++ .../at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java | 15 +++++++++++++++ .../test/at/gv/egovernment/moa/util/XPathUtilsTest.java | 15 +++++++++++++++ 41 files changed, 615 insertions(+) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java b/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java index 4d04fc72d..890bbeff7 100644 --- a/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java +++ b/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.logging; /** diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java b/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java index eb7aa5634..dd36bfc4b 100644 --- a/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java +++ b/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.logging; import org.apache.commons.logging.Log; diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java b/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java index 42d8db06e..249c80184 100644 --- a/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java +++ b/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.logging; /** diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java b/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java index 2bbe6caa1..ef37dc6ba 100644 --- a/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java +++ b/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.logging; /** diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java b/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java index ad29180a6..3729881f7 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.ByteArrayInputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java index fcd39b4dd..8776442a3 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; /** diff --git a/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java index 5329dcbd2..7a4c3850f 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.util.Iterator; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index 487ae2d79..a436c4b23 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.util.HashMap; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java index 5be0bb500..b403961d8 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.ByteArrayInputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java index 58cc04c4c..5f31809dd 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.StringWriter; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java b/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java index e7008a701..88932494d 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.IOException; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java index a5e777c2d..1368b41d2 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.BufferedInputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java index d6a34a7b2..b08feaffb 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import iaik.x509.X509Certificate; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java b/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java index 0474d92cd..c6b0a3c32 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.IOException; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java b/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java index 9406612e2..02302cb65 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.InputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java b/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java index 1f7757c8f..4885fedb7 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import org.apache.xml.utils.DefaultErrorHandler; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java b/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java index d8bf64fc3..a2ec7386c 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.util.Map; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java b/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java index f5117e390..dde220a6e 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.util.Locale; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Messages.java b/common/src/main/java/at/gv/egovernment/moa/util/Messages.java index a0139ae93..476f75046 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Messages.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Messages.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.text.MessageFormat; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java b/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java index f71aa472d..1ca222d94 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.util.ListIterator; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java b/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java index 7102cadca..8e1d7dd8a 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.util.List; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java b/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java index f9d330d41..6663f7a3c 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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. +*/ /* * Created on 26.04.2004 * diff --git a/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java b/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java index 90b28548a..609c873ff 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.util.ArrayList; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java index ada21b412..6d6aedb22 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.IOException; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java b/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java index 38c4e863c..6fd67e97a 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.IOException; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java index 3b1a6b56b..0300dcd2d 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.ByteArrayOutputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java index b91007498..84f7e8f04 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.util.StringTokenizer; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/URLDecoder.java b/common/src/main/java/at/gv/egovernment/moa/util/URLDecoder.java index a20820f7e..2fc721db9 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/URLDecoder.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/URLDecoder.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.ByteArrayOutputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java b/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java index 840c0c3bc..f73936487 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.ByteArrayInputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java b/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java index e10c882e5..6899dfd9b 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.io.PrintStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java index 5212ed13e..01fe3a3aa 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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.egovernment.moa.util; import java.util.List; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java b/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java index 00e2c505f..0e703b1bb 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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 test.at.gv.egovernment.moa; import test.at.gv.egovernment.moa.util.DOMUtilsTest; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java b/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java index 86ea2ee6c..42e5e0230 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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 test.at.gv.egovernment.moa; import java.io.FileInputStream; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java index eb3ad1a5c..8e301e41c 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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 test.at.gv.egovernment.moa.util; import java.io.FileInputStream; import java.util.Map; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java index da6b29b1c..0b0f3fcf8 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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 test.at.gv.egovernment.moa.util; import java.text.DateFormat; import java.text.ParseException; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java index a6d1847ce..8a4b17368 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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 test.at.gv.egovernment.moa.util; import java.io.File; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java index 7e55cb7d0..e44d4ff7c 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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 test.at.gv.egovernment.moa.util; import java.io.FileInputStream; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java index b6ea0e152..ee7444f11 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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 test.at.gv.egovernment.moa.util; import java.net.URLEncoder; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java index 43238c51f..f5fbf4537 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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 test.at.gv.egovernment.moa.util; import at.gv.egovernment.moa.util.FileUtils; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java index 7986fe540..598948543 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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 test.at.gv.egovernment.moa.util; import java.io.FileInputStream; import java.io.InputStream; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java index 559494300..dcd107f1a 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java @@ -1,3 +1,18 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* 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 test.at.gv.egovernment.moa.util; import org.w3c.dom.Document; import org.w3c.dom.NodeList; -- cgit v1.2.3 From 527f2ec316c6d67498ed6dfe37a95218a2ab6f54 Mon Sep 17 00:00:00 2001 From: spuchmann Date: Mon, 15 Sep 2008 07:33:53 +0000 Subject: raised version to 1.4.4 moved licenses to root folder fixed Bug 332 and 333 slVersion changed from 1.1 to 1.2 (MOA-ID-Configuration-1.4.4.xsd) git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1091 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/Constants.java | 2 +- .../schemas/MOA-ID-Configuration-1.4.4.xsd | 612 +++++++++++++++++++++ 2 files changed, 613 insertions(+), 1 deletion(-) create mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.4.xsd (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index a436c4b23..3851f7fdf 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -96,7 +96,7 @@ public interface Constants { /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.4.3.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.4.4.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.4.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.4.xsd new file mode 100644 index 000000000..619b9f2df --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.4.xsd @@ -0,0 +1,612 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der Proxy-Komponente zur Auth-Komponente (vgl. AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben werden; wird das Element nicht verwendet dann wird MOA-SP über das API aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen + + + + + + + das Attribut filename verweist auf eine Datei mit globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks inkludiert + + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + Verifikation zusätzlicher Infoboxen + + + + + Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen + + + + + + + + + + Parameter für Ãœberprüfung weiterer Infoboxen + + + + + + + Parameter zur Ãœberprüfung einzelner Infoboxen + + + + + optionalervName, der für Fehlermeldungen verwendet werden soll; z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird das Identifier-Attribut verwendet + + + + + TrustProfil, das für die Ãœberprüfung der Infobox verwendet werden soll + + + + + Validatorklasse, die für die Prüfung der Infobox verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname vom Default Package- und Klassennamen abweichen + + + + + + Infobox spezifische Parameter, die der jeweiligen Prüfapplikation übergeben werden + + + + + + + + + + Infobox spezifische Parameter, die der Prüfapplikation für berufliche Parteienvertretung übergeben werden. Dies ist logisch Teil der ApplicationSpecificParameters, kann jedoch aufgrund der Strukturierung validierend geparst werden und dadurch wird eine funktionierende Konfiguration bei Programmstart garantiert. + + + + + + Falls Infoboxinhalte für die berufliche Parteienvertretung in der Vollmachten Infobox "mandates" abgelegt werden und Vertretung für berufliche Parteienvertreter aktiviert ist, so kann mit diesem Schalter die Vollmachtsprüfung für normale Vollmachten deaktiviert werden. Damit wird erreicht, dass mittels der Vollmachten Infobox ausschließlich berufliche Parteienvertretung aktiviert ist. Dieser Schalter ist nur für die Vollmachten Infobox "mandates" relevant. + + + + + Eigentlicher Konfigurationsteil für berufliche Parteienvertretung + + + + + + + + + + + + + + Spezifiziert die Lage von XML Schemas + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Authentisierungs-Komponente betreffen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendet wird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + + + + + + + Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll + + + + + + + + + + Default InputProcessor. Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + Default Wert für Formularanzeige. Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular zur vervollständigung der Vertretenendaten immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + Default Verbindungsparameter zum SZR-Gateway (für den EGIZ-Demonstrator im internen Netzwerk: https://129.27.142.5:8443/szr-gateway/services/MandateCreation) + + + + + Falls keine speziellen beruflichen ParteienvertreterInnen definiert sind (Element kommt nicht vor), werden ausschließlich standardisierte Vollmachten mit einer MandateID="*" akzeptiert + + + + + + + + + Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + + Optionale Verbindungsparameter zu speziellem (SZR-)Gateway + + + + + + OID der Parteienvertretung lt. "Object Identifier der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID muss mit der MandateID der übermittelten standardisierten Vollmacht übereinstimmen. Eine Parteienvertretung für standardisierte Vollmachten mit der MandateID "*" muss nicht definiert werden und erlaubt eine allgemeine berufliche Parteienvertretung mit Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels dieses Attributs zu definieren + + + + + + Legt fest, ob berufliche Parteienvertretung für natürliche Personen erlaubt ist + + + + + + + + Legt fest, ob berufliche Parteienvertretung für juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht vertreten darf und dieser Wert aus diesem Grund dort false sein muss) + + + + + + + + Beschreibender Text, der an Stelle des Standardtexts bei der Signatur der Anmeldedaten im Falle einer vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt wird + + + + + -- cgit v1.2.3 From e4d6edc4620935a911aea8941df6b66f875064ea Mon Sep 17 00:00:00 2001 From: spuchmann Date: Mon, 22 Sep 2008 14:44:11 +0000 Subject: Reverted schema to 1.4.3 Updated MOAID Configuration slVersion=1.2 git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1095 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/Constants.java | 2 +- .../schemas/MOA-ID-Configuration-1.4.4.xsd | 612 --------------------- 2 files changed, 1 insertion(+), 613 deletions(-) delete mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.4.xsd (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index 3851f7fdf..a436c4b23 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -96,7 +96,7 @@ public interface Constants { /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.4.4.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.4.3.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.4.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.4.xsd deleted file mode 100644 index 619b9f2df..000000000 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.4.xsd +++ /dev/null @@ -1,612 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter der Authentisierungs-Komponente - - - - - enthält Konfigurationsparameter der Proxy-Komponente - - - - - - enthält Parameter für die Kommunikation zw. Proxykomponente und Authenttisierungskomponente - - - - - - enthält Parameter für die SOAP-Verbindung von der Proxy-Komponente zur Auth-Komponente (vgl. AuthComponent/MOA-SP/ConnectionParameter) - - - - - - - - - - - enthält Parameter für die OA - - - - - - - - - - - - - - - - - - - - - - spezifiziert den Algorithmus ("pkix" oder "chaining") für die Zertifikatspfadvalidierung - - - - - - ein vom SystemDefaultMode abweichender ChiningMode kann für jeden TrustAnchor gesetzt werden - - - - - - - - - - - - - - - - verweist auf ein Verzeichnis, das vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate enthält. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter für die Kommunikation mit dem Security-Layer - - - - - - - - - - enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA SP Modul - - - - - - enthält Parameter für die SOAP-Verbindung von der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben werden; wird das Element nicht verwendet dann wird MOA-SP über das API aufgerufen - - - - - enthält Parameter für die Ãœberprüfung der Personenbindung - - - - - - - - - - enthält Parameter für die Ãœberprüfung des AUTH-Blocks - - - - - - - - - - - - - - enthält Informationen über akzeptierte Signers des IdentityLinks - - - - - - akzeptierte Signer des IdentityLinks werden per X509SubjectName (Kodierung nach RFC 2253) identifiziert - - - - - - - - enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen - - - - - - - das Attribut filename verweist auf eine Datei mit globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks inkludiert - - - - - - - - - - - - - das Attribut URL spezifiziert die Lage des Templates - - - - - - Verifikation zusätzlicher Infoboxen - - - - - Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen - - - - - - - - - - Parameter für Ãœberprüfung weiterer Infoboxen - - - - - - - Parameter zur Ãœberprüfung einzelner Infoboxen - - - - - optionalervName, der für Fehlermeldungen verwendet werden soll; z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird das Identifier-Attribut verwendet - - - - - TrustProfil, das für die Ãœberprüfung der Infobox verwendet werden soll - - - - - Validatorklasse, die für die Prüfung der Infobox verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname vom Default Package- und Klassennamen abweichen - - - - - - Infobox spezifische Parameter, die der jeweiligen Prüfapplikation übergeben werden - - - - - - - - - - Infobox spezifische Parameter, die der Prüfapplikation für berufliche Parteienvertretung übergeben werden. Dies ist logisch Teil der ApplicationSpecificParameters, kann jedoch aufgrund der Strukturierung validierend geparst werden und dadurch wird eine funktionierende Konfiguration bei Programmstart garantiert. - - - - - - Falls Infoboxinhalte für die berufliche Parteienvertretung in der Vollmachten Infobox "mandates" abgelegt werden und Vertretung für berufliche Parteienvertreter aktiviert ist, so kann mit diesem Schalter die Vollmachtsprüfung für normale Vollmachten deaktiviert werden. Damit wird erreicht, dass mittels der Vollmachten Infobox ausschließlich berufliche Parteienvertretung aktiviert ist. Dieser Schalter ist nur für die Vollmachten Infobox "mandates" relevant. - - - - - Eigentlicher Konfigurationsteil für berufliche Parteienvertretung - - - - - - - - - - - - - - Spezifiziert die Lage von XML Schemas - - - - - - - - - - - - - - - - enthält Parameter über die OA, die die Authentisierungs-Komponente betreffen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter über die OA, die die Proxy-Komponente betreffen - - - - - - enthält Parameter über die OA, die die Proxy-Komponente betreffen - - - - - - - - - - - - - - - - - - URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der TLS-Verbindung enthält (keine CA-Zertifikate) - - - - - - - - - - - - URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendet wird, enthält - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden - - - - - - - - - - - Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll - - - - - - - - - - Default InputProcessor. Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors - - - - - Default Wert für Formularanzeige. Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular zur vervollständigung der Vertretenendaten immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden - - - - - Default Verbindungsparameter zum SZR-Gateway (für den EGIZ-Demonstrator im internen Netzwerk: https://129.27.142.5:8443/szr-gateway/services/MandateCreation) - - - - - Falls keine speziellen beruflichen ParteienvertreterInnen definiert sind (Element kommt nicht vor), werden ausschließlich standardisierte Vollmachten mit einer MandateID="*" akzeptiert - - - - - - - - - Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors - - - - - - Optionale Verbindungsparameter zu speziellem (SZR-)Gateway - - - - - - OID der Parteienvertretung lt. "Object Identifier der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID muss mit der MandateID der übermittelten standardisierten Vollmacht übereinstimmen. Eine Parteienvertretung für standardisierte Vollmachten mit der MandateID "*" muss nicht definiert werden und erlaubt eine allgemeine berufliche Parteienvertretung mit Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels dieses Attributs zu definieren - - - - - - Legt fest, ob berufliche Parteienvertretung für natürliche Personen erlaubt ist - - - - - - - - Legt fest, ob berufliche Parteienvertretung für juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht vertreten darf und dieser Wert aus diesem Grund dort false sein muss) - - - - - - - - Beschreibender Text, der an Stelle des Standardtexts bei der Signatur der Anmeldedaten im Falle einer vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt wird - - - - - -- cgit v1.2.3 From aebb5cd04d43b25b8d65237ba49fddf5f5dd1a8c Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 7 Jul 2009 14:27:40 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1114 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/Constants.java | 4 +- .../resources/schemas/MOA-SPSS-config-1.4.5.xsd | 268 +++++++++++++++++++++ 2 files changed, 270 insertions(+), 2 deletions(-) create mode 100644 common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.5.xsd (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index a436c4b23..a32541749 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -78,7 +78,7 @@ public interface Constants { /** URI of the MOA configuration XML namespace. */ public static final String MOA_CONFIG_NS_URI = - "http://reference.e-government.gv.at/namespace/moaconfig/20021122#"; + "http://reference.e-government.gv.at/namespace/moaconfig/20090603#"; /** URI of the MOA ID configuration XML namespace. */ public static final String MOA_ID_CONFIG_NS_URI = @@ -92,7 +92,7 @@ public interface Constants { /** Local location of the MOA configuration XML schema definition. */ public static final String MOA_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-config-1.4.3.xsd"; + SCHEMA_ROOT + "MOA-SPSS-config-1.4.5.xsd"; /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = diff --git a/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.5.xsd b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.5.xsd new file mode 100644 index 000000000..2b6e1a295 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.5.xsd @@ -0,0 +1,268 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From b96b2ef653f6bc62ca8a7880dde525dc44d9a8b7 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Mon, 10 Aug 2009 09:23:17 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1123 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/main/java/at/gv/egovernment/moa/util/Constants.java | 2 +- common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.5.xsd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index a32541749..993026c57 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -78,7 +78,7 @@ public interface Constants { /** URI of the MOA configuration XML namespace. */ public static final String MOA_CONFIG_NS_URI = - "http://reference.e-government.gv.at/namespace/moaconfig/20090603#"; + "http://reference.e-government.gv.at/namespace/moaconfig/20021122#"; /** URI of the MOA ID configuration XML namespace. */ public static final String MOA_ID_CONFIG_NS_URI = diff --git a/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.5.xsd b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.5.xsd index 2b6e1a295..8da3a72b0 100644 --- a/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.5.xsd +++ b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.5.xsd @@ -2,7 +2,7 @@ - + -- cgit v1.2.3 From 68af85701b6f797b0d662b89b95e043ee949defd Mon Sep 17 00:00:00 2001 From: mcentner Date: Fri, 2 Jul 2010 07:14:41 +0000 Subject: Merged branch 1.4.7_MOASP_TSL back into trunk. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1165 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/Constants.java | 6 +- .../at/gv/egovernment/moa/util/StringUtils.java | 14 + .../schemas/MOA-ID-Configuration-1.4.7.xsd | 625 +++++++++++++++++++++ .../resources/resources/schemas/MOA-SPSS-1.4.7.xsd | 486 ++++++++++++++++ .../resources/schemas/MOA-SPSS-config-1.4.7.xsd | 270 +++++++++ 5 files changed, 1398 insertions(+), 3 deletions(-) create mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.7.xsd create mode 100644 common/src/main/resources/resources/schemas/MOA-SPSS-1.4.7.xsd create mode 100644 common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.7.xsd (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index 993026c57..6a42720c0 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -74,7 +74,7 @@ public interface Constants { /** Local location of the MOA XML schema definition. */ public static final String MOA_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-1.3.xsd"; + SCHEMA_ROOT + "MOA-SPSS-1.4.7.xsd"; /** URI of the MOA configuration XML namespace. */ public static final String MOA_CONFIG_NS_URI = @@ -92,11 +92,11 @@ public interface Constants { /** Local location of the MOA configuration XML schema definition. */ public static final String MOA_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-config-1.4.5.xsd"; + SCHEMA_ROOT + "MOA-SPSS-config-1.4.7.xsd"; /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.4.3.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.4.7.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java index 84f7e8f04..dbc2b5011 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java @@ -152,4 +152,18 @@ public class StringUtils { } } + /** + * Checks if String is empty + * @param s String to be checked if empty + * @return True if String is empty, false otherwise + */ + public static boolean isEmpty(String s) { + if (s == null || s.length() == 0) + return true; + else + return false; + + } + + } diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.7.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.7.xsd new file mode 100644 index 000000000..dffca2167 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.7.xsd @@ -0,0 +1,625 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der Proxy-Komponente zur Auth-Komponente (vgl. AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben werden; wird das Element nicht verwendet dann wird MOA-SP über das API aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen + + + + + + + + Default Verbindungsparameter zum SZR-Gateway (GetIdentityLink) + + + + + + + + + + das Attribut filename verweist auf eine Datei mit globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks inkludiert + + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + Verifikation zusätzlicher Infoboxen + + + + + Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen + + + + + + + + + + Parameter für Ãœberprüfung weiterer Infoboxen + + + + + + + Parameter zur Ãœberprüfung einzelner Infoboxen + + + + + optionalervName, der für Fehlermeldungen verwendet werden soll; z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird das Identifier-Attribut verwendet + + + + + TrustProfil, das für die Ãœberprüfung der Infobox verwendet werden soll + + + + + Validatorklasse, die für die Prüfung der Infobox verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname vom Default Package- und Klassennamen abweichen + + + + + + Infobox spezifische Parameter, die der jeweiligen Prüfapplikation übergeben werden + + + + + + + + + + Infobox spezifische Parameter, die der Prüfapplikation für berufliche Parteienvertretung übergeben werden. Dies ist logisch Teil der ApplicationSpecificParameters, kann jedoch aufgrund der Strukturierung validierend geparst werden und dadurch wird eine funktionierende Konfiguration bei Programmstart garantiert. + + + + + + Falls Infoboxinhalte für die berufliche Parteienvertretung in der Vollmachten Infobox "mandates" abgelegt werden und Vertretung für berufliche Parteienvertreter aktiviert ist, so kann mit diesem Schalter die Vollmachtsprüfung für normale Vollmachten deaktiviert werden. Damit wird erreicht, dass mittels der Vollmachten Infobox ausschließlich berufliche Parteienvertretung aktiviert ist. Dieser Schalter ist nur für die Vollmachten Infobox "mandates" relevant. + + + + + Eigentlicher Konfigurationsteil für berufliche Parteienvertretung + + + + + + + + + + + + + + Spezifiziert die Lage von XML Schemas + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Authentisierungs-Komponente betreffen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendet wird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + + + + + + + Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll + + + + + + + + + + Default InputProcessor. Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + Default Wert für Formularanzeige. Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular zur vervollständigung der Vertretenendaten immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + Default Verbindungsparameter zum SZR-Gateway (für den EGIZ-Demonstrator im internen Netzwerk: https://129.27.142.5:8443/szr-gateway/services/MandateCreation) + + + + + Falls keine speziellen beruflichen ParteienvertreterInnen definiert sind (Element kommt nicht vor), werden ausschließlich standardisierte Vollmachten mit einer MandateID="*" akzeptiert + + + + + + + + + Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + + Optionale Verbindungsparameter zu speziellem (SZR-)Gateway + + + + + + OID der Parteienvertretung lt. "Object Identifier der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID muss mit der MandateID der übermittelten standardisierten Vollmacht übereinstimmen. Eine Parteienvertretung für standardisierte Vollmachten mit der MandateID "*" muss nicht definiert werden und erlaubt eine allgemeine berufliche Parteienvertretung mit Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels dieses Attributs zu definieren + + + + + + Legt fest, ob berufliche Parteienvertretung für natürliche Personen erlaubt ist + + + + + + + + Legt fest, ob berufliche Parteienvertretung für juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht vertreten darf und dieser Wert aus diesem Grund dort false sein muss) + + + + + + + + Beschreibender Text, der an Stelle des Standardtexts bei der Signatur der Anmeldedaten im Falle einer vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt wird + + + + + diff --git a/common/src/main/resources/resources/schemas/MOA-SPSS-1.4.7.xsd b/common/src/main/resources/resources/schemas/MOA-SPSS-1.4.7.xsd new file mode 100644 index 000000000..e3b06b416 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-SPSS-1.4.7.xsd @@ -0,0 +1,486 @@ + + + + + + + + + + + + + + + + + + + + + Ermöglichung der Stapelsignatur durch wiederholte Angabe dieses Elements + + + + + + + + + + + + + + + + + + + Auswahl: Entweder explizite Angabe des Signaturorts sowie ggf. sinnvoller Supplements im Zshg. mit der Signaturumgebung, oder Verweis auf ein benanntes Profil + + + + + + + + + + + + + + + + + + Kardinalität 1..oo erlaubt die Antwort auf eine Stapelsignatur-Anfrage + + + + Resultat, falls die Signaturerstellung erfolgreich war + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert + + + + + + + + + + + only ds:X509Data and RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any;publicAuthority is included as X509Data/any + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pro dsig:Reference-Element in der zu überprüfenden XML-Signatur muss hier ein ReferenceInfo-Element erscheinen. Die Reihenfolge der einzelnen ReferenceInfo Elemente entspricht jener der dsig:Reference Elemente in der XML-Signatur. + + + + + + + + + + mit diesem Profil wird eine Menge von vertrauenswürdigen Wurzelzertifikaten spezifiziert + + + + + + + + + + + only ds:X509Data and ds:RetrievalMethod is supported; QualifiedCertificate is included as X509Data/any; PublicAuthority is included as X509Data/any + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Auswahl: Entweder explizite Angabe EINER Transformationskette inklusive ggf. sinnvoller Supplements oder Verweis auf ein benanntes Profil + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Resultat, falls die Signaturerstellung gescheitert ist + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ein oder mehrere Transformationswege können von der Applikation an MOA mitgeteilt werden. Die zu prüfende Signatur hat zumindest einem dieser Transformationswege zu entsprechen. Die Angabe kann explizit oder als Profilbezeichner erfolgen. + + + + + Profilbezeichner für einen Transformationsweg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Die Angabe des Transformationsparameters (explizit oder als Hashwert) kann unterlassen werden, wenn die Applikation von der Unveränderlichkeit des Inhalts der in "Transformationsparamter", Attribut "URI" angegebenen URI ausgehen kann. + + + + Der Transformationsparameter explizit angegeben. + + + + + Der Hashwert des Transformationsparameters. + + + + + + + + + + + + + + + + + + + + + + Explizite Angabe des Transformationswegs + + + + + + + Alle impliziten Transformationsparameter, die zum Durchlaufen der oben angeführten Transformationskette bekannt sein müssen, müssen hier angeführt werden. Das Attribut "URI" bezeichnet den Transformationsparameter in exakt jener Weise, wie er in der zu überprüfenden Signatur gebraucht wird. + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.7.xsd b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.7.xsd new file mode 100644 index 000000000..a61eed289 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.7.xsd @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From fa30b5b2a26a6df4e56a81283761c35ef81770e3 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 13 Jul 2010 06:25:09 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1166 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../at/gv/egovernment/moa/util/DateTimeUtils.java | 31 ++++++++++++++++++++++ .../java/at/gv/egovernment/moa/util/SSLUtils.java | 3 +-- 2 files changed, 32 insertions(+), 2 deletions(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java index 5f31809dd..88133832a 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java @@ -73,6 +73,37 @@ public class DateTimeUtils { return out.toString(); } + /** + * Builds a dateTime value from a Calendar value. + * @param cal the Calendar value + * @return the dateTime value + */ + public static String buildDate(Calendar cal) { + StringWriter out = new StringWriter(); + out.write("" + cal.get(Calendar.YEAR)); + out.write("-"); + out.write(to2DigitString(cal.get(Calendar.MONTH) + 1)); + out.write("-"); + out.write(to2DigitString(cal.get(Calendar.DAY_OF_MONTH))); + return out.toString(); + } + + /** + * Builds a dateTime value from a Calendar value. + * @param cal the Calendar value + * @return the dateTime value + */ + public static String buildTime(Calendar cal) { + StringWriter out = new StringWriter(); + out.write(to2DigitString(cal.get(Calendar.HOUR_OF_DAY))); + out.write(":"); + out.write(to2DigitString(cal.get(Calendar.MINUTE))); + out.write(":"); + out.write(to2DigitString(cal.get(Calendar.SECOND))); + + return out.toString(); + } + /** * Converts month, day, hour, minute, or second value * to a 2 digit String. diff --git a/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java index 6d6aedb22..a7937b1bd 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java @@ -110,8 +110,7 @@ public class SSLUtils { String clientKeyStorePassword) throws IOException, GeneralSecurityException { - //System.setProperty("javax.net.debug", "all"); - TrustManager[] tms = getTrustManagers(trustStore); + TrustManager[] tms = getTrustManagers(trustStore); KeyManager[] kms = getKeyManagers(clientKeyStoreType, clientKeyStoreURL, clientKeyStorePassword); SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init(kms, tms, null); -- cgit v1.2.3 From 9d3697572c1ef46aba568bf803f37b24f4892bdb Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 13 Jul 2010 06:35:45 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1167 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../schemas/MOA-ID-Configuration-1.4.7.xsd | 625 --------------------- .../schemas/MOA-ID-Configuration-1.5.0.xsd | 625 +++++++++++++++++++++ 2 files changed, 625 insertions(+), 625 deletions(-) delete mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.7.xsd create mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd (limited to 'common/src') diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.7.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.7.xsd deleted file mode 100644 index dffca2167..000000000 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.7.xsd +++ /dev/null @@ -1,625 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter der Authentisierungs-Komponente - - - - - enthält Konfigurationsparameter der Proxy-Komponente - - - - - - enthält Parameter für die Kommunikation zw. Proxykomponente und Authenttisierungskomponente - - - - - - enthält Parameter für die SOAP-Verbindung von der Proxy-Komponente zur Auth-Komponente (vgl. AuthComponent/MOA-SP/ConnectionParameter) - - - - - - - - - - - enthält Parameter für die OA - - - - - - - - - - - - - - - - - - - - - - - spezifiziert den Algorithmus ("pkix" oder "chaining") für die Zertifikatspfadvalidierung - - - - - - ein vom SystemDefaultMode abweichender ChiningMode kann für jeden TrustAnchor gesetzt werden - - - - - - - - - - - - - - - - verweist auf ein Verzeichnis, das vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate enthält. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter für die Kommunikation mit dem Security-Layer - - - - - - - - - - enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA SP Modul - - - - - - enthält Parameter für die SOAP-Verbindung von der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben werden; wird das Element nicht verwendet dann wird MOA-SP über das API aufgerufen - - - - - enthält Parameter für die Ãœberprüfung der Personenbindung - - - - - - - - - - enthält Parameter für die Ãœberprüfung des AUTH-Blocks - - - - - - - - - - - - - - enthält Informationen über akzeptierte Signers des IdentityLinks - - - - - - akzeptierte Signer des IdentityLinks werden per X509SubjectName (Kodierung nach RFC 2253) identifiziert - - - - - - - - enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen - - - - - - - - Default Verbindungsparameter zum SZR-Gateway (GetIdentityLink) - - - - - - - - - - das Attribut filename verweist auf eine Datei mit globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks inkludiert - - - - - - - - - - - - - das Attribut URL spezifiziert die Lage des Templates - - - - - - Verifikation zusätzlicher Infoboxen - - - - - Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen - - - - - - - - - - Parameter für Ãœberprüfung weiterer Infoboxen - - - - - - - Parameter zur Ãœberprüfung einzelner Infoboxen - - - - - optionalervName, der für Fehlermeldungen verwendet werden soll; z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird das Identifier-Attribut verwendet - - - - - TrustProfil, das für die Ãœberprüfung der Infobox verwendet werden soll - - - - - Validatorklasse, die für die Prüfung der Infobox verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname vom Default Package- und Klassennamen abweichen - - - - - - Infobox spezifische Parameter, die der jeweiligen Prüfapplikation übergeben werden - - - - - - - - - - Infobox spezifische Parameter, die der Prüfapplikation für berufliche Parteienvertretung übergeben werden. Dies ist logisch Teil der ApplicationSpecificParameters, kann jedoch aufgrund der Strukturierung validierend geparst werden und dadurch wird eine funktionierende Konfiguration bei Programmstart garantiert. - - - - - - Falls Infoboxinhalte für die berufliche Parteienvertretung in der Vollmachten Infobox "mandates" abgelegt werden und Vertretung für berufliche Parteienvertreter aktiviert ist, so kann mit diesem Schalter die Vollmachtsprüfung für normale Vollmachten deaktiviert werden. Damit wird erreicht, dass mittels der Vollmachten Infobox ausschließlich berufliche Parteienvertretung aktiviert ist. Dieser Schalter ist nur für die Vollmachten Infobox "mandates" relevant. - - - - - Eigentlicher Konfigurationsteil für berufliche Parteienvertretung - - - - - - - - - - - - - - Spezifiziert die Lage von XML Schemas - - - - - - - - - - - - - - - - enthält Parameter über die OA, die die Authentisierungs-Komponente betreffen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter über die OA, die die Proxy-Komponente betreffen - - - - - - enthält Parameter über die OA, die die Proxy-Komponente betreffen - - - - - - - - - - - - - - - - - - URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der TLS-Verbindung enthält (keine CA-Zertifikate) - - - - - - - - - - - - URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendet wird, enthält - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden - - - - - - - - - - - Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll - - - - - - - - - - Default InputProcessor. Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors - - - - - Default Wert für Formularanzeige. Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular zur vervollständigung der Vertretenendaten immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden - - - - - Default Verbindungsparameter zum SZR-Gateway (für den EGIZ-Demonstrator im internen Netzwerk: https://129.27.142.5:8443/szr-gateway/services/MandateCreation) - - - - - Falls keine speziellen beruflichen ParteienvertreterInnen definiert sind (Element kommt nicht vor), werden ausschließlich standardisierte Vollmachten mit einer MandateID="*" akzeptiert - - - - - - - - - Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors - - - - - - Optionale Verbindungsparameter zu speziellem (SZR-)Gateway - - - - - - OID der Parteienvertretung lt. "Object Identifier der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID muss mit der MandateID der übermittelten standardisierten Vollmacht übereinstimmen. Eine Parteienvertretung für standardisierte Vollmachten mit der MandateID "*" muss nicht definiert werden und erlaubt eine allgemeine berufliche Parteienvertretung mit Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels dieses Attributs zu definieren - - - - - - Legt fest, ob berufliche Parteienvertretung für natürliche Personen erlaubt ist - - - - - - - - Legt fest, ob berufliche Parteienvertretung für juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht vertreten darf und dieser Wert aus diesem Grund dort false sein muss) - - - - - - - - Beschreibender Text, der an Stelle des Standardtexts bei der Signatur der Anmeldedaten im Falle einer vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt wird - - - - - diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd new file mode 100644 index 000000000..dffca2167 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd @@ -0,0 +1,625 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der Proxy-Komponente zur Auth-Komponente (vgl. AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben werden; wird das Element nicht verwendet dann wird MOA-SP über das API aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen + + + + + + + + Default Verbindungsparameter zum SZR-Gateway (GetIdentityLink) + + + + + + + + + + das Attribut filename verweist auf eine Datei mit globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks inkludiert + + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + Verifikation zusätzlicher Infoboxen + + + + + Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen + + + + + + + + + + Parameter für Ãœberprüfung weiterer Infoboxen + + + + + + + Parameter zur Ãœberprüfung einzelner Infoboxen + + + + + optionalervName, der für Fehlermeldungen verwendet werden soll; z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird das Identifier-Attribut verwendet + + + + + TrustProfil, das für die Ãœberprüfung der Infobox verwendet werden soll + + + + + Validatorklasse, die für die Prüfung der Infobox verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname vom Default Package- und Klassennamen abweichen + + + + + + Infobox spezifische Parameter, die der jeweiligen Prüfapplikation übergeben werden + + + + + + + + + + Infobox spezifische Parameter, die der Prüfapplikation für berufliche Parteienvertretung übergeben werden. Dies ist logisch Teil der ApplicationSpecificParameters, kann jedoch aufgrund der Strukturierung validierend geparst werden und dadurch wird eine funktionierende Konfiguration bei Programmstart garantiert. + + + + + + Falls Infoboxinhalte für die berufliche Parteienvertretung in der Vollmachten Infobox "mandates" abgelegt werden und Vertretung für berufliche Parteienvertreter aktiviert ist, so kann mit diesem Schalter die Vollmachtsprüfung für normale Vollmachten deaktiviert werden. Damit wird erreicht, dass mittels der Vollmachten Infobox ausschließlich berufliche Parteienvertretung aktiviert ist. Dieser Schalter ist nur für die Vollmachten Infobox "mandates" relevant. + + + + + Eigentlicher Konfigurationsteil für berufliche Parteienvertretung + + + + + + + + + + + + + + Spezifiziert die Lage von XML Schemas + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Authentisierungs-Komponente betreffen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendet wird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + + + + + + + Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll + + + + + + + + + + Default InputProcessor. Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + Default Wert für Formularanzeige. Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular zur vervollständigung der Vertretenendaten immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + Default Verbindungsparameter zum SZR-Gateway (für den EGIZ-Demonstrator im internen Netzwerk: https://129.27.142.5:8443/szr-gateway/services/MandateCreation) + + + + + Falls keine speziellen beruflichen ParteienvertreterInnen definiert sind (Element kommt nicht vor), werden ausschließlich standardisierte Vollmachten mit einer MandateID="*" akzeptiert + + + + + + + + + Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + + Optionale Verbindungsparameter zu speziellem (SZR-)Gateway + + + + + + OID der Parteienvertretung lt. "Object Identifier der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID muss mit der MandateID der übermittelten standardisierten Vollmacht übereinstimmen. Eine Parteienvertretung für standardisierte Vollmachten mit der MandateID "*" muss nicht definiert werden und erlaubt eine allgemeine berufliche Parteienvertretung mit Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels dieses Attributs zu definieren + + + + + + Legt fest, ob berufliche Parteienvertretung für natürliche Personen erlaubt ist + + + + + + + + Legt fest, ob berufliche Parteienvertretung für juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht vertreten darf und dieser Wert aus diesem Grund dort false sein muss) + + + + + + + + Beschreibender Text, der an Stelle des Standardtexts bei der Signatur der Anmeldedaten im Falle einer vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt wird + + + + + -- cgit v1.2.3 From 3e3f35ebc780085b2c6a4064adf708fee1b5d5d7 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 13 Jul 2010 07:35:08 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1168 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../schemas/MOA-ID-Configuration-1.4.7.xsd | 625 +++++++++++++++++++++ .../schemas/MOA-ID-Configuration-1.5.0.xsd | 625 --------------------- 2 files changed, 625 insertions(+), 625 deletions(-) create mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.7.xsd delete mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd (limited to 'common/src') diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.7.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.7.xsd new file mode 100644 index 000000000..dffca2167 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.4.7.xsd @@ -0,0 +1,625 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der Proxy-Komponente zur Auth-Komponente (vgl. AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben werden; wird das Element nicht verwendet dann wird MOA-SP über das API aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen + + + + + + + + Default Verbindungsparameter zum SZR-Gateway (GetIdentityLink) + + + + + + + + + + das Attribut filename verweist auf eine Datei mit globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks inkludiert + + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + Verifikation zusätzlicher Infoboxen + + + + + Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen + + + + + + + + + + Parameter für Ãœberprüfung weiterer Infoboxen + + + + + + + Parameter zur Ãœberprüfung einzelner Infoboxen + + + + + optionalervName, der für Fehlermeldungen verwendet werden soll; z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird das Identifier-Attribut verwendet + + + + + TrustProfil, das für die Ãœberprüfung der Infobox verwendet werden soll + + + + + Validatorklasse, die für die Prüfung der Infobox verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname vom Default Package- und Klassennamen abweichen + + + + + + Infobox spezifische Parameter, die der jeweiligen Prüfapplikation übergeben werden + + + + + + + + + + Infobox spezifische Parameter, die der Prüfapplikation für berufliche Parteienvertretung übergeben werden. Dies ist logisch Teil der ApplicationSpecificParameters, kann jedoch aufgrund der Strukturierung validierend geparst werden und dadurch wird eine funktionierende Konfiguration bei Programmstart garantiert. + + + + + + Falls Infoboxinhalte für die berufliche Parteienvertretung in der Vollmachten Infobox "mandates" abgelegt werden und Vertretung für berufliche Parteienvertreter aktiviert ist, so kann mit diesem Schalter die Vollmachtsprüfung für normale Vollmachten deaktiviert werden. Damit wird erreicht, dass mittels der Vollmachten Infobox ausschließlich berufliche Parteienvertretung aktiviert ist. Dieser Schalter ist nur für die Vollmachten Infobox "mandates" relevant. + + + + + Eigentlicher Konfigurationsteil für berufliche Parteienvertretung + + + + + + + + + + + + + + Spezifiziert die Lage von XML Schemas + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Authentisierungs-Komponente betreffen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendet wird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + + + + + + + Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll + + + + + + + + + + Default InputProcessor. Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + Default Wert für Formularanzeige. Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular zur vervollständigung der Vertretenendaten immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + Default Verbindungsparameter zum SZR-Gateway (für den EGIZ-Demonstrator im internen Netzwerk: https://129.27.142.5:8443/szr-gateway/services/MandateCreation) + + + + + Falls keine speziellen beruflichen ParteienvertreterInnen definiert sind (Element kommt nicht vor), werden ausschließlich standardisierte Vollmachten mit einer MandateID="*" akzeptiert + + + + + + + + + Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + + Optionale Verbindungsparameter zu speziellem (SZR-)Gateway + + + + + + OID der Parteienvertretung lt. "Object Identifier der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID muss mit der MandateID der übermittelten standardisierten Vollmacht übereinstimmen. Eine Parteienvertretung für standardisierte Vollmachten mit der MandateID "*" muss nicht definiert werden und erlaubt eine allgemeine berufliche Parteienvertretung mit Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels dieses Attributs zu definieren + + + + + + Legt fest, ob berufliche Parteienvertretung für natürliche Personen erlaubt ist + + + + + + + + Legt fest, ob berufliche Parteienvertretung für juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht vertreten darf und dieser Wert aus diesem Grund dort false sein muss) + + + + + + + + Beschreibender Text, der an Stelle des Standardtexts bei der Signatur der Anmeldedaten im Falle einer vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt wird + + + + + diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd deleted file mode 100644 index dffca2167..000000000 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd +++ /dev/null @@ -1,625 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter der Authentisierungs-Komponente - - - - - enthält Konfigurationsparameter der Proxy-Komponente - - - - - - enthält Parameter für die Kommunikation zw. Proxykomponente und Authenttisierungskomponente - - - - - - enthält Parameter für die SOAP-Verbindung von der Proxy-Komponente zur Auth-Komponente (vgl. AuthComponent/MOA-SP/ConnectionParameter) - - - - - - - - - - - enthält Parameter für die OA - - - - - - - - - - - - - - - - - - - - - - - spezifiziert den Algorithmus ("pkix" oder "chaining") für die Zertifikatspfadvalidierung - - - - - - ein vom SystemDefaultMode abweichender ChiningMode kann für jeden TrustAnchor gesetzt werden - - - - - - - - - - - - - - - - verweist auf ein Verzeichnis, das vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate enthält. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter für die Kommunikation mit dem Security-Layer - - - - - - - - - - enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA SP Modul - - - - - - enthält Parameter für die SOAP-Verbindung von der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben werden; wird das Element nicht verwendet dann wird MOA-SP über das API aufgerufen - - - - - enthält Parameter für die Ãœberprüfung der Personenbindung - - - - - - - - - - enthält Parameter für die Ãœberprüfung des AUTH-Blocks - - - - - - - - - - - - - - enthält Informationen über akzeptierte Signers des IdentityLinks - - - - - - akzeptierte Signer des IdentityLinks werden per X509SubjectName (Kodierung nach RFC 2253) identifiziert - - - - - - - - enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen - - - - - - - - Default Verbindungsparameter zum SZR-Gateway (GetIdentityLink) - - - - - - - - - - das Attribut filename verweist auf eine Datei mit globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks inkludiert - - - - - - - - - - - - - das Attribut URL spezifiziert die Lage des Templates - - - - - - Verifikation zusätzlicher Infoboxen - - - - - Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen - - - - - - - - - - Parameter für Ãœberprüfung weiterer Infoboxen - - - - - - - Parameter zur Ãœberprüfung einzelner Infoboxen - - - - - optionalervName, der für Fehlermeldungen verwendet werden soll; z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird das Identifier-Attribut verwendet - - - - - TrustProfil, das für die Ãœberprüfung der Infobox verwendet werden soll - - - - - Validatorklasse, die für die Prüfung der Infobox verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname vom Default Package- und Klassennamen abweichen - - - - - - Infobox spezifische Parameter, die der jeweiligen Prüfapplikation übergeben werden - - - - - - - - - - Infobox spezifische Parameter, die der Prüfapplikation für berufliche Parteienvertretung übergeben werden. Dies ist logisch Teil der ApplicationSpecificParameters, kann jedoch aufgrund der Strukturierung validierend geparst werden und dadurch wird eine funktionierende Konfiguration bei Programmstart garantiert. - - - - - - Falls Infoboxinhalte für die berufliche Parteienvertretung in der Vollmachten Infobox "mandates" abgelegt werden und Vertretung für berufliche Parteienvertreter aktiviert ist, so kann mit diesem Schalter die Vollmachtsprüfung für normale Vollmachten deaktiviert werden. Damit wird erreicht, dass mittels der Vollmachten Infobox ausschließlich berufliche Parteienvertretung aktiviert ist. Dieser Schalter ist nur für die Vollmachten Infobox "mandates" relevant. - - - - - Eigentlicher Konfigurationsteil für berufliche Parteienvertretung - - - - - - - - - - - - - - Spezifiziert die Lage von XML Schemas - - - - - - - - - - - - - - - - enthält Parameter über die OA, die die Authentisierungs-Komponente betreffen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enthält Parameter über die OA, die die Proxy-Komponente betreffen - - - - - - enthält Parameter über die OA, die die Proxy-Komponente betreffen - - - - - - - - - - - - - - - - - - URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der TLS-Verbindung enthält (keine CA-Zertifikate) - - - - - - - - - - - - URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendet wird, enthält - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden - - - - - - - - - - - Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll - - - - - - - - - - Default InputProcessor. Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors - - - - - Default Wert für Formularanzeige. Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular zur vervollständigung der Vertretenendaten immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden - - - - - Default Verbindungsparameter zum SZR-Gateway (für den EGIZ-Demonstrator im internen Netzwerk: https://129.27.142.5:8443/szr-gateway/services/MandateCreation) - - - - - Falls keine speziellen beruflichen ParteienvertreterInnen definiert sind (Element kommt nicht vor), werden ausschließlich standardisierte Vollmachten mit einer MandateID="*" akzeptiert - - - - - - - - - Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors - - - - - - Optionale Verbindungsparameter zu speziellem (SZR-)Gateway - - - - - - OID der Parteienvertretung lt. "Object Identifier der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID muss mit der MandateID der übermittelten standardisierten Vollmacht übereinstimmen. Eine Parteienvertretung für standardisierte Vollmachten mit der MandateID "*" muss nicht definiert werden und erlaubt eine allgemeine berufliche Parteienvertretung mit Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels dieses Attributs zu definieren - - - - - - Legt fest, ob berufliche Parteienvertretung für natürliche Personen erlaubt ist - - - - - - - - Legt fest, ob berufliche Parteienvertretung für juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht vertreten darf und dieser Wert aus diesem Grund dort false sein muss) - - - - - - - - Beschreibender Text, der an Stelle des Standardtexts bei der Signatur der Anmeldedaten im Falle einer vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt wird - - - - - -- cgit v1.2.3 From 4aa19048995f9ddca2f8943287a681992a55b79a Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 13 Jul 2010 09:38:55 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1169 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../resources/resources/schemas/MOA-SPSS-1.4.7.xsd | 18 +----------------- .../resources/schemas/MOA-SPSS-config-1.4.7.xsd | 6 ++---- 2 files changed, 3 insertions(+), 21 deletions(-) (limited to 'common/src') diff --git a/common/src/main/resources/resources/schemas/MOA-SPSS-1.4.7.xsd b/common/src/main/resources/resources/schemas/MOA-SPSS-1.4.7.xsd index e3b06b416..653bec578 100644 --- a/common/src/main/resources/resources/schemas/MOA-SPSS-1.4.7.xsd +++ b/common/src/main/resources/resources/schemas/MOA-SPSS-1.4.7.xsd @@ -107,14 +107,6 @@ - - - - - - - - @@ -169,15 +161,7 @@ - - - - - - - - - + diff --git a/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.7.xsd b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.7.xsd index a61eed289..4808f3cb7 100644 --- a/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.7.xsd +++ b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.4.7.xsd @@ -1,7 +1,6 @@ - @@ -140,7 +139,6 @@ - @@ -154,7 +152,7 @@ - + -- cgit v1.2.3 From 7848a953758fe645da5abc16eb8abff1fdc11da8 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 27 Jul 2010 20:15:31 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1177 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../main/java/at/gv/egovernment/moa/util/DOMUtils.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java index b403961d8..39cdf4e87 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java @@ -378,6 +378,24 @@ public class DOMUtils { .parseDocument(inputStream, true, Constants.ALL_SCHEMA_LOCATIONS, null) .getDocumentElement(); } + + /** + * A convenience method to parse an XML document non validating. + * + * @param inputStream The InputStream containing the XML + * document. + * @return The root element of the parsed XML document. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Element parseXmlNonValidating(InputStream inputStream) + throws ParserConfigurationException, SAXException, IOException { + return DOMUtils + .parseDocument(inputStream, false, Constants.ALL_SCHEMA_LOCATIONS, null) + .getDocumentElement(); + } /** * Schema validate a given DOM element. -- cgit v1.2.3 From 603062486b241bc852d6639a06004c31ad3f9d2b Mon Sep 17 00:00:00 2001 From: mcentner Date: Thu, 26 Aug 2010 14:48:05 +0000 Subject: Added XAdES schema files for versions 1.2.2 to 1.4.1. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1189 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/Constants.java | 33 +- .../resources/resources/schemas/XAdES-1.1.1.xsd | 545 ++++++++++++++++++++ .../resources/resources/schemas/XAdES-1.2.2.xsd | 551 +++++++++++++++++++++ .../resources/resources/schemas/XAdES-1.3.2.xsd | 466 +++++++++++++++++ .../resources/resources/schemas/XAdES-1.4.1.xsd | 15 + 5 files changed, 1609 insertions(+), 1 deletion(-) create mode 100644 common/src/main/resources/resources/schemas/XAdES-1.1.1.xsd create mode 100644 common/src/main/resources/resources/schemas/XAdES-1.2.2.xsd create mode 100644 common/src/main/resources/resources/schemas/XAdES-1.3.2.xsd create mode 100644 common/src/main/resources/resources/schemas/XAdES-1.4.1.xsd (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index 6a42720c0..cfc4a762f 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -248,7 +248,34 @@ public interface Constants { /** Local location of the XMLLoginParameterResolver Configuration XML schema definition */ public static final String XMLLPR_SCHEMA_LOCATION = SCHEMA_ROOT + "MOAIdentities.xsd"; + + /** Local location of the XAdES v1.1.1 schema definition */ + public static final String XADES_1_1_1_SCHEMA_LOCATION = + SCHEMA_ROOT + "XAdES-1.1.1.xsd"; + /** URI of the XAdES v1.1.1 namespace */ + public static final String XADES_1_1_1_NS_URI = "http://uri.etsi.org/01903/v1.1.1#"; + + /** Local location of the XAdES v1.2.2 schema definition */ + public static final String XADES_1_2_2_SCHEMA_LOCATION = + SCHEMA_ROOT + "XAdES-1.2.2.xsd"; + + /** URI of the XAdES v1.2.2 namespace */ + public static final String XADES_1_2_2_NS_URI = "http://uri.etsi.org/01903/v1.2.2#"; + + /** Local location of the XAdES v1.1.1 schema definition */ + public static final String XADES_1_3_2_SCHEMA_LOCATION = + SCHEMA_ROOT + "XAdES-1.3.2.xsd"; + + /** URI of the XAdES v1.3.2 namespace */ + public static final String XADES_1_3_2_NS_URI = "http://uri.etsi.org/01903/v1.3.2#"; + + /** Local location of the XAdES v1.4.1 schema definition */ + public static final String XADES_1_4_1_SCHEMA_LOCATION = + SCHEMA_ROOT + "XAdES-1.4.1.xsd"; + + /** URI of the XAdES v1.4.1 namespace */ + public static final String XADES_1_4_1_NS_URI = "http://uri.etsi.org/01903/v1.4.1#"; /** * Contains all namespaces and local schema locations for XML schema @@ -270,7 +297,11 @@ public interface Constants { + (DSIG_NS_URI + " " + DSIG_SCHEMA_LOCATION + " ") + (DSIG_FILTER2_NS_URI + " " + DSIG_FILTER2_SCHEMA_LOCATION + " ") + (DSIG_EC_NS_URI + " " + DSIG_EC_SCHEMA_LOCATION + " ") - + (XMLLPR_NS_URI + " " + XMLLPR_SCHEMA_LOCATION); + + (XMLLPR_NS_URI + " " + XMLLPR_SCHEMA_LOCATION + " ") + + (XADES_1_1_1_NS_URI + " " + XADES_1_1_1_SCHEMA_LOCATION + " ") + + (XADES_1_2_2_NS_URI + " " + XADES_1_2_2_SCHEMA_LOCATION + " ") + + (XADES_1_3_2_NS_URI + " " + XADES_1_3_2_SCHEMA_LOCATION + " ") + + (XADES_1_4_1_NS_URI + " " + XADES_1_4_1_SCHEMA_LOCATION); /** URN prefix for bPK and wbPK. */ public static final String URN_PREFIX = "urn:publicid:gv.at"; diff --git a/common/src/main/resources/resources/schemas/XAdES-1.1.1.xsd b/common/src/main/resources/resources/schemas/XAdES-1.1.1.xsd new file mode 100644 index 000000000..718061048 --- /dev/null +++ b/common/src/main/resources/resources/schemas/XAdES-1.1.1.xsd @@ -0,0 +1,545 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/XAdES-1.2.2.xsd b/common/src/main/resources/resources/schemas/XAdES-1.2.2.xsd new file mode 100644 index 000000000..80ccf1289 --- /dev/null +++ b/common/src/main/resources/resources/schemas/XAdES-1.2.2.xsd @@ -0,0 +1,551 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/XAdES-1.3.2.xsd b/common/src/main/resources/resources/schemas/XAdES-1.3.2.xsd new file mode 100644 index 000000000..d0ce075de --- /dev/null +++ b/common/src/main/resources/resources/schemas/XAdES-1.3.2.xsd @@ -0,0 +1,466 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/src/main/resources/resources/schemas/XAdES-1.4.1.xsd b/common/src/main/resources/resources/schemas/XAdES-1.4.1.xsd new file mode 100644 index 000000000..383fcbdec --- /dev/null +++ b/common/src/main/resources/resources/schemas/XAdES-1.4.1.xsd @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + -- cgit v1.2.3 From ab7c7b6a64edca60b78a89b18a1972ad5e38586e Mon Sep 17 00:00:00 2001 From: kstranacher Date: Fri, 1 Apr 2011 08:03:14 +0000 Subject: =?UTF-8?q?-=20Update=20Parameter=C3=BCberpr=C3=BCfung=20-=20Updat?= =?UTF-8?q?e=20MOA-Template=20zur=20B=C3=BCrgerkartenauswahl=20-=20=C3=84n?= =?UTF-8?q?derung=20der=20Konfiguration=20f=C3=BCr:=20=09-=20Angabe=20eine?= =?UTF-8?q?r=20Liste=20von=20vertrauensw=C3=BCrdigen=20BKUs=20(aufgrund=20?= =?UTF-8?q?Parameterpr=C3=BCfung)=20-=20Fixed=20Bug=20#552=20(http://egovl?= =?UTF-8?q?abs.gv.at/tracker/index.php=3Ffunc=3Ddetail&aid=3D552&group=5Fi?= =?UTF-8?q?d=3D6&atid=3D105)=20-=20Fixed=20Bug=20#551=20(http://egovlabs.g?= =?UTF-8?q?v.at/tracker/index.php=3Ffunc=3Ddetail&aid=3D551&group=5Fid=3D6?= =?UTF-8?q?&atid=3D105)=20-=20Fixed=20Bug=20#550=20(http://egovlabs.gv.at/?= =?UTF-8?q?tracker/index.php=3Ffunc=3Ddetail&aid=3D550&group=5Fid=3D6&atid?= =?UTF-8?q?=3D105)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1198 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/Constants.java | 2 +- .../schemas/MOA-ID-Configuration-1.5.0.xsd | 631 +++++++++++++++++++++ 2 files changed, 632 insertions(+), 1 deletion(-) create mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index cfc4a762f..cf7824562 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -96,7 +96,7 @@ public interface Constants { /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.4.7.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.5.0.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd new file mode 100644 index 000000000..9078bab98 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd @@ -0,0 +1,631 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der Proxy-Komponente zur Auth-Komponente (vgl. AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben werden; wird das Element nicht verwendet dann wird MOA-SP über das API aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen + + + + + + + + Default Verbindungsparameter zum SZR-Gateway (GetIdentityLink) + + + + + + + + + + das Attribut filename verweist auf eine Datei mit globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks inkludiert + + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + Verifikation zusätzlicher Infoboxen + + + + + Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen + + + + + + + + + + Parameter für Ãœberprüfung weiterer Infoboxen + + + + + + + Parameter zur Ãœberprüfung einzelner Infoboxen + + + + + optionalervName, der für Fehlermeldungen verwendet werden soll; z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird das Identifier-Attribut verwendet + + + + + TrustProfil, das für die Ãœberprüfung der Infobox verwendet werden soll + + + + + Validatorklasse, die für die Prüfung der Infobox verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname vom Default Package- und Klassennamen abweichen + + + + + + Infobox spezifische Parameter, die der jeweiligen Prüfapplikation übergeben werden + + + + + + + + + + Infobox spezifische Parameter, die der Prüfapplikation für berufliche Parteienvertretung übergeben werden. Dies ist logisch Teil der ApplicationSpecificParameters, kann jedoch aufgrund der Strukturierung validierend geparst werden und dadurch wird eine funktionierende Konfiguration bei Programmstart garantiert. + + + + + + Falls Infoboxinhalte für die berufliche Parteienvertretung in der Vollmachten Infobox "mandates" abgelegt werden und Vertretung für berufliche Parteienvertreter aktiviert ist, so kann mit diesem Schalter die Vollmachtsprüfung für normale Vollmachten deaktiviert werden. Damit wird erreicht, dass mittels der Vollmachten Infobox ausschließlich berufliche Parteienvertretung aktiviert ist. Dieser Schalter ist nur für die Vollmachten Infobox "mandates" relevant. + + + + + Eigentlicher Konfigurationsteil für berufliche Parteienvertretung + + + + + + + + + + + + + + Spezifiziert die Lage von XML Schemas + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Authentisierungs-Komponente betreffen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendet wird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + + + + + + + Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll + + + + + + + + + + Default InputProcessor. Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + Default Wert für Formularanzeige. Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular zur vervollständigung der Vertretenendaten immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + Default Verbindungsparameter zum SZR-Gateway (für den EGIZ-Demonstrator im internen Netzwerk: https://129.27.142.5:8443/szr-gateway/services/MandateCreation) + + + + + Falls keine speziellen beruflichen ParteienvertreterInnen definiert sind (Element kommt nicht vor), werden ausschließlich standardisierte Vollmachten mit einer MandateID="*" akzeptiert + + + + + + + + + Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + + Optionale Verbindungsparameter zu speziellem (SZR-)Gateway + + + + + + OID der Parteienvertretung lt. "Object Identifier der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID muss mit der MandateID der übermittelten standardisierten Vollmacht übereinstimmen. Eine Parteienvertretung für standardisierte Vollmachten mit der MandateID "*" muss nicht definiert werden und erlaubt eine allgemeine berufliche Parteienvertretung mit Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels dieses Attributs zu definieren + + + + + + Legt fest, ob berufliche Parteienvertretung für natürliche Personen erlaubt ist + + + + + + + + Legt fest, ob berufliche Parteienvertretung für juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht vertreten darf und dieser Wert aus diesem Grund dort false sein muss) + + + + + + + + Beschreibender Text, der an Stelle des Standardtexts bei der Signatur der Anmeldedaten im Falle einer vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt wird + + + + + -- cgit v1.2.3 From ac9a6c52e96f4c737de3392a7ba16b8fa8958b85 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Wed, 6 Apr 2011 15:29:11 +0000 Subject: =?UTF-8?q?-=20IAIK=20Libraries=20(repository)=20aktualisiert:=20?= =?UTF-8?q?=09iaik-moa:=20=20=20=20=20=20=20=20=20=20=20Version=201.29=20?= =?UTF-8?q?=09iaik=5Fjce=5Ffull:=09=09Version=204.0=5FMOA=20=09iaik=5Fcms:?= =?UTF-8?q?=09=09=09Version=204.1=5FMOA=20-=20Einbindung=20von=20Online-Vo?= =?UTF-8?q?llmachten=20-=20Update=20MOA-Template=20zur=20B=C3=BCrgerkarten?= =?UTF-8?q?auswahl=20-=20Update=20Doku=20-=20Update=20Transformationen=20(?= =?UTF-8?q?f=C3=BCr=20Online-Vollmachten)=20-=20=C3=84nderung=20der=20Konf?= =?UTF-8?q?iguration=20f=C3=BCr:=20=09-=20Online-Vollmachten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1199 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/DOMUtils.java | 80 +++++++++++++++++++--- .../schemas/MOA-ID-Configuration-1.5.0.xsd | 23 ++++++- 2 files changed, 92 insertions(+), 11 deletions(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java index 39cdf4e87..c5daacdc3 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java @@ -19,6 +19,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.StringWriter; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -31,20 +32,15 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; +import javax.xml.transform.Result; +import javax.xml.transform.Source; import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentFragment; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - import org.apache.xerces.parsers.DOMParser; import org.apache.xerces.parsers.SAXParser; import org.apache.xerces.parsers.XMLGrammarPreparser; @@ -53,12 +49,18 @@ import org.apache.xerces.util.XMLGrammarPoolImpl; import org.apache.xerces.xni.grammars.XMLGrammarDescription; import org.apache.xerces.xni.grammars.XMLGrammarPool; import org.apache.xerces.xni.parser.XMLInputSource; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentFragment; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; - import at.gv.egovernment.moa.logging.Logger; /** @@ -255,6 +257,48 @@ public class DOMUtils { return parser.getDocument(); } + /** + * Parse an XML document from an InputStream. + * + * @param inputStream The InputStream containing the XML + * document. + * @param validating If true, parse validating. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @param entityResolver An EntityResolver to resolve external + * entities (schemas and DTDs). If null, it will not be set. + * @param errorHandler An ErrorHandler to decide what to do + * with parsing errors. If null, it will not be set. + * @return The parsed XML document as a DOM tree. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document. + * @throws ParserConfigurationException An error occurred configuring the XML + * parser. + */ + public static Document parseDocumentSimple(InputStream inputStream) + throws SAXException, IOException, ParserConfigurationException { + + DOMParser parser; + + parser = new DOMParser(); + // set parser features and properties + parser.setFeature(NAMESPACES_FEATURE, true); + parser.setFeature(VALIDATION_FEATURE, false); + parser.setFeature(SCHEMA_VALIDATION_FEATURE, false); + parser.setFeature(NORMALIZED_VALUE_FEATURE, false); + parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); + parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); + + parser.parse(new InputSource(inputStream)); + + return parser.getDocument(); + } + + /** * Parse an XML document from an InputStream. * @@ -1000,5 +1044,23 @@ public class DOMUtils { } return v; } + + /** + * Returns a byte array from given node. + * @param node + * @return + * @throws TransformerException + */ + public static byte[] nodeToByteArray(Node node) throws TransformerException { + Source source = new DOMSource(node); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + //StringWriter stringWriter = new StringWriter(); + Result result = new StreamResult(out); + TransformerFactory factory = TransformerFactory.newInstance(); + Transformer transformer = factory.newTransformer(); + transformer.transform(source, result); + return out.toByteArray(); + } + } diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd index 9078bab98..2e4c33c03 100644 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd @@ -1,4 +1,5 @@ + @@ -190,7 +191,7 @@ - + @@ -277,7 +278,18 @@ - Default Verbindungsparameter zum SZR-Gateway (GetIdentityLink) + Verbindungsparameter zum SZR-Gateway (GetIdentityLink) + + + + + + + + + + + Verbindungsparameter zum Online-Vollmachten-Service @@ -433,6 +445,13 @@ + + + + + + + -- cgit v1.2.3 From 9bbe4aa713e2c38dcfba02880c9b2cb63e82a859 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 21 Jun 2011 15:40:44 +0000 Subject: =?UTF-8?q?*=20Update=20MOA-ID=20(Template=20Mechanismus=20f=C3=BC?= =?UTF-8?q?r=20Online-Vollmachten=20inkl.=20MOA-ID=20Config)=20*=20Update?= =?UTF-8?q?=20BK-Auswahl=20Howto=20*=20Update=20Default-Konfigurationen=20?= =?UTF-8?q?*=20L=C3=B6schen=20von=20A1-Signatur=20Texten=20*=20Entfernung?= =?UTF-8?q?=20von=20tempates.war?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1206 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../resources/schemas/MOA-ID-Configuration-1.5.0.xsd | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'common/src') diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd index 2e4c33c03..19b793fdb 100644 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.0.xsd @@ -308,6 +308,21 @@ + + + + + + + + + + + + + + + -- cgit v1.2.3 From 573f2a66407e2814e9c89e76af20da626501a8d2 Mon Sep 17 00:00:00 2001 From: tkellner Date: Tue, 21 Jun 2011 16:18:42 +0000 Subject: Copyright notice changed/added git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1207 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/logging/LogMsg.java | 37 ++++++++++++++-------- .../java/at/gv/egovernment/moa/logging/Logger.java | 37 ++++++++++++++-------- .../gv/egovernment/moa/logging/LoggingContext.java | 37 ++++++++++++++-------- .../moa/logging/LoggingContextManager.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/Base64Utils.java | 37 ++++++++++++++-------- .../java/at/gv/egovernment/moa/util/BoolUtils.java | 37 ++++++++++++++-------- .../gv/egovernment/moa/util/CollectionUtils.java | 37 ++++++++++++++-------- .../java/at/gv/egovernment/moa/util/Constants.java | 37 ++++++++++++++-------- .../java/at/gv/egovernment/moa/util/DOMUtils.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/DateTimeUtils.java | 37 ++++++++++++++-------- .../egovernment/moa/util/EntityResolverChain.java | 37 ++++++++++++++-------- .../java/at/gv/egovernment/moa/util/FileUtils.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/KeyStoreUtils.java | 37 ++++++++++++++-------- .../gv/egovernment/moa/util/MOADefaultHandler.java | 37 ++++++++++++++-------- .../gv/egovernment/moa/util/MOAEntityResolver.java | 37 ++++++++++++++-------- .../gv/egovernment/moa/util/MOAErrorHandler.java | 37 ++++++++++++++-------- .../java/at/gv/egovernment/moa/util/MOATimer.java | 37 ++++++++++++++-------- .../gv/egovernment/moa/util/MessageProvider.java | 37 ++++++++++++++-------- .../java/at/gv/egovernment/moa/util/Messages.java | 37 ++++++++++++++-------- .../egovernment/moa/util/NodeIteratorAdapter.java | 37 ++++++++++++++-------- .../gv/egovernment/moa/util/NodeListAdapter.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/OutputXML2File.java | 37 ++++++++++++++-------- .../egovernment/moa/util/ResourceBundleChain.java | 37 ++++++++++++++-------- .../java/at/gv/egovernment/moa/util/SSLUtils.java | 37 ++++++++++++++-------- .../egovernment/moa/util/StreamEntityResolver.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/StreamUtils.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/StringUtils.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/URLDecoder.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/URLEncoder.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/XPathException.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/XPathUtils.java | 37 ++++++++++++++-------- .../java/test/at/gv/egovernment/moa/AllTests.java | 37 ++++++++++++++-------- .../test/at/gv/egovernment/moa/MOATestCase.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/DOMUtilsTest.java | 37 ++++++++++++++-------- .../gv/egovernment/moa/util/DateTimeUtilsTest.java | 37 ++++++++++++++-------- .../gv/egovernment/moa/util/KeyStoreUtilsTest.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/SSLUtilsTest.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/URLDecoderTest.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/URLEncoderTest.java | 37 ++++++++++++++-------- .../moa/util/XMLGrammarBuilderTest.java | 37 ++++++++++++++-------- .../at/gv/egovernment/moa/util/XPathUtilsTest.java | 37 ++++++++++++++-------- 41 files changed, 943 insertions(+), 574 deletions(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java b/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java index 890bbeff7..51667f010 100644 --- a/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java +++ b/common/src/main/java/at/gv/egovernment/moa/logging/LogMsg.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.logging; /** diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java b/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java index dd36bfc4b..07f9e27af 100644 --- a/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java +++ b/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.logging; import org.apache.commons.logging.Log; diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java b/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java index 249c80184..db4b93a0b 100644 --- a/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java +++ b/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContext.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.logging; /** diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java b/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java index ef37dc6ba..f0d7b4c07 100644 --- a/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java +++ b/common/src/main/java/at/gv/egovernment/moa/logging/LoggingContextManager.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.logging; /** diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java b/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java index 3729881f7..27f12ab0f 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Base64Utils.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.ByteArrayInputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java index 8776442a3..492aca994 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/BoolUtils.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; /** diff --git a/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java index 7a4c3850f..8597e1eec 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/CollectionUtils.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.util.Iterator; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index cf7824562..08ca3fd0d 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.util.HashMap; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java index c5daacdc3..936423724 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.ByteArrayInputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java index 88133832a..92e845967 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.StringWriter; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java b/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java index 88932494d..7213d036b 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/EntityResolverChain.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.IOException; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java index 1368b41d2..58a07f5e6 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.BufferedInputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java index b08feaffb..78fe8a345 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import iaik.x509.X509Certificate; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java b/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java index c6b0a3c32..7a79bd9e5 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.IOException; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java b/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java index 02302cb65..ae83a551d 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.InputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java b/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java index 4885fedb7..ba253edb5 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import org.apache.xml.utils.DefaultErrorHandler; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java b/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java index a2ec7386c..acc380d1d 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOATimer.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.util.Map; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java b/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java index dde220a6e..1623ff1b3 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MessageProvider.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.util.Locale; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Messages.java b/common/src/main/java/at/gv/egovernment/moa/util/Messages.java index 476f75046..94dc3ab47 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Messages.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Messages.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.text.MessageFormat; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java b/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java index 1ca222d94..fdc823229 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.util.ListIterator; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java b/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java index 8e1d7dd8a..e39cc0291 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.util.List; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java b/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java index 6663f7a3c..e3f8f75a1 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/OutputXML2File.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + /* * Created on 26.04.2004 * diff --git a/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java b/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java index 609c873ff..234ed89df 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/ResourceBundleChain.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.util.ArrayList; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java index a7937b1bd..c2c67ec58 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/SSLUtils.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.IOException; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java b/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java index 6fd67e97a..b3bc8ae47 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/StreamEntityResolver.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.IOException; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java index 0300dcd2d..e4ccd127f 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.ByteArrayOutputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java index dbc2b5011..ad879d2b6 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/StringUtils.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.util.StringTokenizer; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/URLDecoder.java b/common/src/main/java/at/gv/egovernment/moa/util/URLDecoder.java index 2fc721db9..66739a7a4 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/URLDecoder.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/URLDecoder.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.ByteArrayOutputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java b/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java index f73936487..3255b3157 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/URLEncoder.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.ByteArrayInputStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java b/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java index 6899dfd9b..fae91d035 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.io.PrintStream; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java index 01fe3a3aa..7a72c0bfb 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package at.gv.egovernment.moa.util; import java.util.List; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java b/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java index 0e703b1bb..949258360 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/AllTests.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package test.at.gv.egovernment.moa; import test.at.gv.egovernment.moa.util.DOMUtilsTest; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java b/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java index 42e5e0230..5d1c5371a 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package test.at.gv.egovernment.moa; import java.io.FileInputStream; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java index 8e301e41c..1a2b6904d 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package test.at.gv.egovernment.moa.util; import java.io.FileInputStream; import java.util.Map; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java index 0b0f3fcf8..8fdd389a2 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package test.at.gv.egovernment.moa.util; import java.text.DateFormat; import java.text.ParseException; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java index 8a4b17368..2433eca89 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package test.at.gv.egovernment.moa.util; import java.io.File; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java index e44d4ff7c..8e5b9f82a 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package test.at.gv.egovernment.moa.util; import java.io.FileInputStream; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java index ee7444f11..59163f112 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/URLDecoderTest.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package test.at.gv.egovernment.moa.util; import java.net.URLEncoder; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java index f5fbf4537..88c74f3ae 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/URLEncoderTest.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package test.at.gv.egovernment.moa.util; import at.gv.egovernment.moa.util.FileUtils; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java index 598948543..dfe7a5358 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/XMLGrammarBuilderTest.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package test.at.gv.egovernment.moa.util; import java.io.FileInputStream; import java.io.InputStream; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java index dcd107f1a..15e6a62f3 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java @@ -1,18 +1,27 @@ /* -* Copyright 2003 Federal Chancellery Austria -* -* 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 2003 Federal Chancellery Austria + * MOA-ID has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + package test.at.gv.egovernment.moa.util; import org.w3c.dom.Document; import org.w3c.dom.NodeList; -- cgit v1.2.3 From 9b0b76abd6bdd88383e465117086d65268c25562 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Wed, 31 Aug 2011 14:45:52 +0000 Subject: Update Axis-Lib von 1.0 auf 1.1 aufgrund XXE (Xml eXternal Entity) Injection git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1214 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/main/java/at/gv/egovernment/moa/util/DOMUtils.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java index 936423724..5fa31336b 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java @@ -200,6 +200,13 @@ public class DOMUtils { DOMParser parser; +// class MyEntityResolver implements EntityResolver { +// +// public InputSource resolveEntity(String publicId, String systemId) +// throws SAXException, IOException { +// return new InputSource(new ByteArrayInputStream(new byte[0])); +// } +// } //if Debug is enabled make a copy of inputStream to enable debug output in case of SAXException @@ -218,7 +225,7 @@ public class DOMUtils { } else { parser = new DOMParser(); } - + // set parser features and properties try { parser.setFeature(NAMESPACES_FEATURE, true); @@ -227,6 +234,8 @@ public class DOMUtils { parser.setFeature(NORMALIZED_VALUE_FEATURE, false); parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); + //parser.setFeature("http://xml.org/sax/features/external-general-entities", false); + //parser.setFeature("http://xml.org/sax/features/external-parameter-entities", false); if (validating) { if (externalSchemaLocations != null) { @@ -495,6 +504,7 @@ public class DOMUtils { parser.setFeature(NAMESPACES_FEATURE, true); parser.setFeature(VALIDATION_FEATURE, true); parser.setFeature(SCHEMA_VALIDATION_FEATURE, true); + if (externalSchemaLocations != null) { parser.setProperty( EXTERNAL_SCHEMA_LOCATION_PROPERTY, -- cgit v1.2.3 From ddd1125b3d9570dec334bd2965ec5a9387585906 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Wed, 5 Oct 2011 08:35:56 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1216 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/Constants.java | 2 +- .../schemas/MOA-ID-Configuration-1.5.1.xsd | 651 +++++++++++++++++++++ 2 files changed, 652 insertions(+), 1 deletion(-) create mode 100644 common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.1.xsd (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index 08ca3fd0d..ed76c4ac7 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -105,7 +105,7 @@ public interface Constants { /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-ID-Configuration-1.5.0.xsd"; + SCHEMA_ROOT + "MOA-ID-Configuration-1.5.1.xsd"; /** URI of the Security Layer 1.0 namespace. */ public static final String SL10_NS_URI = diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.1.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.1.xsd new file mode 100644 index 000000000..f8c38bdd3 --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.1.xsd @@ -0,0 +1,651 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter der Authentisierungs-Komponente + + + + + enthält Konfigurationsparameter der Proxy-Komponente + + + + + + enthält Parameter für die Kommunikation zw. Proxykomponente und Authenttisierungskomponente + + + + + + enthält Parameter für die SOAP-Verbindung von der Proxy-Komponente zur Auth-Komponente (vgl. AuthComponent/MOA-SP/ConnectionParameter) + + + + + + + + + + + enthält Parameter für die OA + + + + + + + + + + + + + + + + + + + + + + + spezifiziert den Algorithmus ("pkix" oder "chaining") für die Zertifikatspfadvalidierung + + + + + + ein vom SystemDefaultMode abweichender ChiningMode kann für jeden TrustAnchor gesetzt werden + + + + + + + + + + + + + + + + verweist auf ein Verzeichnis, das vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate enthält. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter für die Kommunikation mit dem Security-Layer + + + + + + + + + + enthält Konfiguratiosnparameter für die Kommunikation mit dem MOA SP Modul + + + + + + enthält Parameter für die SOAP-Verbindung von der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den Endpunkt des Server; wird das Schema "https" verwendet müssen die Kind-Elemente angegeben werden; wird das Schema "http" verwendet dürfen keine Kind-Elemente angegeben werden; wird das Element nicht verwendet dann wird MOA-SP über das API aufgerufen + + + + + enthält Parameter für die Ãœberprüfung der Personenbindung + + + + + + + + + + enthält Parameter für die Ãœberprüfung des AUTH-Blocks + + + + + + + + + + + + + + enthält Informationen über akzeptierte Signers des IdentityLinks + + + + + + akzeptierte Signer des IdentityLinks werden per X509SubjectName (Kodierung nach RFC 2253) identifiziert + + + + + + + + enthält Defaultparameter für die Ãœberprüfung weiterer Infoboxen + + + + + + + + Verbindungsparameter zum SZR-Gateway (GetIdentityLink) + + + + + + + + + + + Verbindungsparameter zum Online-Vollmachten-Service + + + + + + + + + + das Attribut filename verweist auf eine Datei mit globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese TransformsInfo werden in den CreateXMLSignatureRequest für die Signatur des AUTH-Blocks inkludiert + + + + + + + + + + + + + das Attribut URL spezifiziert die Lage des Templates + + + + + + Verifikation zusätzlicher Infoboxen + + + + + Optionales DefaultTrustprofil für die Ãœberprüfung aller weiteren Infoboxen + + + + + + + + + + Parameter für Ãœberprüfung weiterer Infoboxen + + + + + + + Parameter zur Ãœberprüfung einzelner Infoboxen + + + + + optionalervName, der für Fehlermeldungen verwendet werden soll; z.B.: "Stellvertretungen" für "Mandates"; fehlt dieser Parameter, dann wird das Identifier-Attribut verwendet + + + + + TrustProfil, das für die Ãœberprüfung der Infobox verwendet werden soll + + + + + Validatorklasse, die für die Prüfung der Infobox verwendet werden soll; muss gesetzt werden, wenn Package- und Klassenname vom Default Package- und Klassennamen abweichen + + + + + + Infobox spezifische Parameter, die der jeweiligen Prüfapplikation übergeben werden + + + + + + + + + + Infobox spezifische Parameter, die der Prüfapplikation für berufliche Parteienvertretung übergeben werden. Dies ist logisch Teil der ApplicationSpecificParameters, kann jedoch aufgrund der Strukturierung validierend geparst werden und dadurch wird eine funktionierende Konfiguration bei Programmstart garantiert. + + + + + + Falls Infoboxinhalte für die berufliche Parteienvertretung in der Vollmachten Infobox "mandates" abgelegt werden und Vertretung für berufliche Parteienvertreter aktiviert ist, so kann mit diesem Schalter die Vollmachtsprüfung für normale Vollmachten deaktiviert werden. Damit wird erreicht, dass mittels der Vollmachten Infobox ausschließlich berufliche Parteienvertretung aktiviert ist. Dieser Schalter ist nur für die Vollmachten Infobox "mandates" relevant. + + + + + Eigentlicher Konfigurationsteil für berufliche Parteienvertretung + + + + + + + + + + + + + + Spezifiziert die Lage von XML Schemas + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Authentisierungs-Komponente betreffen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + enthält Parameter über die OA, die die Proxy-Komponente betreffen + + + + + + + + + + + + + + + + + + URL zu einem Verzeichnis, das akzeptierte Server-Zertifikate der TLS-Verbindung enthält (keine CA-Zertifikate) + + + + + + + + + + + + URL zu einem KeyStore, der den privaten Schlüssel, der für die TLS-Client-Authentisierung verwendet wird, enthält + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + + + + + + + Das Attribut spezifiziert die Lage des Templates, welches der InputProcessor zur Darstellung des Eingabeformulars nutzen soll + + + + + + + + + + Default InputProcessor. Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + Default Wert für Formularanzeige. Soll nicht nur bei leerer oder standardisierter Vollmacht mit unvollständigen Daten, sondern beispielsweise zu Kontrollzwecken das Eingabeformular zur vervollständigung der Vertretenendaten immer angezeigt werden, wenn ein Einschreiten durch berufliche Parteienvertretung geschieht so kann dies mittels dieses Schalters veranlasst werden + + + + + Default Verbindungsparameter zum SZR-Gateway (für den EGIZ-Demonstrator im internen Netzwerk: https://129.27.142.5:8443/szr-gateway/services/MandateCreation) + + + + + Falls keine speziellen beruflichen ParteienvertreterInnen definiert sind (Element kommt nicht vor), werden ausschließlich standardisierte Vollmachten mit einer MandateID="*" akzeptiert + + + + + + + + + Konfiguration eines vom Standardprozess abweichenden Verarbeitungsvorgangs bei der beruflichen Parteienvertretung. Der Wert dieses Elements ist der vollständige Klassenname des InputProzessors + + + + + + Optionale Verbindungsparameter zu speziellem (SZR-)Gateway + + + + + + OID der Parteienvertretung lt. "Object Identifier der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID muss mit der MandateID der übermittelten standardisierten Vollmacht übereinstimmen. Eine Parteienvertretung für standardisierte Vollmachten mit der MandateID "*" muss nicht definiert werden und erlaubt eine allgemeine berufliche Parteienvertretung mit Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels dieses Attributs zu definieren + + + + + + Legt fest, ob berufliche Parteienvertretung für natürliche Personen erlaubt ist + + + + + + + + Legt fest, ob berufliche Parteienvertretung für juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht vertreten darf und dieser Wert aus diesem Grund dort false sein muss) + + + + + + + + Beschreibender Text, der an Stelle des Standardtexts bei der Signatur der Anmeldedaten im Falle einer vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt wird + + + + + -- cgit v1.2.3 From 6571af05b7574f6d752890301b9743b1243a05bd Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 11 Oct 2011 16:02:54 +0000 Subject: MOA-ID: * Fixed Bug #557 * Update Konfiguration: Target via Konfig fix konfigurierbar * Update Doku Common: * DOMUtils: Parser disabled external entities git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1219 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/main/java/at/gv/egovernment/moa/util/DOMUtils.java | 14 ++++++++++++-- .../resources/schemas/MOA-ID-Configuration-1.5.1.xsd | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java index 5fa31336b..13c2809ac 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java @@ -110,6 +110,16 @@ public class DOMUtils { * without a namespace. */ private static final String EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY = "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"; + + private static final String EXTERNAL_GENERAL_ENTITIES_FEATURE = + "http://xml.org/sax/features/external-general-entities"; + + private static final String EXTERNAL_PARAMETER_ENTITIES_FEATURE = + "http://xml.org/sax/features/external-parameter-entities"; + + + + /** Property URI for the Xerces grammar pool. */ private static final String GRAMMAR_POOL = org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX @@ -234,8 +244,8 @@ public class DOMUtils { parser.setFeature(NORMALIZED_VALUE_FEATURE, false); parser.setFeature(INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); parser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE, false); - //parser.setFeature("http://xml.org/sax/features/external-general-entities", false); - //parser.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + parser.setFeature(EXTERNAL_GENERAL_ENTITIES_FEATURE, false); + parser.setFeature(EXTERNAL_PARAMETER_ENTITIES_FEATURE, false); if (validating) { if (externalSchemaLocations != null) { diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.1.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.1.xsd index f8c38bdd3..cc562187a 100644 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.1.xsd +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.1.xsd @@ -1,5 +1,4 @@ - @@ -137,6 +136,8 @@ + + -- cgit v1.2.3 From e031b0d5854e4038d28c262109c2529609418ffe Mon Sep 17 00:00:00 2001 From: kstranacher Date: Wed, 12 Oct 2011 10:53:56 +0000 Subject: =?UTF-8?q?*=20Aktualisierung=20imports=20MOA-ID:=20*=20Abfrage=20?= =?UTF-8?q?auf=20Vollmachtenmodus=20bei=20nicht=20=C3=B6ffentlicher=20Andw?= =?UTF-8?q?endung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1222 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/DOMUtils.java | 2 -- .../at/gv/egovernment/moa/util/SSLUtilsTest.java | 27 ++++++++++------------ 2 files changed, 12 insertions(+), 17 deletions(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java index 13c2809ac..316dee3b8 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java @@ -28,7 +28,6 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.StringWriter; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -44,7 +43,6 @@ import javax.xml.transform.OutputKeys; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java index 8e5b9f82a..2b5094fb8 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/SSLUtilsTest.java @@ -24,8 +24,6 @@ package test.at.gv.egovernment.moa.util; -import java.io.FileInputStream; -import java.io.IOException; import java.net.URL; import java.security.KeyStore; import java.security.Security; @@ -33,13 +31,12 @@ import java.security.Security; import javax.net.ssl.SSLException; import javax.net.ssl.SSLSocketFactory; -import com.sun.net.ssl.HostnameVerifier; -import com.sun.net.ssl.HttpsURLConnection; - +import junit.framework.TestCase; import at.gv.egovernment.moa.util.KeyStoreUtils; import at.gv.egovernment.moa.util.SSLUtils; -import junit.framework.TestCase; +import com.sun.net.ssl.HostnameVerifier; +import com.sun.net.ssl.HttpsURLConnection; /** * @author Paul Ivancsics @@ -167,15 +164,15 @@ public class SSLUtilsTest extends TestCase { assertFalse(shouldOk); } } - private byte[] readTruststore(String filename) throws IOException { - if (filename == null) - return null; - FileInputStream in = new FileInputStream(filename); - byte[] buffer = new byte[in.available()]; - in.read(buffer); - in.close(); - return buffer; - } +// private byte[] readTruststore(String filename) throws IOException { +// if (filename == null) +// return null; +// FileInputStream in = new FileInputStream(filename); +// byte[] buffer = new byte[in.available()]; +// in.read(buffer); +// in.close(); +// return buffer; +// } private class HostnameVerifierHack implements HostnameVerifier { public boolean verify(String arg0, String arg1) { return true; -- cgit v1.2.3 From a9b2e962d2853b74d314cb9f614cab446a7134c0 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Thu, 26 Jan 2012 21:59:33 +0000 Subject: =?UTF-8?q?*=20optionalen=20useUTC=20Parameter=20in=20Konfig=20ein?= =?UTF-8?q?gef=C3=BCgt=20(damit=20IssueInstant=20in=20SAML=20Assertion=20a?= =?UTF-8?q?uf=20UTC=20einstellbar)=20*=20optionalen=20sourceID=20Parameter?= =?UTF-8?q?=20bei=20MOA-ID=20Aufruf=20eingef=C3=BCgt=20(wird=201:1=20in=20?= =?UTF-8?q?SAML=20Assertion=20=C3=BCbernommen)=20*=20Update=20Doku=20(useU?= =?UTF-8?q?TC,=20sourceID,=20Vollmachten-Profile)=20*=20Ablauf=C3=A4nderun?= =?UTF-8?q?g=20bei=20Vollmachten-Modus=20(Signatur=20Zertifikat=20wird=20a?= =?UTF-8?q?us=20Signatur=20entnommen=20und=20nicht=20mittels=20eigenem=20I?= =?UTF-8?q?nfobox-Request)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1233 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../at/gv/egovernment/moa/util/DateTimeUtils.java | 83 +++++++++++++--------- .../schemas/MOA-ID-Configuration-1.5.1.xsd | 9 ++- .../gv/egovernment/moa/util/DateTimeUtilsTest.java | 2 +- 3 files changed, 60 insertions(+), 34 deletions(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java index 92e845967..d70073db8 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DateTimeUtils.java @@ -26,6 +26,7 @@ package at.gv.egovernment.moa.util; import java.io.StringWriter; import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; @@ -48,38 +49,56 @@ public class DateTimeUtils { * @param cal the Calendar value * @return the dateTime value */ - public static String buildDateTime(Calendar cal) { - StringWriter out = new StringWriter(); - out.write("" + cal.get(Calendar.YEAR)); - out.write("-"); - out.write(to2DigitString(cal.get(Calendar.MONTH) + 1)); - out.write("-"); - out.write(to2DigitString(cal.get(Calendar.DAY_OF_MONTH))); - out.write("T"); - out.write(to2DigitString(cal.get(Calendar.HOUR_OF_DAY))); - out.write(":"); - out.write(to2DigitString(cal.get(Calendar.MINUTE))); - out.write(":"); - out.write(to2DigitString(cal.get(Calendar.SECOND))); - int tzOffsetMilliseconds = - cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); - if (tzOffsetMilliseconds != 0) { - int tzOffsetMinutes = tzOffsetMilliseconds / (1000 * 60); - int tzOffsetHours = tzOffsetMinutes / 60; - tzOffsetMinutes -= tzOffsetHours * 60; - if (tzOffsetMilliseconds > 0) { - out.write("+"); - out.write(to2DigitString(tzOffsetHours)); - out.write(":"); - out.write(to2DigitString(tzOffsetMinutes)); - } else { - out.write("-"); - out.write(to2DigitString(-tzOffsetHours)); - out.write(":"); - out.write(to2DigitString(-tzOffsetMinutes)); - } - } - return out.toString(); + public static String buildDateTime(Calendar cal, boolean useUTC) { + + if (useUTC) + return buildDateTimeUTC(cal); + else { + StringWriter out = new StringWriter(); + out.write("" + cal.get(Calendar.YEAR)); + out.write("-"); + out.write(to2DigitString(cal.get(Calendar.MONTH) + 1)); + out.write("-"); + out.write(to2DigitString(cal.get(Calendar.DAY_OF_MONTH))); + out.write("T"); + out.write(to2DigitString(cal.get(Calendar.HOUR_OF_DAY))); + out.write(":"); + out.write(to2DigitString(cal.get(Calendar.MINUTE))); + out.write(":"); + out.write(to2DigitString(cal.get(Calendar.SECOND))); + int tzOffsetMilliseconds = + cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); + if (tzOffsetMilliseconds != 0) { + int tzOffsetMinutes = tzOffsetMilliseconds / (1000 * 60); + int tzOffsetHours = tzOffsetMinutes / 60; + tzOffsetMinutes -= tzOffsetHours * 60; + if (tzOffsetMilliseconds > 0) { + out.write("+"); + out.write(to2DigitString(tzOffsetHours)); + out.write(":"); + out.write(to2DigitString(tzOffsetMinutes)); + } else { + out.write("-"); + out.write(to2DigitString(-tzOffsetHours)); + out.write(":"); + out.write(to2DigitString(-tzOffsetMinutes)); + } + } + return out.toString(); + } + } + + /** + * Builds a dateTime value in UTC from a Calendar value. + * @param cal the Calendar value + * @return the dateTime value + */ + public static String buildDateTimeUTC(Calendar cal) { + + SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + f.setTimeZone(TimeZone.getTimeZone("UTC")); + + return f.format(cal.getTime()); } /** diff --git a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.1.xsd b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.1.xsd index cc562187a..d16953eab 100644 --- a/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.1.xsd +++ b/common/src/main/resources/resources/schemas/MOA-ID-Configuration-1.5.1.xsd @@ -89,10 +89,16 @@ - + enthält Parameter der Authentisierungs-Komponente + + + + + + @@ -467,6 +473,7 @@ + diff --git a/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java b/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java index 8fdd389a2..3364e9888 100644 --- a/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java +++ b/common/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java @@ -121,7 +121,7 @@ public class DateTimeUtilsTest extends TestCase { Calendar cal = new GregorianCalendar(TimeZone.getTimeZone(timeZone)); cal.set(year,month, day, hour, min, sec); cal.set(Calendar.MILLISECOND, 0); - String dateTimeBuilt = DateTimeUtils.buildDateTime(cal); + String dateTimeBuilt = DateTimeUtils.buildDateTime(cal, false); assertEquals(dateTimeShould, dateTimeBuilt); } -- cgit v1.2.3 From 453bd7f12223fe4e58049bb8f2f40d80d80bccd7 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 7 Feb 2012 16:15:24 +0000 Subject: =?UTF-8?q?*=20Alte=20MOCCA=20Signaturen=20wieder=20pr=C3=BCfbar?= =?UTF-8?q?=20(Parsererror=20fehlendes=20Target=20Attribut=20in=20Qualifyi?= =?UTF-8?q?ngProperties=20wird=20ignoriert)=20*=20Update=20MOA=20Template?= =?UTF-8?q?=20f=C3=BCr=20B=C3=BCrgerkartenauswahl=20(No-Script-Variante,?= =?UTF-8?q?=20Update=20Bilder=20und=20Text)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1235 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java | 4 +++- .../main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java | 10 ++++++++-- .../resources/properties/common_messages_de.properties | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java index 316dee3b8..a3416d44a 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java @@ -271,7 +271,7 @@ public class DOMUtils { if(null != baStream) parser.parse(new InputSource(baStream)); else - parser.parse(new InputSource(inputStream)); + parser.parse(new InputSource(inputStream)); } catch(SAXException e) { if(true == Logger.isDebugEnabled() && null != buffer) { String xmlContent = new String(buffer); @@ -353,6 +353,8 @@ public class DOMUtils { String externalNoNamespaceSchemaLocation) throws SAXException, IOException, ParserConfigurationException { + + return parseDocument( inputStream, validating, diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java b/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java index ba253edb5..3769b264d 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOAErrorHandler.java @@ -41,6 +41,7 @@ import at.gv.egovernment.moa.logging.Logger; */ public class MOAErrorHandler extends DefaultErrorHandler { + /** * Logs a warning message. * @@ -56,8 +57,13 @@ public class MOAErrorHandler extends DefaultErrorHandler { * @see org.xml.sax.ErrorHandler#error(SAXParseException) */ public void error(SAXParseException exception) throws SAXException { - warn("parser.01", messageParams(exception), null); - throw exception; + warn("parser.01", messageParams(exception), null); + + // if Target attribute is missing in QualifyingProperties - don't throw exception (bug fix for old MOCCA signatures) + if (exception.getMessage().startsWith("cvc-complex-type.4: Attribute 'Target' must appear on element")) + warn("parser.04", new Object[] {"Attribute 'Target' must appear on element 'QualifyingProperties' - ignored for compatibility reasons."}, null); + else + throw exception; } /** diff --git a/common/src/main/resources/resources/properties/common_messages_de.properties b/common/src/main/resources/resources/properties/common_messages_de.properties index ac05b7996..a58d07625 100644 --- a/common/src/main/resources/resources/properties/common_messages_de.properties +++ b/common/src/main/resources/resources/properties/common_messages_de.properties @@ -10,6 +10,7 @@ parser.00=Leichter Fehler beim Parsen: {0}, SystemID={1}, Zeile={2}, Spalte={3} parser.01=Fehler beim Parsen: {0}, SystemID={1}, Zeile={2}, Spalte={3} parser.02=Schwerer Fehler beim Parsen: {0}, SystemID={1}, Zeile={2}, Spalte={3} +parser.04=Fehler beim Parsen: {0} xpath.00=Fehler beim Auswerten des XPath-Ausdruckes: {0} -- cgit v1.2.3 From 4af2a06ad0d4dc021277b115d15bbeeede3c23b7 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Thu, 9 Feb 2012 21:11:31 +0000 Subject: =?UTF-8?q?Update=20MOA-SPSS-Konfig=20Schema=20(Blacklists)=20MOAS?= =?UTF-8?q?ecurityManager=20f=C3=BCr=20Blacklists?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1236 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/Constants.java | 2 +- .../resources/schemas/MOA-SPSS-config-1.5.1.xsd | 282 +++++++++++++++++++++ 2 files changed, 283 insertions(+), 1 deletion(-) create mode 100644 common/src/main/resources/resources/schemas/MOA-SPSS-config-1.5.1.xsd (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index ed76c4ac7..769b651f9 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -101,7 +101,7 @@ public interface Constants { /** Local location of the MOA configuration XML schema definition. */ public static final String MOA_CONFIG_SCHEMA_LOCATION = - SCHEMA_ROOT + "MOA-SPSS-config-1.4.7.xsd"; + SCHEMA_ROOT + "MOA-SPSS-config-1.5.1.xsd"; /** Local location of the MOA ID configuration XML schema definition. */ public static final String MOA_ID_CONFIG_SCHEMA_LOCATION = diff --git a/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.5.1.xsd b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.5.1.xsd new file mode 100644 index 000000000..d91f8f46e --- /dev/null +++ b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.5.1.xsd @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 583d95af8f722f60cf848e603f12f6c0be0e9a59 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Fri, 10 Feb 2012 16:21:09 +0000 Subject: * Ausbau MOASecurityManager (nicht anwendbar da SecurityManager nur systemweit gesetzt werden kann) * Update ExternalURIResolver mit ExternalURIVerifier der gegen Blackliste checkt git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1238 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java | 2 +- .../src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java index 58a07f5e6..7effe8b4f 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java @@ -44,7 +44,7 @@ public class FileUtils { * @return file content * @throws IOException on any exception thrown */ - public static byte[] readURL(String urlString) throws IOException { + public static byte[] readURL(String urlString) throws IOException { URL url = new URL(urlString); InputStream in = new BufferedInputStream(url.openStream()); byte[] content = StreamUtils.readStream(in); diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java b/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java index ae83a551d..0401108d5 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java @@ -91,9 +91,13 @@ public class MOAEntityResolver implements EntityResolver { try { URI uri = new URI(systemId); systemId = uri.getPath(); + System.out.println("MOAEntityResover: " + uri); if (!"file".equals(uri.getScheme()) || "".equals(systemId.trim())) { return null; } + + //ExternalURIVerifier.verify(uri.getHost(), uri.getPort()); + } catch (MalformedURIException e) { return null; } -- cgit v1.2.3 From 94eeead3b212889231ef633c4a721bba6993d8af Mon Sep 17 00:00:00 2001 From: kstranacher Date: Mon, 13 Feb 2012 21:26:40 +0000 Subject: =?UTF-8?q?*=20Update=20ExternalURIVerifier=20*=20Neuer=20MOASPSSE?= =?UTF-8?q?ntityResolver=20(inkl.=20Backlist-Check)=20f=C3=BCr=20DataObjec?= =?UTF-8?q?tFactory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1239 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java b/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java index 0401108d5..8f3ffd4c6 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MOAEntityResolver.java @@ -91,13 +91,11 @@ public class MOAEntityResolver implements EntityResolver { try { URI uri = new URI(systemId); systemId = uri.getPath(); - System.out.println("MOAEntityResover: " + uri); + if (!"file".equals(uri.getScheme()) || "".equals(systemId.trim())) { return null; } - //ExternalURIVerifier.verify(uri.getHost(), uri.getPort()); - } catch (MalformedURIException e) { return null; } -- cgit v1.2.3 From 5d5eaaa2580163023dbc8f2336c5e996e0bcbad0 Mon Sep 17 00:00:00 2001 From: kstranacher Date: Tue, 14 Feb 2012 13:44:52 +0000 Subject: * Update DOMUtils * Update MOA-SPSS Konfiguration Dokumentation * Update Resolver git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1240 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../java/at/gv/egovernment/moa/util/DOMUtils.java | 68 ++++++++++++++++++++++ .../resources/schemas/MOA-SPSS-config-1.5.1.xsd | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java index a3416d44a..102d3a31f 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java @@ -535,6 +535,74 @@ public class DOMUtils { return true; } + + /** + * Schema validate a given DOM element. + * + * @param element The element to validate. + * @param externalSchemaLocations A String containing namespace + * URI to schema location pairs, the same way it is accepted by the xsi: + * schemaLocation attribute. + * @param externalNoNamespaceSchemaLocation The schema location of the + * schema for elements without a namespace, the same way it is accepted by the + * xsi:noNamespaceSchemaLocation attribute. + * @return true, if the element validates against + * the schemas declared in it. + * @throws SAXException An error occurred parsing the document. + * @throws IOException An error occurred reading the document from its + * serialized representation. + * @throws ParserConfigurationException An error occurred configuring the XML + * @throws TransformerException An error occurred serializing the element. + */ + public static boolean validateElement( + Element element, + String externalSchemaLocations, + String externalNoNamespaceSchemaLocation, + EntityResolver entityResolver) + throws + ParserConfigurationException, + IOException, + SAXException, + TransformerException { + + byte[] docBytes; + SAXParser parser; + + // create the SAX parser + if (symbolTable != null) { + parser = new SAXParser(symbolTable, grammarPool); + } else { + parser = new SAXParser(); + } + + // serialize the document + docBytes = serializeNode(element, "UTF-8"); + + // set up parser features and attributes + parser.setFeature(NAMESPACES_FEATURE, true); + parser.setFeature(VALIDATION_FEATURE, true); + parser.setFeature(SCHEMA_VALIDATION_FEATURE, true); + + if (externalSchemaLocations != null) { + parser.setProperty( + EXTERNAL_SCHEMA_LOCATION_PROPERTY, + externalSchemaLocations); + } + if (externalNoNamespaceSchemaLocation != null) { + parser.setProperty( + EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY, + "externalNoNamespaceSchemaLocation"); + } + + // set up entity resolver and error handler + parser.setEntityResolver(entityResolver); + parser.setErrorHandler(new MOAErrorHandler()); + + // parse validating + parser.parse(new InputSource(new ByteArrayInputStream(docBytes))); + return true; + } + /** * Serialize the given DOM node. * diff --git a/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.5.1.xsd b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.5.1.xsd index d91f8f46e..01cd7c426 100644 --- a/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.5.1.xsd +++ b/common/src/main/resources/resources/schemas/MOA-SPSS-config-1.5.1.xsd @@ -25,7 +25,7 @@ - + -- cgit v1.2.3 From fb449b592d265d880b5f44dd619748fdfe0e734f Mon Sep 17 00:00:00 2001 From: kstranacher Date: Mon, 20 Feb 2012 09:36:05 +0000 Subject: Minor updates for 1.5.1 release git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@1265 d688527b-c9ab-4aba-bd8d-4036d912da1d --- common/src/main/java/at/gv/egovernment/moa/util/XPathException.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'common/src') diff --git a/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java b/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java index fae91d035..206245a68 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/XPathException.java @@ -34,7 +34,11 @@ import java.io.PrintWriter; * @version $Id$ */ public class XPathException extends RuntimeException { - /** The wrapped exception. */ + /** + * + */ + private static final long serialVersionUID = 1736311265333034392L; +/** The wrapped exception. */ private Throwable wrapped; /** -- cgit v1.2.3