aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/moa-id-commons')
-rw-r--r--id/server/moa-id-commons/pom.xml13
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDAuthConstants.java19
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java15
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/AuthConfiguration.java42
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConfigurationProvider.java10
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/IOAAuthParameters.java49
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/IRequest.java221
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/AuthProzessDataConstants.java23
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/BPKDecryptionParameters.java2
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/IAuthenticationSession.java113
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/IIdentityLink.java175
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/BKUException.java (renamed from id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java)75
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/MISSimpleClientException.java90
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/MOAIDException.java18
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java46
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java13
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java2
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java16
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/AuthComponentOA.java38
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java14
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java56
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ex/MOADatabaseException.java10
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java341
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/MOAIDMessageProvider.java113
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/X509Utils.java62
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/ssl/SSLUtils.java2
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/IPKIXValidator.java6
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/MOASPPKIXCertValidator.java9
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/PKIXValidatorConfiguration.java21
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/Constants.java4
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java1263
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/FileUtils.java146
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java223
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java6
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java111
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java197
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/XPathException.java86
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java557
-rw-r--r--id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES-1.4.1.xsd15
-rw-r--r--id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES01903v132-201601.xsd (renamed from id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES-1.3.2.xsd)125
-rw-r--r--id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES01903v141-201601.xsd64
-rw-r--r--id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java2
-rw-r--r--id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java2
-rw-r--r--id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java5
-rw-r--r--id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/FileUtils.java4
-rw-r--r--id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java3
-rw-r--r--id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java3
47 files changed, 696 insertions, 3734 deletions
diff --git a/id/server/moa-id-commons/pom.xml b/id/server/moa-id-commons/pom.xml
index 31fe6af26..55a7e7be9 100644
--- a/id/server/moa-id-commons/pom.xml
+++ b/id/server/moa-id-commons/pom.xml
@@ -56,6 +56,10 @@
<dependencies>
<dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf-core</artifactId>
+ </dependency>
+ <dependency>
<groupId>MOA.id.server</groupId>
<artifactId>moa-id-jaxb_classes</artifactId>
</dependency>
@@ -108,6 +112,11 @@
<version>0.2</version>
</dependency>
+ <dependency>
+ <groupId>at.gv.egiz.eaaf</groupId>
+ <artifactId>eaaf-core</artifactId>
+ </dependency>
+
<dependency>
<groupId>iaik.prod</groupId>
<artifactId>iaik_jce_full</artifactId>
@@ -273,7 +282,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>${junit.version}</version>
<scope>test</scope>
</dependency>
@@ -301,8 +309,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
- <version>${org.apache.commons.commons.dbcp2}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDAuthConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDAuthConstants.java
index 6f6735d48..663f712ef 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDAuthConstants.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDAuthConstants.java
@@ -35,8 +35,8 @@ public class MOAIDAuthConstants extends MOAIDConstants{
public static final String PARAM_ACTION = "ACTION";
public static final String PARAM_SSO = "SSO";
public static final String INTERFEDERATION_IDP = "interIDP";
- public static final String PARAM_TARGET_PENDINGREQUESTID = "pendingid";
+
public static final String PARAM_SLOSTATUS = "status";
public static final String PARAM_SLORESTART = "restart";
public static final String SLOSTATUS_SUCCESS = "success";
@@ -171,25 +171,20 @@ public class MOAIDAuthConstants extends MOAIDConstants{
public static final String COUNTRYCODE_AUSTRIA = "AT";
public static final String REGEX_PATTERN_TARGET = "^[A-Za-z]{2}(-.*)?$";
-
- //MDC variables for logging
- public static final String MDC_TRANSACTION_ID = "transactionId";
- public static final String MDC_SESSION_ID = "sessionId";
- public static final String MDC_SERVICEPROVIDER_ID = "oaId";
-
+
//AuthnRequest IssueInstant validation
public static final int TIME_JITTER = 5; //all 5 minutes time jitter
//General MOASession data-store keys
- public static final String MOASESSION_DATA_HOLDEROFKEY_CERTIFICATE = "holderofkey_cert";
+ //public static final String MOASESSION_DATA_HOLDEROFKEY_CERTIFICATE = "holderofkey_cert";
//Process context keys
public static final String PROCESSCONTEXT_PERFORM_INTERFEDERATION_AUTH = "interfederationAuthentication";
public static final String PROCESSCONTEXT_REQUIRELOCALAUTHENTICATION = "requireLocalAuthentication";
public static final String PROCESSCONTEXT_PERFORM_BKUSELECTION = "performBKUSelection";
public static final String PROCESSCONTEXT_ISLEGACYREQUEST = "isLegacyRequest";
- public static final String PROCESSCONTEXT_UNIQUE_OA_IDENTFIER = "uniqueSPId";
- public static final String PROCESSCONTEXT_SSL_CLIENT_CERTIFICATE = MOASESSION_DATA_HOLDEROFKEY_CERTIFICATE;
+ //public static final String PROCESSCONTEXT_UNIQUE_OA_IDENTFIER = "uniqueSPId";
+ //public static final String PROCESSCONTEXT_SSL_CLIENT_CERTIFICATE = MOASESSION_DATA_HOLDEROFKEY_CERTIFICATE;
//General protocol-request data-store keys
public static final String AUTHPROCESS_DATA_SECURITYLAYERTEMPLATE = "authProces_SecurityLayerTemplate";
@@ -199,5 +194,9 @@ public class MOAIDAuthConstants extends MOAIDConstants{
@Deprecated
public static final String AUTHPROCESS_DATA_TARGETFRIENDLYNAME = "authProces_TargetFriendlyName";
+ public static final String DATAID_INTERFEDERATION_MINIMAL_FRONTCHANNEL_RESP = "useMinimalFrontChannelResponse";
+ public static final String DATAID_INTERFEDERATION_NAMEID = "federatedNameID";
+ public static final String DATAID_INTERFEDERATION_QAALEVEL = "federatedQAALevel";
+ public static final String DATAID_INTERFEDERATION_REQUESTID = "authnReqID";
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java
index 436dcc91d..c56116255 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java
@@ -28,6 +28,7 @@ import java.util.Hashtable;
import java.util.List;
import java.util.Map;
+import at.gv.egiz.eaaf.core.api.data.EAAFConstants;
import at.gv.egovernment.moa.util.Constants;
/**
@@ -38,18 +39,18 @@ public class MOAIDConstants {
//general configuration constants
- public static final String DEFAULT_CONTENT_TYPE_HTML_UTF8 = "text/html; charset=UTF-8";
+ public static final String DEFAULT_CONTENT_TYPE_HTML_UTF8 = EAAFConstants.CONTENTTYPE_HTML_UTF8;
public static final String FILE_URI_PREFIX = "file:/";
- public static final String PREFIX_BASEID = Constants.URN_PREFIX_BASEID;
- public static final String PREFIX_PBK = Constants.URN_PREFIX_BPK;
+ public static final String PREFIX_BASEID = EAAFConstants.URN_PREFIX_BASEID;
+ public static final String PREFIX_PBK = EAAFConstants.URN_PREFIX_BPK;
public static final String PREFIX_HPI = Constants.URN_PREFIX_HPI;
- public static final String PREFIX_CDID = Constants.URN_PREFIX_CDID + "+";
- public static final String PREFIX_WPBK = Constants.URN_PREFIX_WBPK + "+";
+ public static final String PREFIX_CDID = EAAFConstants.URN_PREFIX_CDID;
+ public static final String PREFIX_WPBK = EAAFConstants.URN_PREFIX_WBPK;
public static final String PREFIX_STORK = Constants.URN_PREFIX_STORK + "+";
- public static final String PREFIX_EIDAS = Constants.URN_PREFIX_EIDAS + "+";
+ public static final String PREFIX_EIDAS = EAAFConstants.URN_PREFIX_EIDAS;
public static final String IDENIFICATIONTYPE_FN = "FN";
@@ -76,8 +77,6 @@ public class MOAIDConstants {
public static final List<String> ALLOWED_eIDAS_LOA;
public static final List<String> JDBC_DRIVER_NEEDS_WORKAROUND;
- public static final String UNIQUESESSIONIDENTIFIER = "uniqueSessionIdentifier";
-
public static final String eIDAS_LOA_LOW = "http://eidas.europa.eu/LoA/low";
public static final String eIDAS_LOA_SUBSTANTIAL = "http://eidas.europa.eu/LoA/substantial";
public static final String eIDAS_LOA_HIGH = "http://eidas.europa.eu/LoA/high";
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/AuthConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/AuthConfiguration.java
index 4dda4c736..a787cea00 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/AuthConfiguration.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/AuthConfiguration.java
@@ -29,35 +29,7 @@ public interface AuthConfiguration extends ConfigurationProvider{
public Map<String, String> getConfigurationWithPrefix(final String Prefix);
public String getConfigurationWithKey(final String key);
-
- /**
- * Get a configuration value from basic file based MOA-ID configuration
- *
- * @param key configuration key
- * @return configuration value or null if it is not found
- */
- public String getBasicMOAIDConfiguration(final String key);
-
-
- /**
- * Get a configuration value from basic file based MOA-ID configuration
- *
- * @param key configuration key
- * @param defaultValue Default value if no value with this key is found
- * @return configuration value
- */
- public String getBasicMOAIDConfiguration(final String key, final String defaultValue);
-
- /**
- * Get a set of configuration values from basic file based MOA-ID configuration that starts with this prefix
- * <br><br>
- * <b>Important:</b> The configuration values must be of type String!
- *
- * @param prefix Prefix of the configuration key
- * @return Map<String, String> without prefix, but never null
- */
- public Map<String, String> getBasicMOAIDConfigurationWithPrefix(final String prefix);
-
+
public int getTransactionTimeOut();
public int getSSOCreatedTimeOut();
public int getSSOUpdatedTimeOut();
@@ -66,15 +38,13 @@ public interface AuthConfiguration extends ConfigurationProvider{
public List<String> getLegacyAllowedProtocols();
- public IOAAuthParameters getOnlineApplicationParameter(String oaURL);
-
public String getMoaSpAuthBlockTrustProfileID(boolean useTestTrustStore) throws ConfigurationException;
public List<String> getMoaSpAuthBlockVerifyTransformsInfoIDs() throws ConfigurationException;
public ConnectionParameterInterface getMoaSpConnectionParameter() throws ConfigurationException;
- public ConnectionParameterInterface getForeignIDConnectionParameter(IOAAuthParameters oaParameters) throws ConfigurationException;
+// public ConnectionParameterInterface getForeignIDConnectionParameter(IOAAuthParameters oaParameters) throws ConfigurationException;
/**
* Get parameters to connect the Online Mandate-Service (MIS)
@@ -205,12 +175,4 @@ public interface AuthConfiguration extends ConfigurationProvider{
*/
public String[] getRevocationMethodOrder();
- /**
- * Get a boolean value from basic MOA-ID configuration file
- *
- * @param key Configuration key
- * @param defaultValue Default result
- * @return returns the value of the configuration key, or the default value if the key is not set
- */
- public boolean getBasicMOAIDConfigurationBoolean(String key, boolean defaultValue);
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConfigurationProvider.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConfigurationProvider.java
index e14f9c9ce..12b9517a6 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConfigurationProvider.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConfigurationProvider.java
@@ -22,11 +22,14 @@
*/
package at.gv.egovernment.moa.id.commons.api;
+import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
+import at.gv.egovernment.moa.id.commons.api.exceptions.ConfigurationException;
+
/**
* @author tlenz
*
*/
-public interface ConfigurationProvider {
+public interface ConfigurationProvider extends IConfiguration{
/**
* The name of the system property which contains the file name of the
@@ -54,14 +57,15 @@ public interface ConfigurationProvider {
public static final String TRUST_MANAGER_REVOCATION_CHECKING =
"TrustManager.RevocationChecking";
- public String getRootConfigFileDir();
-
public String getDefaultChainingMode();
public String getTrustedCACertificates();
public boolean isTrustmanagerrevoationchecking();
+
+ public String getRootConfigFileDir() throws ConfigurationException;
+
/**
* Get active Spring profiles from file based configuration
*
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/IOAAuthParameters.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/IOAAuthParameters.java
index 1e1bfa94b..5df4a4163 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/IOAAuthParameters.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/IOAAuthParameters.java
@@ -22,11 +22,12 @@
*/
package at.gv.egovernment.moa.id.commons.api;
+import java.io.Serializable;
import java.security.PrivateKey;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
+import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
import at.gv.egovernment.moa.id.commons.api.data.CPEPS;
import at.gv.egovernment.moa.id.commons.api.data.SAML1ConfigurationParameters;
import at.gv.egovernment.moa.id.commons.api.data.StorkAttribute;
@@ -37,10 +38,7 @@ import at.gv.egovernment.moa.id.commons.api.exceptions.ConfigurationException;
* @author tlenz
*
*/
-public interface IOAAuthParameters {
-
- public static final String CONFIG_KEY_RESTRICTIONS_BASEID_INTERNAL = "configuration.restrictions.baseID.idpProcessing";
- public static final String CONFIG_KEY_RESTRICTIONS_BASEID_TRANSMISSION = "configuration.restrictions.baseID.spTransmission";
+public interface IOAAuthParameters extends ISPConfiguration{
public static final String THIRDBKU = "thirdBKU";
public static final String HANDYBKU = "handy";
@@ -53,20 +51,6 @@ public interface IOAAuthParameters {
public static final String EIDAS = "eIDAS";
public static final String AUTHTYPE_OTHERS = "others";
- /**
- * Get the full key/value configuration for this online application
- *
- * @return an unmodifiable map of key/value pairs
- */
- public Map<String, String> getFullConfiguration();
-
- /**
- * Get a configuration value from online application key/value configuration
- *
- * @param key: The key identifier of a configuration value *
- * @return The configuration value {String} or null if the key does not exist
- */
- public String getConfigurationValue(String key);
public String getFriendlyName();
@@ -80,9 +64,9 @@ public interface IOAAuthParameters {
* 'urn:publicid:gv.at:cdid+' is allowed to receive baseIDs
*
* @return true if there is a restriction, otherwise false
- * @throws ConfigurationException In case of online-application configuration has public and private identifies
*/
- public boolean hasBaseIdInternalProcessingRestriction() throws ConfigurationException;
+ @Override
+ public boolean hasBaseIdInternalProcessingRestriction();
/**
@@ -93,21 +77,11 @@ public interface IOAAuthParameters {
* 'urn:publicid:gv.at:cdid+' is allowed to receive baseIDs
*
* @return true if there is a restriction, otherwise false
- * @throws ConfigurationException In case of online-application configuration has public and private identifies
*/
- public boolean hasBaseIdTransferRestriction() throws ConfigurationException;
-
-
- /**
- * Get the full area-identifier for this online application to calculate the
- * area-specific unique person identifier (bPK, wbPK, eIDAS unique identifier, ...).
- * This identifier always contains the full prefix
- *
- * @return area identifier with prefix
- * @throws ConfigurationException In case of online-application configuration has public and private identifies
- */
- public String getAreaSpecificTargetIdentifier() throws ConfigurationException;
+ @Override
+ public boolean hasBaseIdTransferRestriction();
+
/**
* Get a friendly name for the specific area-identifier of this online application
*
@@ -254,4 +228,11 @@ public interface IOAAuthParameters {
public List<Integer> getReversionsLoggingEventCodes();
+ /**
+ * Get a List of sectors for that this service provider requires foreign bPKs
+ *
+ * @return list of sectors, or null if no sectors are defined
+ */
+ public List<String> foreignbPKSectorsRequested();
+
} \ No newline at end of file
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/IRequest.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/IRequest.java
deleted file mode 100644
index 88cd89319..000000000
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/IRequest.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright 2014 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.id.commons.api;
-
-import java.util.Collection;
-
-import org.opensaml.saml2.metadata.provider.MetadataProvider;
-
-import at.gv.egovernment.moa.id.commons.api.data.IAuthenticationSession;
-import at.gv.egovernment.moa.id.commons.api.exceptions.SessionDataStorageException;
-
-public interface IRequest {
-
- /**
- * Indicates the module, which implements this authentication protocol.
- * The class, which is referenced, had to implement the 'IModulInfo' interface.
- *
- * @return Full-qualified name of the class which implements this protocol
- */
- public String requestedModule();
-
- /**
- * Indicates the protocol specific action, which should executed if the request is processed.
- * The class, which is referenced, had to implement the 'IAction' interface.
- *
- * @return Full-qualified name of the class which implements the action
- */
- public String requestedAction();
-
- /**
- * Unique identifier, which indicates the service provider.
- * In case of SAML1 protocol, it is the OA http-GET parameter
- *
- * @return Unique identifier for the service provider
- */
- public String getOAURL();
-
- /**
- * Indicates the passive flag in authentication requests.
- * If the passive flag is set, the identification and authentication process
- * failed if no active SSO session is found.
- *
- * @return true, if the is passive flag is set in authentication request, otherwise false
- */
- public boolean isPassiv();
-
- /**
- * Indicates the force authentication flag in authentication request
- * If this flag is set, a new identification and authentication process
- * is carried out in any case.
- *
- * @return true, if the force authentication flag is set, otherwise false
- */
- public boolean forceAuth();
-
-
- /**
- * Returns a generic request-data object with is stored with a specific identifier
- *
- * @param key The specific identifier of the request-data object
- * @return The request-data object or null if no data is found with this key
- */
- public Object getGenericData(String key);
-
- /**
- * Returns a generic request-data object with is stored with a specific identifier
- *
- * @param key The specific identifier of the request-data object
- * @param clazz The class type which is stored with this key
- * @return The request-data object or null if no data is found with this key
- */
- public <T> T getGenericData(String key, final Class<T> clazz);
-
- /**
- * Store a generic data-object to request with a specific identifier
- *
- * @param key Identifier for this data-object
- * @param object Generic data-object which should be stored. This data-object had to be implement the 'java.io.Serializable' interface
- * @throws SessionDataStorageException Error message if the data-object can not stored to generic request-data storage
- */
- public void setGenericDataToSession(String key, Object object) throws SessionDataStorageException;
-
- /**
- * Hold the identifier of this request object.
- * This identifier can be used to load the request from request storage
- *
- * @return Request identifier
- */
- public String getRequestID();
-
-
- /**
- * Hold the identifier of the SSO MOASession which is associated with this request
- *
- * @return SSO MOASession identifier if a associated session exists, otherwise null
- */
- public String getInternalSSOSessionIdentifier();
-
-
- /**
- * Hold the MOASession object of a pending request
- * This MOASession object is NOT stored to AuthenticationSession database, because it is only part of the pending request
- *
- * @return {@link IAuthenticationSession} AuthenticationSession data object of this pending request
- */
- public IAuthenticationSession getMOASession();
-
-
- /**
- * Populate the MOASession object of a pending request with information from an SSO session database
- *
- * @param ssoSession
- */
- public void populateMOASessionWithSSOInformation(IAuthenticationSession ssoSession);
-
- /**
- * Holds a unique transaction identifier, which could be used for looging
- * This transaction identifier is unique for a single identification and authentication process
- *
- * @return Unique transaction identifier.
- */
- public String getUniqueTransactionIdentifier();
-
- /**
- * Holds a unique session identifier, which could be used for logging
- * This session identifier is unique for the full Single Sign-On session time
- *
- * @return Unique session identifier
- */
- public String getUniqueSessionIdentifier();
-
-
- /**
- * Hold the identifier if the process instance, which is associated with this request
- *
- * @return ProcessInstanceID if this request is associated with a authentication process, otherwise null
- */
- public String getProcessInstanceId();
-
-
- /**
- * get the IDP URL PreFix, which was used for authentication request
- *
- * @return IDP URL PreFix <String>. The URL prefix always ends without /
- */
- public String getAuthURL();
- public String getAuthURLWithOutSlash();
-
- /**
- * Indicates if this pending request needs authentication
- *
- * @return true if this request needs authentication, otherwise false
- */
- public boolean isNeedAuthentication();
-
- /**
- * Indicates, if this pending request needs Single Sign-On (SSO) functionality
- *
- * @return true if this request needs SSO, otherwise false
- */
- public boolean needSingleSignOnFunctionality();
- public void setNeedSingleSignOnFunctionality(boolean needSSO);
-
- /**
- * Indicates, if this pending request is already authenticated
- *
- * @return true if this request is already authenticated, otherwise false
- */
- public boolean isAuthenticated();
- public void setAuthenticated(boolean isAuthenticated);
-
- /**
- * Get get Service-Provider configuration which is associated with this request.
- *
- * @return Service-Provider configuration
- */
- public IOAAuthParameters getOnlineApplicationConfiguration();
-
- /**
- * Indicates, if this pending-request is aborted by the user
- *
- * @return true, if it is aborted, otherwise false
- */
- public boolean isAbortedByUser();
-
- /**
- * Set the 'isAboredByUser' flag of this pending-request
- *
- * @param b true, if the user has abort the authentication process, otherwise false
- */
- public void setAbortedByUser(boolean isAborted);
-
- /**
- * This method get a Set of PVP 2.1 attribute, which are request by this pending-request.
- * @param metadataProvider SAML2 Metadata Provider, or null if no metadata provider is required
- *
- * @return A set of PVP attribute names or null if no attributes are requested
- * or the Service Provider, which sends this request needs no attributes
- */
- public Collection<String> getRequestedAttributes(MetadataProvider metadataProvider);
-}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/AuthProzessDataConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/AuthProzessDataConstants.java
index db413b0f5..31a0573b6 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/AuthProzessDataConstants.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/AuthProzessDataConstants.java
@@ -22,40 +22,25 @@
*/
package at.gv.egovernment.moa.id.commons.api.data;
+import at.gv.egiz.eaaf.core.api.idp.EAAFAuthProcessDataConstants;
+
/**
* @author tlenz
*
*/
-public interface AuthProzessDataConstants {
-
- public static final String GENERIC_PREFIX = "generic_";
+public interface AuthProzessDataConstants extends EAAFAuthProcessDataConstants {
-
- public static final String FLAG_IS_FOREIGNER = "direct_flagIsForeigner";
- public static final String FLAG_USE_MANDATE = "direct_flagUseMandate";
- public static final String FLAG_IS_ORGANWALTER = "direct_flagOrganwalter";
- public static final String FLAG_IS_AUTHENTICATED = "direct_flagIsAuth";
public static final String FLAG_SAMLATTRIBUTEGEBEORWBPK = "direct_SAMLAttributeGebeORwbpk";
-
- public static final String VALUE_CREATED = "direct_created";
- public static final String VALUE_ISSUEINSTANT = "direct_issueInstant";
- public static final String VALUE_SESSIONID = "direct_sessionId";
public static final String VALUE_SIGNER_CERT = "direct_signerCert";
public static final String VALUE_IDENTITYLINK = "direct_idl";
public static final String VALUE_BKUURL = "direct_bkuUrl";
public static final String VALUE_AUTHBLOCK = "direct_authBlock";
public static final String VALUE_AUTNBLOCKTOKKEN = "direct_authblocktokken";
- public static final String VALUE_QAALEVEL = "direct_qaaLevel";
- public static final String VALUE_VERIFYSIGRESP = "direct_verifySigResp";
-
+ public static final String VALUE_VERIFYSIGRESP = "direct_verifySigResp";
public static final String VALUE_MISSESSIONID = "direct_MIS_SessionId";
public static final String VALUE_MISREFVALUE = "direct_MIS_RefValue";
- public static final String VALUE_MISMANDATE = "direct_MIS_Mandate";
-
-
-
@Deprecated
public static final String VALUE_EXTENTEDSAMLATTRAUTH = "direct_extSamlAttrAuth";
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/BPKDecryptionParameters.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/BPKDecryptionParameters.java
index cb81fe79e..5fec08053 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/BPKDecryptionParameters.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/BPKDecryptionParameters.java
@@ -34,8 +34,8 @@ import java.security.UnrecoverableKeyException;
import org.apache.commons.lang3.SerializationUtils;
+import at.gv.egiz.eaaf.core.impl.utils.KeyStoreUtils;
import at.gv.egovernment.moa.logging.Logger;
-import at.gv.egovernment.moa.util.KeyStoreUtils;
/**
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/IAuthenticationSession.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/IAuthenticationSession.java
index 8bffceaed..1d54af7c8 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/IAuthenticationSession.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/IAuthenticationSession.java
@@ -22,22 +22,17 @@
*/
package at.gv.egovernment.moa.id.commons.api.data;
-import java.util.Date;
import java.util.List;
import java.util.Map;
-import at.gv.egovernment.moa.id.commons.api.exceptions.SessionDataStorageException;
+import at.gv.egiz.eaaf.core.api.idp.auth.data.IAuthProcessDataContainer;
import iaik.x509.X509Certificate;
/**
* @author tlenz
*
*/
-public interface IAuthenticationSession {
-
- boolean isAuthenticated();
-
- void setAuthenticated(boolean authenticated);
+public interface IAuthenticationSession extends IAuthProcessDataContainer {
X509Certificate getSignerCertificate();
@@ -46,34 +41,20 @@ public interface IAuthenticationSession {
void setSignerCertificate(X509Certificate signerCertificate);
/**
- * Returns the identityLink.
- *
- * @return IdentityLink
- */
- IIdentityLink getIdentityLink();
-
- /**
* Returns the sessionID.
*
* @return String
*/
- String getSessionID();
-
- /**
- * Sets the identityLink.
- *
- * @param identityLink
- * The identityLink to set
- */
- void setIdentityLink(IIdentityLink identityLink);
+ String getSSOSessionID();
+
/**
* Sets the sessionID.
*
* @param sessionId
* The sessionID to set
*/
- void setSessionID(String sessionId);
+ void setSSOSessionID(String sessionId);
/**
* Returns the BKU URL.
@@ -158,20 +139,6 @@ public interface IAuthenticationSession {
*/
void setSAMLAttributeGebeORwbpk(boolean samlAttributeGebeORwbpk);
- /**
- * Returns the issuing time of the AUTH-Block SAML assertion.
- *
- * @return The issuing time of the AUTH-Block SAML assertion.
- */
- String getIssueInstant();
-
- /**
- * Sets the issuing time of the AUTH-Block SAML assertion.
- *
- * @param issueInstant
- * The issueInstant to set.
- */
- void setIssueInstant(String issueInstant);
/**
*
@@ -180,13 +147,6 @@ public interface IAuthenticationSession {
*/
void setUseMandate(String useMandate);
- void setUseMandates(boolean useMandates);
-
- /**
- * @return
- */
- boolean isMandateUsed();
-
/**
*
* @param misSessionID
@@ -212,9 +172,6 @@ public interface IAuthenticationSession {
*/
void setMandateReferenceValue(String mandateReferenceValue);
- boolean isForeigner();
-
- void setForeigner(boolean isForeigner);
IVerifiyXMLSignatureResponse getXMLVerifySignatureResponse();
@@ -225,17 +182,6 @@ public interface IAuthenticationSession {
void setMISMandate(IMISMandate mandate);
/**
- * @return the isOW
- */
- boolean isOW();
-
- /**
- * @param isOW
- * the isOW to set
- */
- void setOW(boolean isOW);
-
- /**
* @return the authBlockTokken
*/
String getAuthBlockTokken();
@@ -246,51 +192,12 @@ public interface IAuthenticationSession {
*/
void setAuthBlockTokken(String authBlockTokken);
+
/**
- * eIDAS QAA level
+ * Generates a Key / Value representation from Authenticated session
*
- * @return the qAALevel
+ * @return A read-only version of all session information
*/
- String getQAALevel();
-
- /**
- * set QAA level in eIDAS form
- *
- * @param qAALevel the qAALevel to set
- */
- void setQAALevel(String qAALevel);
-
- /**
- * @return the sessionCreated
- */
- Date getSessionCreated();
-
- Map<String, Object> getGenericSessionDataStorage();
-
- /**
- * Returns a generic session-data object with is stored with a specific identifier
- *
- * @param key The specific identifier of the session-data object
- * @return The session-data object or null if no data is found with this key
- */
- Object getGenericDataFromSession(String key);
-
- /**
- * Returns a generic session-data object with is stored with a specific identifier
- *
- * @param key The specific identifier of the session-data object
- * @param clazz The class type which is stored with this key
- * @return The session-data object or null if no data is found with this key
- */
- <T> T getGenericDataFromSession(String key, Class<T> clazz);
-
- /**
- * Store a generic data-object to session with a specific identifier
- *
- * @param key Identifier for this data-object
- * @param object Generic data-object which should be stored. This data-object had to be implement the 'java.io.Serializable' interface
- * @throws SessionDataStorageException Error message if the data-object can not stored to generic session-data storage
- */
- void setGenericDataToSession(String key, Object object) throws SessionDataStorageException;
-
+ public Map<String, Object> getKeyValueRepresentationFromAuthSession();
+
} \ No newline at end of file
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/IIdentityLink.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/IIdentityLink.java
deleted file mode 100644
index 3a0ccd7c9..000000000
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/data/IIdentityLink.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2014 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.id.commons.api.data;
-
-import java.io.IOException;
-import java.security.PublicKey;
-
-import javax.xml.transform.TransformerException;
-
-import org.w3c.dom.Element;
-
-/**
- * @author tlenz
- *
- */
-public interface IIdentityLink {
-
- /**
- * Returns the dateOfBirth.
- * @return Calendar
- */
- String getDateOfBirth();
-
- /**
- * Returns the familyName.
- * @return String
- */
- String getFamilyName();
-
- /**
- * Returns the givenName.
- * @return String
- */
- String getGivenName();
-
- /**
- * Returns the name.
- * @return The name.
- */
- String getName();
-
- /**
- * Returns the identificationValue.
- * <code>"identificationValue"</code> is the translation of <code>"Stammzahl"</code>.
- * @return String
- */
- String getIdentificationValue();
-
- /**
- * Returns the identificationType.
- * <code>"identificationType"</code> type of the identificationValue in the IdentityLink.
- * @return String
- */
- String getIdentificationType();
-
- /**
- * Sets the dateOfBirth.
- * @param dateOfBirth The dateOfBirth to set
- */
- void setDateOfBirth(String dateOfBirth);
-
- /**
- * Sets the familyName.
- * @param familyName The familyName to set
- */
- void setFamilyName(String familyName);
-
- /**
- * Sets the givenName.
- * @param givenName The givenName to set
- */
- void setGivenName(String givenName);
-
- /**
- * Sets the identificationValue.
- * <code>"identificationValue"</code> is the translation of <code>"Stammzahl"</code>.
- * @param identificationValue The identificationValue to set
- */
- void setIdentificationValue(String identificationValue);
-
- /**
- * Sets the Type of the identificationValue.
- * @param identificationType The type of identificationValue to set
- */
- void setIdentificationType(String identificationType);
-
- /**
- * Returns the samlAssertion.
- * @return Element
- */
- Element getSamlAssertion();
-
- /**
- * Returns the samlAssertion.
- * @return Element
- */
- String getSerializedSamlAssertion();
-
- /**
- * Sets the samlAssertion and the serializedSamlAssertion.
- * @param samlAssertion The samlAssertion to set
- */
- void setSamlAssertion(Element samlAssertion) throws TransformerException, IOException;
-
- /**
- * Returns the dsigReferenceTransforms.
- * @return Element[]
- */
- Element[] getDsigReferenceTransforms();
-
- /**
- * Sets the dsigReferenceTransforms.
- * @param dsigReferenceTransforms The dsigReferenceTransforms to set
- */
- void setDsigReferenceTransforms(Element[] dsigReferenceTransforms);
-
- /**
- * Returns the publicKey.
- * @return PublicKey[]
- */
- PublicKey[] getPublicKey();
-
- /**
- * Sets the publicKey.
- * @param publicKey The publicKey to set
- */
- void setPublicKey(PublicKey[] publicKey);
-
- /**
- * Returns the prPerson.
- * @return Element
- */
- Element getPrPerson();
-
- /**
- * Sets the prPerson.
- * @param prPerson The prPerson to set
- */
- void setPrPerson(Element prPerson);
-
- /**
- * Returns the issuing time of the identity link SAML assertion.
- *
- * @return The issuing time of the identity link SAML assertion.
- */
- String getIssueInstant();
-
- /**
- * Sets the issuing time of the identity link SAML assertion.
- *
- * @param issueInstant The issueInstant to set.
- */
- void setIssueInstant(String issueInstant);
-
-} \ No newline at end of file
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/BKUException.java
index e39cc0291..73617fb35 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/NodeListAdapter.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/BKUException.java
@@ -1,68 +1,57 @@
-/*
- * Copyright 2003 Federal Chancellery Austria
+/*******************************************************************************
+ * Copyright 2014 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.id.commons.api.exceptions;
+public class BKUException extends MOAIDException {
-package at.gv.egovernment.moa.util;
+ private static final long serialVersionUID = -4646544256490397419L;
-import java.util.List;
+ private String bkuErrorCode;
+ private String bkuErrorMessage;
+
+ public BKUException(String messageId, Object[] parameters,
+ String bkuErrorCode, String bkuErrorMessage) {
+ super(messageId, parameters);
+
+ this.bkuErrorCode = bkuErrorCode;
+ this.bkuErrorMessage = bkuErrorMessage;
+ }
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-/**
- * A <code>NodeList</code> implementation based on a <code>List</code>.
- *
- * @see java.util.List
- * @see org.w3c.dom.NodeList
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class NodeListAdapter implements NodeList {
- /** The <code>List</code> to wrap. */
- private List nodeList;
-
- /**
- * Create a new <code>NodeListAdapter</code>.
- *
- * @param nodeList The <code>List</code> containing the nodes.
- */
- public NodeListAdapter(List nodeList) {
- this.nodeList = nodeList;
- }
+ /**
+ * @return the bkuErrorCode
+ */
+ public String getBkuErrorCode() {
+ return bkuErrorCode;
+ }
- /**
- * @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();
- }
+ /**
+ * @return the bkuErrorMessage
+ */
+ public String getBkuErrorMessage() {
+ return bkuErrorMessage;
+ }
+
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/MISSimpleClientException.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/MISSimpleClientException.java
new file mode 100644
index 000000000..b8c78ab5c
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/MISSimpleClientException.java
@@ -0,0 +1,90 @@
+package at.gv.egovernment.moa.id.commons.api.exceptions;
+/*******************************************************************************
+ * Copyright 2014 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.
+ ******************************************************************************/
+/*
+ * 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.
+ */
+
+public class MISSimpleClientException extends MOAIDException {
+
+ private static final long serialVersionUID = 1L;
+
+ private String misErrorCode;
+ private String misErrorMessage;
+
+ public MISSimpleClientException() {
+ super("UNDEFINED ERROR", null);
+ }
+
+ public MISSimpleClientException(String message) {
+ super(message, null);
+ }
+
+ public MISSimpleClientException(String message, String code, String text) {
+ super(message, new Object[] { code , text });
+ this.misErrorMessage = text;
+ this.misErrorCode = code;
+ }
+
+ public MISSimpleClientException(String message, Throwable cause) {
+ super(message, null, cause);
+ }
+
+ public MISSimpleClientException(String message, Object[] params, Throwable cause) {
+ super(message, params, cause);
+ }
+
+ /**
+ * @return the bkuErrorCode
+ */
+ public String getMISErrorCode() {
+ return misErrorCode;
+ }
+
+
+ /**
+ * @return the bkuErrorMessage
+ */
+ public String getMISErrorMessage() {
+ return misErrorMessage;
+ }
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/MOAIDException.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/MOAIDException.java
index 6841be92b..b5ae04c4e 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/MOAIDException.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/MOAIDException.java
@@ -49,7 +49,7 @@ package at.gv.egovernment.moa.id.commons.api.exceptions;
import java.io.PrintStream;
import java.io.PrintWriter;
-import at.gv.egovernment.moa.id.commons.utils.MOAIDMessageProvider;
+import at.gv.egiz.eaaf.core.exceptions.EAAFException;
/**
* Base class of technical MOA exceptions.
@@ -60,17 +60,17 @@ import at.gv.egovernment.moa.id.commons.utils.MOAIDMessageProvider;
* @author Patrick Peck, Ivancsics Paul
* @version $Id$
*/
-public class MOAIDException extends Exception {
+public class MOAIDException extends EAAFException {
/**
*
*/
private static final long serialVersionUID = -1507246171708083912L;
-/** message ID */
- private String messageId;
- /** wrapped exception */
- private Throwable wrapped;
+ /** message ID */
+ private String messageId;
+ /** wrapped exception */
+ private Throwable wrapped;
- private Object[] parameters;
+ private Object[] parameters;
/**
* Create a new <code>MOAIDException</code>.
@@ -80,7 +80,7 @@ public class MOAIDException extends Exception {
* @param parameters Additional message parameters.
*/
public MOAIDException(String messageId, Object[] parameters) {
- super(MOAIDMessageProvider.getInstance().getMessage(messageId, parameters));
+ super(messageId, parameters);
this.messageId = messageId;
this.parameters = parameters;
}
@@ -99,7 +99,7 @@ public class MOAIDException extends Exception {
Object[] parameters,
Throwable wrapped) {
- super(MOAIDMessageProvider.getInstance().getMessage(messageId, parameters));
+ super(messageId, parameters, wrapped);
this.messageId = messageId;
this.wrapped = wrapped;
this.parameters = parameters;
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java
index 93f26051c..4555f61d2 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java
@@ -32,6 +32,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+
+import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils;
import at.gv.egovernment.moa.id.commons.MOAIDConstants;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AttributeProviderPlugin;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentGeneral;
@@ -82,7 +85,6 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TimeOuts;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.TransformsInfoType;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.VerifyAuthBlock;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.VerifyIdentityLink;
-import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils;
import at.gv.egovernment.moa.id.commons.validation.TargetValidator;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.Base64Utils;
@@ -174,13 +176,32 @@ public class ConfigurationMigrationUtils {
}
}
+ if (MiscUtil.isNotEmpty(oa.getForeignbPKTargetList()))
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_FOREIGN, oa.getForeignbPKTargetList());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_FOREIGN, StringUtils.EMPTY);
+
+
//convert selected SZR-GW service
if (MiscUtil.isNotEmpty(oa.getSelectedSZRGWServiceURL()))
- result.put(MOAIDConfigurationConstants.SERVICE_EXTERNAL_SZRGW_SERVICE_URL, oa.getSelectedSZRGWServiceURL());
+ result.put(MOAIDConfigurationConstants.SERVICE_EXTERNAL_CENTRAL_EIDASNODE_SERVICE_URL, oa.getSelectedSZRGWServiceURL());
AuthComponentOA oaauth = oa.getAuthComponentOA();
if (oaauth != null) {
+ //convert SL20 infos
+ if (oaauth.isSl20Active() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENABLED, oaauth.isSl20Active().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENABLED, Boolean.FALSE.toString());
+
+ if (MiscUtil.isNotEmpty(oaauth.getSl20EndPoints()))
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENDPOINTS, oaauth.getSl20EndPoints());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENDPOINTS, StringUtils.EMPTY);
+
+
+
//convert business identifier
IdentificationNumber idnumber = oaauth.getIdentificationNumber();
if (idnumber != null) {
@@ -770,7 +791,17 @@ public class ConfigurationMigrationUtils {
}
- dbOA.setSelectedSZRGWServiceURL(oa.get(MOAIDConfigurationConstants.SERVICE_EXTERNAL_SZRGW_SERVICE_URL));
+ //set SL20 things
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENABLED)))
+ authoa.setSl20Active(Boolean.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENABLED)));
+ else
+ authoa.setSl20Active(false);
+
+ authoa.setSl20EndPoints(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_SL20_ENDPOINTS));
+
+
+
+ dbOA.setSelectedSZRGWServiceURL(oa.get(MOAIDConfigurationConstants.SERVICE_EXTERNAL_CENTRAL_EIDASNODE_SERVICE_URL));
dbOA.setMandateServiceSelectionTemplateURL(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_ELGAMANDATESERVICESELECTION_URL));
dbOA.setSaml2PostBindingTemplateURL(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SAML2POSTBINDING_URL));
@@ -826,6 +857,9 @@ public class ConfigurationMigrationUtils {
}
}
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_FOREIGN)))
+ dbOA.setForeignbPKTargetList(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_FOREIGN));
+
//store BKU-URLs
BKUURLS bkuruls = new BKUURLS();
authoa.setBKUURLS(bkuruls);
@@ -1220,7 +1254,7 @@ public class ConfigurationMigrationUtils {
if (foreign != null) {
ConnectionParameterClientAuthType connect_foreign = foreign.getConnectionParameter();
if (connect_foreign != null) {
- result.put(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL,
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_CENTRAL_EIDASNODE_URL,
connect_foreign.getURL());
}
}
@@ -1738,13 +1772,13 @@ public class ConfigurationMigrationUtils {
dbauth.setForeignIdentities(dbforeign);
}
- if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL))) {
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_CENTRAL_EIDASNODE_URL))) {
ConnectionParameterClientAuthType forcon = dbforeign.getConnectionParameter();
if (forcon == null) {
forcon = new ConnectionParameterClientAuthType();
dbforeign.setConnectionParameter(forcon);
}
- forcon.setURL(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL));
+ forcon.setURL(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_CENTRAL_EIDASNODE_URL));
}
ForeignIdentities foreign = dbauth.getForeignIdentities();
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java
index 695df3123..a6315fe2c 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java
@@ -1,5 +1,6 @@
package at.gv.egovernment.moa.id.commons.config;
+import at.gv.egiz.eaaf.core.api.data.EAAFConfigConstants;
import at.gv.egovernment.moa.id.commons.MOAIDConstants;
/**
@@ -33,7 +34,8 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants {
public static final String PREFIX_MOAID_SERVICES_GATEWAY = PREFIX_MOAID_SERVICES + "." + PREFIX_GATEWAY;
//Namespaces for online applications
- public static final String SERVICE_UNIQUEIDENTIFIER = "uniqueID"; //publicURLPrefix
+ public static final String SERVICE_UNIQUEIDENTIFIER
+ = EAAFConfigConstants.SERVICE_UNIQUEIDENTIFIER; //publicURLPrefix
public static final String SERVICE_FRIENDLYNAME = "friendlyName"; //friendlyName
public static final String SERVICE_BUSINESSSERVICE = "businessservice"; //type
public static final String SERVICE_ISACTIVE = "isActive"; //isActive
@@ -61,6 +63,8 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants {
private static final String SERVICE_AUTH_TARGET_BUSINESS = SERVICE_AUTH_TARGET + ".business";
public static final String SERVICE_AUTH_TARGET_BUSINESS_TYPE = SERVICE_AUTH_TARGET_BUSINESS + ".type";
public static final String SERVICE_AUTH_TARGET_BUSINESS_VALUE = SERVICE_AUTH_TARGET_BUSINESS + ".value";
+ public static final String SERVICE_AUTH_TARGET_FOREIGN = SERVICE_AUTH_TARGET + ".foreign";
+
public static final String SERVICE_AUTH_TARGET_PUBLIC_TARGET = SERVICE_AUTH_TARGET_PUBLIC + ".target";
public static final String SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB = SERVICE_AUTH_TARGET_PUBLIC + ".target.sub";
@@ -82,6 +86,9 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants {
public static final String SERVICE_AUTH_BKU_AUTHBLOCKTEXT = AUTH + ".authblock.additionaltext";
public static final String SERVICE_AUTH_BKU_AUTHBLOCK_REMOVEBPK = AUTH + ".authblock.removebPK";
+ public static final String SERVICE_AUTH_SL20_ENABLED = AUTH + ".sl20.enabled";
+ public static final String SERVICE_AUTH_SL20_ENDPOINTS = AUTH + ".sl20.endpoints";
+
private static final String SERVICE_AUTH_TEMPLATES = AUTH + "." + TEMPLATES;
public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA = SERVICE_AUTH_TEMPLATES + ".bkuselection.data";
public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW = SERVICE_AUTH_TEMPLATES + ".bkuselection.preview";
@@ -188,7 +195,7 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants {
public static final String SERVICE_EXTERNAL_ELGA_MANDATE_SERVICE_URL = ELGA_MANDATE_SERVICE_URL;
public static final String SERVICE_EXTERNAL_MIS_SERVICE_URL = "modules.mis.service.url";
- public static final String SERVICE_EXTERNAL_SZRGW_SERVICE_URL = "modules.szrgw.service.url";
+ public static final String SERVICE_EXTERNAL_CENTRAL_EIDASNODE_SERVICE_URL = "modules.szrgw.service.url";
//Namespaces for general MOA-ID config
public static final String GENERAL_PUBLICURLPREFIX = PREFIX_MOAID_GENERAL + ".publicURLPrefix";
@@ -222,7 +229,7 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants {
public static final String GENERAL_AUTH_MOASP_URL = GENERAL_AUTH + ".moasp.url";
public static final String GENERAL_AUTH_SERVICES_OVS_URL = GENERAL_AUTH + ".services.ovs.url";
- public static final String GENERAL_AUTH_SERVICES_SZRGW_URL = GENERAL_AUTH + ".services.szrgw.url";
+ public static final String GENERAL_AUTH_SERVICES_CENTRAL_EIDASNODE_URL = GENERAL_AUTH + ".services.szrgw.url";
public static final String GENERAL_AUTH_SERVICES_HVB_URL = GENERAL_AUTH + ".services.hvb.url";
public static final String GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL = PREFIX_MOAID_GENERAL + "." + ELGA_MANDATE_SERVICE_URL;
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
index 4944813ad..6ef7a00cd 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
@@ -14,11 +14,11 @@ import org.springframework.transaction.annotation.Transactional;
import at.gv.egiz.components.configuration.api.Configuration;
import at.gv.egiz.components.configuration.api.ConfigurationException;
+import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils;
import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants;
import at.gv.egovernment.moa.id.commons.db.dao.config.AbstractConfigProperty;
//import at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty;
import at.gv.egovernment.moa.id.commons.db.dao.config.DatabaseConfigPropertyImpl;
-import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils;
import at.gv.egovernment.moa.logging.Logger;
/**
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
index 3928cf8c0..cada51b9a 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
@@ -9,11 +9,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import at.gv.egiz.components.configuration.api.ConfigurationException;
+import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils;
import at.gv.egovernment.moa.id.commons.config.ConfigurationMigrationUtils;
import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants;
import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration;
import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication;
-import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils;
import at.gv.egovernment.moa.logging.Logger;
/**
@@ -84,13 +84,13 @@ public class NewConfigurationDBRead {
String hjID = KeyValueUtils.getFirstChildAfterPrefix(oaKeyId, KeyValueUtils.getParentKey(oaKeyId));
//TODO: work-around for old configTool and new key/value configuration
//see BasicOAAction.java line 493
- if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_GATEWAY))
- jaxBOA.setHjid(Long.valueOf(hjID) + 1000000);
- else if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_IIDP))
- jaxBOA.setHjid(Long.valueOf(hjID) + 2000000);
- else if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_VIDP))
- jaxBOA.setHjid(Long.valueOf(hjID) + 3000000);
- else
+// if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_GATEWAY))
+// jaxBOA.setHjid(Long.valueOf(hjID) + 1000000);
+// else if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_IIDP))
+// jaxBOA.setHjid(Long.valueOf(hjID) + 2000000);
+// else if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_VIDP))
+// jaxBOA.setHjid(Long.valueOf(hjID) + 3000000);
+// else
jaxBOA.setHjid(Long.valueOf(hjID));
Logger.debug("Transformation finished with JaxB hjID: " + hjID);
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/AuthComponentOA.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/AuthComponentOA.java
index 04efb0afe..852df16e6 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/AuthComponentOA.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/AuthComponentOA.java
@@ -11,23 +11,17 @@ package at.gv.egovernment.moa.id.commons.db.dao.config.deprecated;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+
import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
-import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
+
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
import org.jvnet.jaxb2_commons.lang.HashCode;
@@ -162,6 +156,13 @@ public class AuthComponentOA
@XmlAttribute(name = "Hjid")
protected Long hjid;
+
+ @XmlTransient
+ protected Boolean sl20Active;
+ @XmlTransient
+ protected String sl20EndPoints;
+
+
/**
* Gets the value of the bkuurls property.
*
@@ -522,11 +523,28 @@ public class AuthComponentOA
+
public Long getHjid() {
return hjid;
}
- /**
+ public Boolean isSl20Active() {
+ return sl20Active;
+ }
+
+ public void setSl20Active(Boolean sl20Active) {
+ this.sl20Active = sl20Active;
+ }
+
+ public String getSl20EndPoints() {
+ return sl20EndPoints;
+ }
+
+ public void setSl20EndPoints(String sl20EndPoints) {
+ this.sl20EndPoints = sl20EndPoints;
+ }
+
+ /**
* Sets the value of the hjid property.
*
* @param value
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java
index 196923ce6..e37873a72 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java
@@ -115,10 +115,20 @@ public class OnlineApplication
@XmlTransient
protected String mandateServiceSelectionTemplateURL = null;
+ @XmlTransient
+ protected String foreignbPKTargetList = null;
+
-
- /**
+ public String getForeignbPKTargetList() {
+ return foreignbPKTargetList;
+ }
+
+ public void setForeignbPKTargetList(String foreignbPKTargetList) {
+ this.foreignbPKTargetList = foreignbPKTargetList;
+ }
+
+ /**
* @return the saml2PostBindingTemplateURL
*/
public String getSaml2PostBindingTemplateURL() {
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java
index b13f0ba5b..93db98cf9 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java
@@ -103,6 +103,7 @@ public class AuthenticatedSessionStore implements Serializable{
private String additionalInformation;
@Column(name = "additionalInformationBytes", nullable=true)
+ @Lob
private byte[] additionalInformationBytes;
@Column(name = "created", updatable=false, nullable=false)
@@ -349,19 +350,56 @@ public class AuthenticatedSessionStore implements Serializable{
this.isInterfederatedSSOSession = isInterfederatedSSOSession;
}
- /**
- * @return the additionalInformation
- */
- public byte[] getAdditionalInformation() {
+ @Deprecated
+ public String getAdditionalInformation() {
+ return additionalInformation;
+ }
+
+ @Deprecated
+ public void setAdditionalInformation(String additionalInformation) {
+ this.additionalInformation = additionalInformation;
+ }
+
+ public byte[] getAdditionalInformationBytes() {
return additionalInformationBytes;
}
- /**
- * @param additionalInformation the additionalInformation to set
- */
- public void setAdditionalInformation(byte[] additionalInformation) {
- this.additionalInformationBytes = additionalInformation;
+ public void setAdditionalInformationBytes(byte[] additionalInformationBytes) {
+ this.additionalInformationBytes = additionalInformationBytes;
}
+
+// /**
+// * @return the additionalInformation
+// */
+// @Deprecated
+// public String getAdditionalInformation() {
+// try {
+// if (this.additionalInformationBytes != null)
+// return new String(this.additionalInformationBytes, "UTF-8");
+// else
+// return null;
+//
+// } catch (UnsupportedEncodingException e) {
+// throw new RuntimeException("Something is very strange, because UTF-8 encoding IS NOT supported", e);
+//
+// }
+// }
+
+// @Deprecated
+// public void setAdditionalInformation(String additionalInformation) {
+// try {
+// if (StringUtils.isNotEmpty(additionalInformation))
+// this.additionalInformationBytes = additionalInformation.getBytes("UTF-8");
+//
+// } catch (UnsupportedEncodingException e) {
+// throw new RuntimeException("Something is very strange, because UTF-8 encoding IS NOT supported", e);
+//
+// }
+// }
+
+
+
+
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ex/MOADatabaseException.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ex/MOADatabaseException.java
index 46484879d..d2d411074 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ex/MOADatabaseException.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ex/MOADatabaseException.java
@@ -22,13 +22,12 @@
*******************************************************************************/
package at.gv.egovernment.moa.id.commons.db.ex;
-public class MOADatabaseException extends Exception {
+import at.gv.egiz.eaaf.core.exceptions.EAAFStorageException;
+
+public class MOADatabaseException extends EAAFStorageException {
private static final long serialVersionUID = 1L;
- public MOADatabaseException() {
- super();
- }
public MOADatabaseException(String message, Throwable cause) {
super(message, cause);
@@ -38,7 +37,4 @@ public class MOADatabaseException extends Exception {
super(message);
}
- public MOADatabaseException(Throwable cause) {
- super(cause);
- }
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java
deleted file mode 100644
index 40ef5a23a..000000000
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright 2014 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.id.commons.utils;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-
-import at.gv.egovernment.moa.util.MiscUtil;
-
-/**
- * @author tlenz
- *
- */
-public class KeyValueUtils {
-
- public static final String KEY_DELIMITER = ".";
- public static final String CSV_DELIMITER = ",";
-
- /**
- * Convert Java properties into a Map<String, String>
- * <br><br>
- * <b>Important:</b> The key/values from properties must be of type String!
- *
- * @param properties
- * @return
- */
- public static Map<String, String> concertPropertiesToMap(Properties properties) {
- return new HashMap<String, String>((Map) properties);
-
- //INFO Java8 solution ;)
- // return properties.entrySet().stream().collect(
-// Collectors.toMap(
-// e -> e.getKey().toString(),
-// e -> e.getValue().toString()
-// )
-// );
-
- }
-
- /**
- * Extract the first child of an input key after a the prefix
- *
- * @param key Full input key
- * @param prefix Prefix
- * @return Child key {String} if it exists or null
- */
- public static String getFirstChildAfterPrefix(String key, String prefix) {
- String idAfterPrefix = removePrefixFromKey(key, prefix);
- if (idAfterPrefix != null) {
- int index = idAfterPrefix.indexOf(KEY_DELIMITER);
- if (index > 0) {
- String adding = idAfterPrefix.substring(0, index);
- if (!(adding.isEmpty())) {
- return adding;
-
- }
- } else if (!(idAfterPrefix.isEmpty())) {
- return idAfterPrefix;
-
- }
-
- }
- return null;
- }
-
- /**
- * Extract the prefix from an input key
- *
- * @param key Full input key
- * @param suffix Suffix of this key
- * @return Prefix {String} of the key or null if input key does not ends with postfix string
- */
- public static String getPrefixFromKey(String key, String suffix) {
- if (key != null && key.endsWith(suffix)) {
- String idPreforeSuffix = key.substring(0, key.length()-suffix.length());
- if (idPreforeSuffix.endsWith(KEY_DELIMITER))
- return idPreforeSuffix.substring(0, idPreforeSuffix.length()-1);
- else
- return idPreforeSuffix;
- }
- return null;
-
- }
-
- /**
- * Remove a prefix string from a key
- *
- * @param key Full input key
- * @param prefix Prefix, which should be removed
- * @return The suffix of the input key or null if the input does not starts with the prefix
- */
- public static String removePrefixFromKey(String key, String prefix) {
- if (prefix == null)
- prefix = new String();
-
- if (key!=null && key.startsWith(prefix)) {
- String afterPrefix = key.substring(prefix.length());
- int index = afterPrefix.indexOf(KEY_DELIMITER);
-
- if (index == 0) {
- afterPrefix = afterPrefix.substring(1);
-
- }
- return afterPrefix;
-
- }
- return null;
- }
-
- /**
- * Remove a prefix string from all keys in {Map<String, String>} of key/value pairs
- *
- * @param keys Input data of key/value pairs
- * @param prefix Prefix which should be removed
- * @return {Map<String, String>} of key/value pairs without prefix in key, but never null
- */
- public static Map<String, String> removePrefixFromKeys(Map<String, String> keys, String prefix) {
- Map<String, String> result = new HashMap<String, String>();
- Iterator<Entry<String, String>> interator = keys.entrySet().iterator();
- while(interator.hasNext()) {
- Entry<String, String> el = interator.next();
- String newKey = removePrefixFromKey(el.getKey(), prefix);
- if (MiscUtil.isNotEmpty(newKey)) {
- result.put(newKey, el.getValue());
- }
- }
-
- return result;
- }
-
- /**
- * Get a subset of key/value pairs which starts with a prefix string
- * The Prefix is removed from the key
- *
- * @param keys Input data of key/value pairs
- * @param prefix Prefix string
- * @return {Map<String, String>} of key/value pairs without prefix in key, but never null
- */
- public static Map<String, String> getSubSetWithPrefix(Map<String, String> keys, String prefix) {
- return removePrefixFromKeys(keys, prefix);
- }
-
-
- /**
- * Add a prefix to key/value pairs to make the key absolute according to key namespace convention
- *
- * @param input Input key/value pairs which should be updated
- * @param prefix Key prefix, which should be added if the key is not absolute
- * @param absolutIdentifier Key identifier, which indicates an absolute key
- * @return {Map<String, String>} of key/value pairs in which all keys are absolute but never null
- */
- public static Map<String, String> makeKeysAbsolut(Map<String, String> input, String prefix, String absolutIdentifier) {
- Map<String, String> result = new HashMap<String, String>();
- Iterator<Entry<String, String>> interator = input.entrySet().iterator();
- while(interator.hasNext()) {
- Entry<String, String> el = interator.next();
- if (!el.getKey().startsWith(absolutIdentifier)) {
- //key is not absolute -> add prefix
- result.put(prefix
- + KEY_DELIMITER
- + el.getKey(),
- el.getValue());
-
- } else {
- //key is absolute
- result.put(el.getKey(), el.getValue());
- }
- }
- return result;
- }
-
- /**
- * Get the parent key string from an input key
- *
- * @param key input key
- * @return parent key or the empty String if no parent exists
- */
- public static String getParentKey(String key) {
- if (MiscUtil.isNotEmpty(key)) {
- int index = key.lastIndexOf(KEY_DELIMITER);
- if (index > 0) {
- return key.substring(0, index);
-
- }
- }
-
- return new String();
- }
-
- /**
- * Find the highest free list counter
- *
- * @param input Array of list keys
- * @param listPrefix {String} prefix of the list
- * @return {int} highest free list counter
- */
- public static int findNextFreeListCounter(String[] input,
- String listPrefix) {
- List<Integer> counters = new ArrayList<Integer>();
- if (input == null || input.length == 0)
- return 0;
-
- else {
- for (String key : input) {
- String listIndex = getFirstChildAfterPrefix(key, listPrefix);
- counters.add(Integer.parseInt(listIndex));
-
- }
- Collections.sort(counters);
- return counters.get(counters.size()-1) + 1;
- }
- }
-
- /**
- * Find the highest free list counter
- *
- * @param keySet {Set<String>} of list keys
- * @param listPrefix {String} prefix of the list
- * @return {int} highest free list counter
- */
- public static int findNextFreeListCounter(Set<String> keySet,
- String listPrefix) {
- if (keySet.isEmpty())
- return 0;
-
- String[] array = new String[keySet.size()];
- keySet.toArray(array);
- return findNextFreeListCounter(array, listPrefix);
- }
-
-
- /**
- * Normalize a CSV encoded list of value of an key/value pair
- *
- * This method removes all whitespace at the begin or the
- * end of CSV values and remove newLine signs at the end of value.
- * The ',' is used as list delimiter
- *
- * @param value CSV encoded input data
- * @return normalized CSV encoded data or null if {value} is null or empty
- */
- public static String normalizeCSVValueString(String value) {
- String normalizedCodes = null;
- if (MiscUtil.isNotEmpty(value)) {
- String[] codes = value.split(CSV_DELIMITER);
- for (String el: codes) {
- if (normalizedCodes == null)
- normalizedCodes = StringUtils.chomp(el.trim());
- else
- normalizedCodes += "," + StringUtils.chomp(el.trim());
-
- }
- }
- return normalizedCodes;
- }
-
-
- /**
- * Check a String if it is a comma separated list of values
- *
- * This method uses the ',' as list delimiter.
- *
- * @param value CSV encoded input data
- * @return true if the input data contains a ',' and has more then 1 list element, otherwise false
- */
- public static boolean isCSVValueString(String value) {
- if (MiscUtil.isNotEmpty(value)) {
- String[] codes = value.split(CSV_DELIMITER);
- if (codes.length >= 2) {
- if (MiscUtil.isNotEmpty(codes[1].trim()))
- return true;
-
- }
- }
-
- return false;
- }
-
- /**
- * Convert a CSV list to a List of CSV values
- * <br><br>
- * This method removes all whitespace at the begin or the
- * end of CSV values and remove newLine signs at the end of value.
- * The ',' is used as list delimiter
- *
- * @param csv CSV encoded input data
- * @return List of CSV normalized values, but never null
- */
- public static List<String> getListOfCSVValues(String csv) {
- List<String> list = new ArrayList<String>();
- if (MiscUtil.isNotEmpty(csv)) {
- String[] values = csv.split(CSV_DELIMITER);
- for (String el: values)
- list.add(el.trim());
-
- }
-
- return list;
- }
-
- /**
- * This method remove all newline delimiter (\n or \r\n) from input data
- *
- * @param value Input String
- * @return Input String without newline characters
- */
- public static String removeAllNewlineFromString(String value) {
- return value.replaceAll("(\\t|\\r?\\n)+", "");
-
- }
-
-}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/MOAIDMessageProvider.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/MOAIDMessageProvider.java
index 4d8a07a55..f4143e434 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/MOAIDMessageProvider.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/MOAIDMessageProvider.java
@@ -48,47 +48,46 @@ package at.gv.egovernment.moa.id.commons.utils;
import java.util.Locale;
+import org.springframework.stereotype.Service;
+
+import at.gv.egiz.eaaf.core.api.IStatusMessenger;
+import at.gv.egiz.eaaf.core.exceptions.ProcessExecutionException;
+import at.gv.egovernment.moa.id.commons.api.exceptions.BKUException;
+import at.gv.egovernment.moa.id.commons.api.exceptions.MISSimpleClientException;
+import at.gv.egovernment.moa.id.commons.api.exceptions.MOAIDException;
import at.gv.egovernment.moa.util.Messages;
+import at.gv.egovernment.moa.util.MiscUtil;
-/**
- * A singleton wrapper around a <code>Message</code> object, providing the messages used in MOA-ID.
- *
- * @author Paul Ivancsics
- * @version $Id$
- */
-public class MOAIDMessageProvider {
+
+@Service("MOAIDMessageProvider")
+public class MOAIDMessageProvider implements IStatusMessenger {
- /** DEFAULT_MESSAGE_RESOURCES are resources/properties/id_messages */
- private static final String[] DEFAULT_MESSAGE_RESOURCES =
- { "resources/properties/id_messages" };
- /** DEFAULT_MESSAGE_LOCALES are "de", "AT" */
- private static final Locale[] DEFAULT_MESSAGE_LOCALES =
- new Locale[] { new Locale("de", "AT") };
- /** The instance for our singleton */
- private static MOAIDMessageProvider instance;
- /** The Messages */
+ //internal messanges
+ private static final String[] DEFAULT_MESSAGE_RESOURCES = { "resources/properties/id_messages" };
+ private static final Locale[] DEFAULT_MESSAGE_LOCALES = new Locale[] { new Locale("de", "AT") };
private Messages messages;
- /**
- * Returns the single instance of <code>MOAIDMessageProvider</code>.
- *
- * @return the single instance of <code>MOAIDMessageProvider</code>
- */
+ //external error codes
+ private static final String[] DEFAULT_EXTERNALERROR_RESOURCES = { "resources/properties/protocol_response_statuscodes" };
+ private static final Locale[] DEFAULT_EXTERNALERROR_LOCALES = new Locale[] { new Locale("de", "AT") };
+ private Messages externalError = null;
+
+
+ private static MOAIDMessageProvider instance = null;
+
public static MOAIDMessageProvider getInstance() {
- if (instance == null)
- instance = new MOAIDMessageProvider(DEFAULT_MESSAGE_RESOURCES, DEFAULT_MESSAGE_LOCALES);
- return instance;
- }
+ if (instance == null)
+ instance = new MOAIDMessageProvider();
+
+ return instance;
+
+ }
- /**
- * Create a <code>MOAIDMessageProvider</code>.
- *
- * @param resourceNames The names of the resources containing the messages.
- * @param locales The corresponding locales.
- */
- protected MOAIDMessageProvider(String[] resourceNames, Locale[] locales) {
- this.messages = new Messages(resourceNames, locales);
- }
+ public MOAIDMessageProvider() {
+ this.messages = new Messages(DEFAULT_MESSAGE_RESOURCES, DEFAULT_MESSAGE_LOCALES);
+ this.externalError = new Messages(DEFAULT_EXTERNALERROR_RESOURCES, DEFAULT_EXTERNALERROR_LOCALES);
+
+ }
/**
* Get the message corresponding to a given message ID.
@@ -97,8 +96,54 @@ public class MOAIDMessageProvider {
* @param parameters The parameters to fill in into the message arguments.
* @return The formatted message.
*/
+ @Override
public String getMessage(String messageId, Object[] parameters) {
return messages.getMessage(messageId, parameters);
}
+
+@Override
+public String getResponseErrorCode(Throwable throwable) {
+ String errorCode = null;
+
+ if (throwable instanceof BKUException) {
+ BKUException error = (BKUException) throwable;
+ errorCode = mapInternalErrorToExternalError(error.getMessageId()) +
+ error.getBkuErrorCode();
+
+ } else if (throwable instanceof MISSimpleClientException) {
+ MISSimpleClientException error = (MISSimpleClientException) throwable;
+
+ if (MiscUtil.isNotEmpty(error.getMISErrorCode()))
+ errorCode = mapInternalErrorToExternalError(error.getMessageId()) +
+ error.getMISErrorCode();
+ else
+ errorCode = mapInternalErrorToExternalError(error.getMessageId());
+
+ } else if (throwable instanceof MOAIDException) {
+ MOAIDException error = (MOAIDException) throwable;
+ errorCode = mapInternalErrorToExternalError(error.getMessageId());
+
+ } else if (throwable instanceof ProcessExecutionException) {
+ errorCode = IStatusMessenger.CODES_EXTERNAL_ERROR_PROCESSENGINE;
+
+ } else {
+ errorCode = IStatusMessenger.CODES_EXTERNAL_ERROR_GENERIC;
+
+ }
+
+ return errorCode;
+}
+
+
+@Override
+public String mapInternalErrorToExternalError(String intErrorCode) {
+ String extErrorCode = externalError.getMessage(intErrorCode, null);
+
+ if (MiscUtil.isEmpty(extErrorCode))
+ extErrorCode = IStatusMessenger.CODES_EXTERNAL_ERROR_GENERIC;
+
+ return extErrorCode;
+}
+
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/X509Utils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/X509Utils.java
new file mode 100644
index 000000000..026b1a5fb
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/X509Utils.java
@@ -0,0 +1,62 @@
+package at.gv.egovernment.moa.id.commons.utils;
+
+import java.security.cert.X509Certificate;
+import java.util.List;
+
+import javax.security.auth.x500.X500Principal;
+
+public class X509Utils {
+
+ /**
+ * Sorts the Certificate Chain by IssuerDN and SubjectDN. The [0]-Element should be the Hostname,
+ * the last Element should be the Root Certificate.
+ *
+ * @param certs
+ * The first element must be the correct one.
+ * @return sorted Certificate Chain
+ */
+ public static List<X509Certificate> sortCertificates(
+ List<X509Certificate> certs)
+ {
+ int length = certs.size();
+ if (certs.size() <= 1)
+ {
+ return certs;
+ }
+
+ for (X509Certificate cert : certs)
+ {
+ if (cert == null)
+ {
+ throw new NullPointerException();
+ }
+ }
+
+ for (int i = 0; i < length; i++)
+ {
+ boolean found = false;
+ X500Principal issuer = certs.get(i).getIssuerX500Principal();
+ for (int j = i + 1; j < length; j++)
+ {
+ X500Principal subject = certs.get(j).getSubjectX500Principal();
+ if (issuer.equals(subject))
+ {
+ // sorting necessary?
+ if (i + 1 != j)
+ {
+ X509Certificate tmp = certs.get(i + 1);
+ certs.set(i + 1, certs.get(j));
+ certs.set(j, tmp);
+ }
+ found = true;
+ }
+ }
+ if (!found)
+ {
+ break;
+ }
+ }
+
+ return certs;
+ }
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/ssl/SSLUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/ssl/SSLUtils.java
index abf2d211c..e6efca4ea 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/ssl/SSLUtils.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/ssl/SSLUtils.java
@@ -58,8 +58,8 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
+import at.gv.egiz.eaaf.core.impl.utils.KeyStoreUtils;
import at.gv.egovernment.moa.logging.Logger;
-import at.gv.egovernment.moa.util.KeyStoreUtils;
import at.gv.egovernment.moaspss.logging.LoggingContext;
import at.gv.egovernment.moaspss.logging.LoggingContextManager;
import iaik.pki.DefaultPKIConfiguration;
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/IPKIXValidator.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/IPKIXValidator.java
new file mode 100644
index 000000000..ce32cbd0d
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/IPKIXValidator.java
@@ -0,0 +1,6 @@
+package at.gv.egovernment.moa.id.commons.validation;
+
+public interface IPKIXValidator {
+
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/MOASPPKIXCertValidator.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/MOASPPKIXCertValidator.java
new file mode 100644
index 000000000..fda567452
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/MOASPPKIXCertValidator.java
@@ -0,0 +1,9 @@
+package at.gv.egovernment.moa.id.commons.validation;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class MOASPPKIXCertValidator implements IPKIXValidator {
+
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/PKIXValidatorConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/PKIXValidatorConfiguration.java
new file mode 100644
index 000000000..20235c4b6
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/PKIXValidatorConfiguration.java
@@ -0,0 +1,21 @@
+package at.gv.egovernment.moa.id.commons.validation;
+
+public class PKIXValidatorConfiguration {
+
+ public enum CHAININGMODE {
+ pkix, chaining
+ }
+
+ public enum REVOCATIONCHECKMETHODES {
+ crl, ocsp
+ }
+
+ private String trustStorePath = null;
+ private String certStorePath = null;
+ private boolean revocationChecking = true;
+ private REVOCATIONCHECKMETHODES[] revocationCheckMode = {REVOCATIONCHECKMETHODES.ocsp, REVOCATIONCHECKMETHODES.crl};
+ private CHAININGMODE chaining = CHAININGMODE.pkix;
+
+
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/Constants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/Constants.java
index c94222ea0..47abbf29a 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/Constants.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/Constants.java
@@ -281,7 +281,7 @@ public interface Constants {
/** 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";
+ SCHEMA_ROOT + "XAdES01903v132-201601.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#";
@@ -290,7 +290,7 @@ public interface Constants {
/** 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";
+ SCHEMA_ROOT + "XAdES01903v141-201601.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#";
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java
deleted file mode 100644
index 62a168ac8..000000000
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/DOMUtils.java
+++ /dev/null
@@ -1,1263 +0,0 @@
-/*
- * 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;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-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.Result;
-import javax.xml.transform.Source;
-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.apache.commons.io.IOUtils;
-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.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;
-
-/**
- * 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";
-
- 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";
-
- public static final String DISALLOW_DOCTYPE_FEATURE =
- "http://apache.org/xml/features/disallow-doctype-decl";
-
-
-
- /** 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
- * <code>systemId</code> (namespace URI) is not already present in the pool.
- *
- * @param inputStream An <code>InputStream</code> 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 <code>InputStream</code>.
- *
- * @param inputStream The <code>InputStream</code> containing the XML
- * document.
- * @param validating If <code>true</code>, parse validating.
- * @param externalSchemaLocations A <code>String</code> containing namespace
- * URI to schema location pairs, the same way it is accepted by the <code>xsi:
- * schemaLocation</code> attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the
- * schema for elements without a namespace, the same way it is accepted by the
- * <code>xsi:noNamespaceSchemaLocation</code> attribute.
- * @param entityResolver An <code>EntityResolver</code> to resolve external
- * entities (schemas and DTDs). If <code>null</code>, it will not be set.
- * @param errorHandler An <code>ErrorHandler</code> to decide what to do
- * with parsing errors. If <code>null</code>, 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,
- Map<String, Object> parserFeatures)
- throws SAXException, IOException, ParserConfigurationException {
-
- 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
- byte buffer [] = null;
- ByteArrayInputStream baStream = null;
- if(true == Logger.isDebugEnabled()) {
- buffer = IOUtils.toByteArray(inputStream);
- 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);
- parser.setFeature(EXTERNAL_GENERAL_ENTITIES_FEATURE, false);
- parser.setFeature(EXTERNAL_PARAMETER_ENTITIES_FEATURE, false);
-
- //set external added parser features
- if (parserFeatures != null) {
- for (Entry<String, Object> el : parserFeatures.entrySet()) {
- String key = el.getKey();
- if (MiscUtil.isNotEmpty(key)) {
- Object value = el.getValue();
- if (value != null && value instanceof Boolean)
- parser.setFeature(key, (boolean)value);
-
- else
- Logger.warn("This XML parser only allows features with 'boolean' values");
-
- } else
- Logger.warn("Can not set 'null' feature to XML parser");
- }
- }
-
- //fix XXE problem
- //parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
-
-
- 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 <code>InputStream</code>.
- *
- * @param inputStream The <code>InputStream</code> containing the XML
- * document.
- * @param validating If <code>true</code>, parse validating.
- * @param externalSchemaLocations A <code>String</code> containing namespace
- * URI to schema location pairs, the same way it is accepted by the <code>xsi:
- * schemaLocation</code> attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the
- * schema for elements without a namespace, the same way it is accepted by the
- * <code>xsi:noNamespaceSchemaLocation</code> attribute.
- * @param entityResolver An <code>EntityResolver</code> to resolve external
- * entities (schemas and DTDs). If <code>null</code>, it will not be set.
- * @param errorHandler An <code>ErrorHandler</code> to decide what to do
- * with parsing errors. If <code>null</code>, 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 <code>InputStream</code>.
- *
- * It uses a <code>MOAEntityResolver</code> as the <code>EntityResolver</code>
- * and a <code>MOAErrorHandler</code> as the <code>ErrorHandler</code>.
- *
- * @param inputStream The <code>InputStream</code> containing the XML
- * document.
- * @param validating If <code>true</code>, parse validating.
- * @param externalSchemaLocations A <code>String</code> containing namespace
- * URI to schema location pairs, the same way it is accepted by the <code>xsi:
- * schemaLocation</code> attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the
- * schema for elements without a namespace, the same way it is accepted by the
- * <code>xsi:noNamespaceSchemaLocation</code> attribute.
- * @param parserFeatures
- * @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, Map<String, Object> parserFeatures)
- throws SAXException, IOException, ParserConfigurationException {
-
-
-
- return parseDocument(
- inputStream,
- validating,
- externalSchemaLocations,
- externalNoNamespaceSchemaLocation,
- new MOAEntityResolver(),
- new MOAErrorHandler(),
- parserFeatures);
- }
-
- /**
- * Parse an XML document from a <code>String</code>.
- *
- * It uses a <code>MOAEntityResolver</code> as the <code>EntityResolver</code>
- * and a <code>MOAErrorHandler</code> as the <code>ErrorHandler</code>.
- *
- * @param xmlString The <code>String</code> containing the XML document.
- * @param encoding The encoding of the XML document.
- * @param validating If <code>true</code>, parse validating.
- * @param externalSchemaLocations A <code>String</code> containing namespace
- * URI to schema location pairs, the same way it is accepted by the <code>xsi:
- * schemaLocation</code> attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the
- * schema for elements without a namespace, the same way it is accepted by the
- * <code>xsi:noNamespaceSchemaLocation</code> 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,
- Map<String, Object> parserFeatures)
- throws SAXException, IOException, ParserConfigurationException {
-
- InputStream in = new ByteArrayInputStream(xmlString.getBytes(encoding));
- return parseDocument(
- in,
- validating,
- externalSchemaLocations,
- externalNoNamespaceSchemaLocation,
- parserFeatures);
- }
-
-
- /**
- * Parse an XML document from a <code>String</code>.
- *
- * It uses a <code>MOAEntityResolver</code> as the <code>EntityResolver</code>
- * and a <code>MOAErrorHandler</code> as the <code>ErrorHandler</code>.
- *
- * @param xmlString The <code>String</code> containing the XML document.
- * @param encoding The encoding of the XML document.
- * @param validating If <code>true</code>, parse validating.
- * @param externalSchemaLocations A <code>String</code> containing namespace
- * URI to schema location pairs, the same way it is accepted by the <code>xsi:
- * schemaLocation</code> attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the
- * schema for elements without a namespace, the same way it is accepted by the
- * <code>xsi:noNamespaceSchemaLocation</code> 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,
- null);
- }
-
- /**
- * Parse an UTF-8 encoded XML document from a <code>String</code>.
- *
- * @param xmlString The <code>String</code> containing the XML document.
- * @param validating If <code>true</code>, parse validating.
- * @param externalSchemaLocations A <code>String</code> containing namespace
- * URI to schema location pairs, the same way it is accepted by the <code>xsi:
- * schemaLocation</code> attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the
- * schema for elements without a namespace, the same way it is accepted by the
- * <code>xsi:noNamespaceSchemaLocation</code> 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 <code>InputStream</code> 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, null)
- .getDocumentElement();
- }
-
- /**
- * A convenience method to parse an XML document validating.
- *
- * @param inputStream The <code>InputStream</code> containing the XML
- * document.
- * @param parserFeatures Set additional features to XML parser
- * @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, Map<String, Object> parserFeatures)
- throws ParserConfigurationException, SAXException, IOException {
- return DOMUtils
- .parseDocument(inputStream, true, Constants.ALL_SCHEMA_LOCATIONS, null, parserFeatures)
- .getDocumentElement();
- }
-
- /**
- * A convenience method to parse an XML document non validating.
- * This method disallow DocType declarations
- *
- * @param inputStream The <code>InputStream</code> 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,
- Collections.unmodifiableMap(new HashMap<String, Object>() {
- private static final long serialVersionUID = 1L;
- {
- put(DOMUtils.DISALLOW_DOCTYPE_FEATURE, true);
-
- }
- })).getDocumentElement();
- }
-
- /**
- * Schema validate a given DOM element.
- *
- * @param element The element to validate.
- * @param externalSchemaLocations A <code>String</code> containing namespace
- * URI to schema location pairs, the same way it is accepted by the <code>xsi:
- * schemaLocation</code> attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the
- * schema for elements without a namespace, the same way it is accepted by the
- * <code>xsi:noNamespaceSchemaLocation</code> attribute.
- * @return <code>true</code>, if the <code>element</code> 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);
- parser.setFeature(EXTERNAL_GENERAL_ENTITIES_FEATURE, false);
- parser.setFeature(DISALLOW_DOCTYPE_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;
- }
-
-
- /**
- * Schema validate a given DOM element.
- *
- * @param element The element to validate.
- * @param externalSchemaLocations A <code>String</code> containing namespace
- * URI to schema location pairs, the same way it is accepted by the <code>xsi:
- * schemaLocation</code> attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the
- * schema for elements without a namespace, the same way it is accepted by the
- * <code>xsi:noNamespaceSchemaLocation</code> attribute.
- * @return <code>true</code>, if the <code>element</code> 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.
- *
- * The node will be serialized using the UTF-8 encoding.
- *
- * @param node The node to serialize.
- * @return String The <code>String</code> representation of the given DOM
- * node.
- * @throws TransformerException An error occurred transforming the
- * node to a <code>String</code>.
- * @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 <code>String</code> representation of the given DOM
- * node.
- * @throws TransformerException An error occurred transforming the
- * node to a <code>String</code>.
- * @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 <code>String</code> representation of the given DOM
- * node.
- * @throws TransformerException An error occurred transforming the
- * node to a <code>String</code>.
- * @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 <code>String</code>.
- * @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 <code>String</code>.
- * @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 <code>String</code>.
- * @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:
- * <ul>
- * <li>Ignores comments and processing instructions.</li>
- * <li>Concatenates TEXT nodes, CDATA nodes, and the results recursively
- * processing EntityRef nodes.</li>
- * <li>Ignores any element nodes in the sublist. (Other possible options are
- * to recurse into element sublists or throw an exception.)</li>
- * </ul>
- *
- * @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 <code>String</code> value to <code>String</code> 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 <code>context</code>,
- * including the ones used in <code>context</code> itself.
- */
- public static Set collectNamespaceURIs(Element context) {
- Set result = new HashSet();
-
- collectNamespaceURIsImpl(context, result);
- return result;
- }
-
- /**
- * A recursive method to do the work of <code>collectNamespaceURIs</code>.
- *
- * @param context The context element to evaluate.
- * @param result The result, passed as a parameter to avoid unnecessary
- * instantiations of <code>Set</code>.
- */
- 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 <code>NodeList</code> has its
- * parent in the <code>NodeList</code> as well.
- *
- * @param nodes The <code>NodeList</code> to check.
- * @return <code>true</code>, if each attribute node in <code>nodes</code>
- * has its parent in <code>nodes</code> 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 <code>NodeList</code> into a
- * <code>DocumentFragment</code>.
- *
- * @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 <code>nodeList2DocumentFragment</code>.
- *
- * @param nodeList The <code>NodeList</code> to convert.
- * @param currPos The current position in the <code>nodeList</code>.
- * @param result The resulting <code>DocumentFragment</code>.
- * @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 <code>true</code>, if the attribute is a namespace declaration,
- * <code>false</code> 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 <code>true</code>, if <code>candAnc</code> is an (indirect)
- * ancestor of <code>cand</code>; <code>false</code> 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 <code>null</code>
- * if the node list is <code>null</code> 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<nl.getLength(); i++) {
- Node node = nl.item(i);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- return (Element)node;
- }
- }
- 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;
- }
-
- /**
- * 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/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/FileUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/FileUtils.java
deleted file mode 100644
index 8d6aea164..000000000
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/FileUtils.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-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 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);
-
- if (keyFile.toString().startsWith("file:"))
- newURL = keyFile.toString();
-
- else
- newURL = keyFile.toURI().toString();
-
- }
- return newURL;
- }
- }
-
-
- private static void copy( InputStream fis, OutputStream fos )
- {
- try
- {
- byte[] buffer = new byte[ 0xFFFF ];
- for ( int len; (len = fis.read(buffer)) != -1; )
- fos.write( buffer, 0, len );
- }
- catch( IOException e ) {
- System.err.println( e );
- }
- finally {
- if ( fis != null )
- try { fis.close(); } catch ( IOException e ) { e.printStackTrace(); }
- if ( fos != null )
- try { fos.close(); } catch ( IOException e ) { e.printStackTrace(); }
- }
- }
-
- public static void copyFile(File src, File dest)
- {
- try
- {
- copy( new FileInputStream( src ), new FileOutputStream( dest ) );
- }
- catch( IOException e ) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java
deleted file mode 100644
index 38dcafcc0..000000000
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/KeyStoreUtils.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * 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;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.security.GeneralSecurityException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.cert.Certificate;
-
-/**
- * Utility for creating and loading key stores.
- *
- * @author Paul Ivancsics
- * @version $Id$
- */
-public class KeyStoreUtils {
-
- /**
- * JAVA KeyStore
- */
- private static final String KEYSTORE_TYPE_JKS = "JKS";
-
- /**
- * PKCS12 KeyStore
- */
- private static final String KEYSTORE_TYPE_PKCS12 = "PKCS12";
-
-
-
- /**
- * 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 <code>InputStream</code>, and
- * closes the <code>InputStream</code>.
- *
- * @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 <code>String[]</code>, starting with <code>"0"</code>.
- *
- * @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 <code>String[]</code>, starting with <code>"0"</code>.
-// * 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;
- }
-
-
- /**
- * Loads a keyStore without knowing the keyStore type
- * @param keyStorePath URL to the keyStore
- * @param password Password protecting the keyStore
- * @return keyStore loaded
- * @throws KeyStoreException thrown if keyStore cannot be loaded
- * @throws FileNotFoundException
- * @throws IOException
- */
- public static KeyStore loadKeyStore(String keyStorePath, String password) throws KeyStoreException, IOException{
-
- //InputStream is = new FileInputStream(keyStorePath);
- URL keystoreURL = new URL(keyStorePath);
- InputStream in = keystoreURL.openStream();
- InputStream isBuffered = new BufferedInputStream(in);
- return loadKeyStore(isBuffered, password);
-
- }
-
- /**
- * Loads a keyStore without knowing the keyStore type
- * @param in input stream
- * @param password Password protecting the keyStore
- * @return keyStore loaded
- * @throws KeyStoreException thrown if keyStore cannot be loaded
- * @throws FileNotFoundException
- * @throws IOException
- */
-public static KeyStore loadKeyStore(InputStream is, String password) throws KeyStoreException, IOException{
- is.mark(1024*1024);
- KeyStore ks = null;
- try {
- try {
- ks = loadKeyStore(KEYSTORE_TYPE_PKCS12, is, password);
- } catch (IOException e2) {
- is.reset();
- ks = loadKeyStore(KEYSTORE_TYPE_JKS, is, password);
- }
- } catch(Exception e) {
- e.printStackTrace();
- //throw new KeyStoreException(e);
- }
- return ks;
-
- }
-
-
-
-
-}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java
index 7a79bd9e5..c0b530ed0 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/MOADefaultHandler.java
@@ -33,6 +33,8 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
+import at.gv.egiz.eaaf.core.impl.utils.EAAFDomEntityResolver;
+
/**
* A <code>DefaultHandler</code> that uses a <code>MOAEntityResolver</code> and
* a <code>MOAErrorHandler</code>.
@@ -48,9 +50,9 @@ public class MOADefaultHandler extends DefaultHandler {
/**
* Create a new <code>MOADefaultHandler</code>.
- */
+ */
public MOADefaultHandler() {
- entityResolver = new MOAEntityResolver();
+ entityResolver = new EAAFDomEntityResolver();
errorHandler = new MOAErrorHandler();
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java
deleted file mode 100644
index fdc823229..000000000
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/NodeIteratorAdapter.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-import org.w3c.dom.traversal.NodeFilter;
-import org.w3c.dom.traversal.NodeIterator;
-
-/**
- * A <code>NodeIterator</code> implementation based on a
- * <code>ListIterator</code>.
- *
- * @see java.util.ListIterator
- * @see org.w3c.dom.traversal.NodeIterator
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class NodeIteratorAdapter implements NodeIterator {
-
- /** The <code>ListIterator</code> to wrap. */
- private ListIterator nodeIterator;
-
- /**
- * Create a new <code>NodeIteratorAdapter</code>.
- * @param nodeIterator The <code>ListIterator</code> 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/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java
deleted file mode 100644
index e4ccd127f..000000000
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/StreamUtils.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * 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;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
-
-/**
- * Utility methods for streams.
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class StreamUtils {
-
- /**
- * Compare the contents of two <code>InputStream</code>s.
- *
- * @param is1 The 1st <code>InputStream</code> to compare.
- * @param is2 The 2nd <code>InputStream</code> to compare.
- * @return boolean <code>true</code>, if both streams contain the exactly the
- * same content, <code>false</code> 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 <code>true</code>, if the byte arrays are equal, <code>false</code>
- * 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 <code>InputStream</code> to read.
- * @return The bytes contained in the given <code>InputStream</code>.
- * @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();
- }
-
- /**
- * Reads a <code>String</code> from a stream, using given encoding.
- * @param in The <code>InputStream</code> to read.
- * @param encoding The character encoding to use for converting the bytes
- * of the <code>InputStream</code> into a <code>String</code>.
- * @return The content of the given <code>InputStream</code> converted into
- * a <code>String</code>.
- * @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 <code>Throwable</code> passed in as a string.
- * @param t The <code>Throwable</code>.
- * @return a String representing the stack trace of the <code>Throwable</code>.
- */
- public static String getStackTraceAsString(Throwable t)
- {
- ByteArrayOutputStream stackTraceBIS = new ByteArrayOutputStream();
- t.printStackTrace(new PrintStream(stackTraceBIS));
- return new String(stackTraceBIS.toByteArray());
- }
-}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/XPathException.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/XPathException.java
deleted file mode 100644
index 206245a68..000000000
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/XPathException.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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;
-import java.io.PrintWriter;
-
-/**
- * An exception occurred evaluating an XPath.
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public class XPathException extends RuntimeException {
- /**
- *
- */
- private static final long serialVersionUID = 1736311265333034392L;
-/** The wrapped exception. */
- private Throwable wrapped;
-
- /**
- * Create a <code>XPathException</code>.
- *
- * @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/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java
deleted file mode 100644
index 89aeaf3d1..000000000
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/util/XPathUtils.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- * 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;
-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.Navigator;
-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 <code>DocumentNavigator</code> to use for navigating the document. */
- private static Navigator 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);
- ctx.addNamespace(Constants.STORK_PREFIX, Constants.STORK_NS_URI);
- ctx.addNamespace(Constants.STORKP_PREFIX, Constants.STORKP_NS_URI);
- ctx.addNamespace(Constants.SAML2_PREFIX, Constants.SAML2_NS_URI);
- ctx.addNamespace(Constants.SAML2P_PREFIX, Constants.SAML2P_NS_URI);
- ctx.addNamespace(Constants.XENC_PREFIX, Constants.XENC_NS_URI);
- ctx.addNamespace(Constants.XADES_1_1_1_NS_PREFIX, Constants.XADES_1_1_1_NS_URI);
- NS_CONTEXT = ctx;
- }
-
- /**
- * Return a <code>NodeIterator</code> over the nodes matching the XPath
- * expression.
- *
- * All namespace URIs and prefixes declared in the <code>Constants</code>
- * 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 <code>NodeIterator</code> 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 <code>NodeIterator</code> 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
- * (<code>String</code> to <code>String</code>) 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 <code>NodeIterator</code> over the nodes matching the XPath
- * expression.
- *
- * @param contextNode The root node from which to evaluate the XPath
- * expression.
- * @param nsContext The <code>NamespaceContext</code> 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 <code>NodeList</code> of all the nodes matching the XPath
- * expression.
- *
- * All namespace URIs and prefixes declared in the <code>Constants</code>
- * 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 <code>NodeList</code> 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 <code>NodeList</code> 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 <code>NodeList</code> 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 <code>NodeList</code> 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
- * (<code>String</code> to <code>String</code>) for evaluating the XPath
- * expression.
- * @param exp The XPath expression to evaluate.
- * @return A <code>NodeList</code> 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 <code>NodeList</code> of all the nodes matching the XPath
- * expression.
- *
- * @param contextNode The root node from which to evaluate the XPath
- * expression.
- * @param nsContext The <code>NamespaceContext</code> for resolving namespace
- * prefixes to namespace URIs for evaluating the XPath expression.
- * @param exp The XPath expression to evaluate.
- * @return A <code>NodeList</code> 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 <code>Constants</code>
- * 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
- * <code>null</code>, 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
- * <code>null</code>, 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
- * (<code>String</code> to <code>String</code>) for evaluating the XPath
- * expression.
- * @param exp The XPath expression to evaluate.
- * @return Node The first node matching the XPath expression, or
- * <code>null</code>, 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 <code>NamespaceContext</code> 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
- * <code>null</code>, if no node matched.
- * @throws XPathException An error occurred evaluating the XPath expression.
- */
- public 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 <code>xpath</code>.
- * @return The element value, if it can be located using the
- * <code>xpath</code>. Otherwise, <code>def</code> 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 <code>xpath</code>.
- * @return The element value, if it can be located using the
- * <code>xpath</code>. Otherwise, <code>def</code> 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 <code>XPathUtils</code> 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 <code> XPathUtils</code> without explicitely binding it to the particular
- * namespace.
- *
- * @param contextElement The (Security Layer command) element.
- *
- * @return the namespace prefix used within <code>XPathUtils</code> 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 <code>xmlns:sl10</code>, <code>sl11</code> or <code>sl</code>
- * 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 <code>sl10</code>, <code>sl11</code> or <code>sl</code>,
- * 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 <code>xmlns:slPrefix</code> 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 <code>null</code> 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/id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES-1.4.1.xsd b/id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES-1.4.1.xsd
deleted file mode 100644
index 274dbdca1..000000000
--- a/id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES-1.4.1.xsd
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsd:schema targetNamespace="http://uri.etsi.org/01903/v1.4.1#" xmlns="http://uri.etsi.org/01903/v1.4.1#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" elementFormDefault="qualified">
- <xsd:import namespace="http://uri.etsi.org/01903/v1.3.2#" schemaLocation="XAdES-1.3.2.xsd"/>
- <!-- Start CertificateValues -->
- <xsd:element name="TimeStampValidationData" type="ValidationDataType"/>
- <xsd:complexType name="ValidationDataType">
- <xsd:sequence>
- <xsd:element ref="xades:CertificateValues" minOccurs="0" />
- <xsd:element ref="xades:RevocationValues" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
- <xsd:attribute name="UR" type="xsd:anyURI" use="optional"/>
- </xsd:complexType>
- <xsd:element name="ArchiveTimeStampV2" type="xades:XAdESTimeStampType"/>
-</xsd:schema>
diff --git a/id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES-1.3.2.xsd b/id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES01903v132-201601.xsd
index b05691515..e7a5f3a02 100644
--- a/id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES-1.3.2.xsd
+++ b/id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES01903v132-201601.xsd
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://uri.etsi.org/01903/v1.3.2#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://uri.etsi.org/01903/v1.3.2#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" elementFormDefault="qualified">
- <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>
+ <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd"/>
<!-- Start auxiliary types definitions: AnyType, ObjectIdentifierType,
EncapsulatedPKIDataType and containers for time-stamp tokens -->
<!-- Start AnyType -->
@@ -125,8 +125,8 @@ EncapsulatedPKIDataType and containers for time-stamp tokens -->
<xsd:element name="QualifyingProperties" type="QualifyingPropertiesType"/>
<xsd:complexType name="QualifyingPropertiesType">
<xsd:sequence>
- <xsd:element name="SignedProperties" type="SignedPropertiesType" minOccurs="0"/>
- <xsd:element name="UnsignedProperties" type="UnsignedPropertiesType" minOccurs="0"/>
+ <xsd:element ref="SignedProperties" minOccurs="0"/>
+ <xsd:element ref="UnsignedProperties" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="Target" type="xsd:anyURI" use="required"/>
<xsd:attribute name="Id" type="xsd:ID" use="optional"/>
@@ -136,8 +136,8 @@ EncapsulatedPKIDataType and containers for time-stamp tokens -->
<xsd:element name="SignedProperties" type="SignedPropertiesType"/>
<xsd:complexType name="SignedPropertiesType">
<xsd:sequence>
- <xsd:element name="SignedSignatureProperties" type="SignedSignaturePropertiesType" minOccurs="0"/>
- <xsd:element name="SignedDataObjectProperties" type="SignedDataObjectPropertiesType" minOccurs="0"/>
+ <xsd:element ref="SignedSignatureProperties" minOccurs="0"/>
+ <xsd:element ref="SignedDataObjectProperties" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="Id" type="xsd:ID" use="optional"/>
</xsd:complexType>
@@ -146,21 +146,26 @@ EncapsulatedPKIDataType and containers for time-stamp tokens -->
<xsd:element name="UnsignedProperties" type="UnsignedPropertiesType"/>
<xsd:complexType name="UnsignedPropertiesType">
<xsd:sequence>
- <xsd:element name="UnsignedSignatureProperties" type="UnsignedSignaturePropertiesType" minOccurs="0"/>
- <xsd:element name="UnsignedDataObjectProperties" type="UnsignedDataObjectPropertiesType" minOccurs="0"/>
+ <xsd:element ref="UnsignedSignatureProperties" minOccurs="0"/>
+ <xsd:element ref="UnsignedDataObjectProperties" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="Id" type="xsd:ID" use="optional"/>
</xsd:complexType>
<!-- End UnsignedProperties-->
<!-- Start SignedSignatureProperties-->
+ <!-- Definition changed: added new optional children for EN -->
<xsd:element name="SignedSignatureProperties" type="SignedSignaturePropertiesType"/>
<xsd:complexType name="SignedSignaturePropertiesType">
<xsd:sequence>
- <xsd:element name="SigningTime" type="xsd:dateTime" minOccurs="0"/>
- <xsd:element name="SigningCertificate" type="CertIDListType" minOccurs="0"/>
- <xsd:element name="SignaturePolicyIdentifier" type="SignaturePolicyIdentifierType" minOccurs="0"/>
- <xsd:element name="SignatureProductionPlace" type="SignatureProductionPlaceType" minOccurs="0"/>
- <xsd:element name="SignerRole" type="SignerRoleType" minOccurs="0"/>
+ <xsd:element ref="SigningTime" minOccurs="0"/>
+ <xsd:element ref="SigningCertificate" minOccurs="0"/>
+ <xsd:element ref="SigningCertificateV2" minOccurs="0"/>
+ <xsd:element ref="SignaturePolicyIdentifier" minOccurs="0"/>
+ <xsd:element ref="SignatureProductionPlace" minOccurs="0"/>
+ <xsd:element ref="SignatureProductionPlaceV2" minOccurs="0"/>
+ <xsd:element ref="SignerRole" minOccurs="0"/>
+ <xsd:element ref="SignerRoleV2" minOccurs="0"/>
+ <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="Id" type="xsd:ID" use="optional"/>
</xsd:complexType>
@@ -169,10 +174,11 @@ EncapsulatedPKIDataType and containers for time-stamp tokens -->
<xsd:element name="SignedDataObjectProperties" type="SignedDataObjectPropertiesType"/>
<xsd:complexType name="SignedDataObjectPropertiesType">
<xsd:sequence>
- <xsd:element name="DataObjectFormat" type="DataObjectFormatType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="CommitmentTypeIndication" type="CommitmentTypeIndicationType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="AllDataObjectsTimeStamp" type="XAdESTimeStampType" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="IndividualDataObjectsTimeStamp" type="XAdESTimeStampType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="DataObjectFormat" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="CommitmentTypeIndication" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="AllDataObjectsTimeStamp" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="IndividualDataObjectsTimeStamp" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="Id" type="xsd:ID" use="optional"/>
</xsd:complexType>
@@ -181,19 +187,19 @@ EncapsulatedPKIDataType and containers for time-stamp tokens -->
<xsd:element name="UnsignedSignatureProperties" type="UnsignedSignaturePropertiesType"/>
<xsd:complexType name="UnsignedSignaturePropertiesType">
<xsd:choice maxOccurs="unbounded">
- <xsd:element name="CounterSignature" type="CounterSignatureType"/>
- <xsd:element name="SignatureTimeStamp" type="XAdESTimeStampType"/>
- <xsd:element name="CompleteCertificateRefs" type="CompleteCertificateRefsType"/>
- <xsd:element name="CompleteRevocationRefs" type="CompleteRevocationRefsType"/>
- <xsd:element name="AttributeCertificateRefs" type="CompleteCertificateRefsType"/>
- <xsd:element name="AttributeRevocationRefs" type="CompleteRevocationRefsType"/>
- <xsd:element name="SigAndRefsTimeStamp" type="XAdESTimeStampType"/>
- <xsd:element name="RefsOnlyTimeStamp" type="XAdESTimeStampType"/>
- <xsd:element name="CertificateValues" type="CertificateValuesType"/>
- <xsd:element name="RevocationValues" type="RevocationValuesType"/>
- <xsd:element name="AttrAuthoritiesCertValues" type="CertificateValuesType"/>
- <xsd:element name="AttributeRevocationValues" type="RevocationValuesType"/>
- <xsd:element name="ArchiveTimeStamp" type="XAdESTimeStampType"/>
+ <xsd:element ref="CounterSignature"/>
+ <xsd:element ref="SignatureTimeStamp"/>
+ <xsd:element ref="CompleteCertificateRefs"/>
+ <xsd:element ref="CompleteRevocationRefs"/>
+ <xsd:element ref="AttributeCertificateRefs"/>
+ <xsd:element ref="AttributeRevocationRefs"/>
+ <xsd:element ref="SigAndRefsTimeStamp"/>
+ <xsd:element ref="RefsOnlyTimeStamp"/>
+ <xsd:element ref="CertificateValues"/>
+ <xsd:element ref="RevocationValues"/>
+ <xsd:element ref="AttrAuthoritiesCertValues"/>
+ <xsd:element ref="AttributeRevocationValues"/>
+ <xsd:element ref="ArchiveTimeStamp"/>
<xsd:any namespace="##other"/>
</xsd:choice>
<xsd:attribute name="Id" type="xsd:ID" use="optional"/>
@@ -240,6 +246,21 @@ EncapsulatedPKIDataType and containers for time-stamp tokens -->
</xsd:sequence>
</xsd:complexType>
<!-- End SigningCertificate -->
+ <!-- Start SigningCertificateV2 and CertIDListV2Type -->
+ <xsd:element name="SigningCertificateV2" type="CertIDListV2Type"/>
+ <xsd:complexType name="CertIDListV2Type">
+ <xsd:sequence>
+ <xsd:element name="Cert" type="CertIDTypeV2" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="CertIDTypeV2">
+ <xsd:sequence>
+ <xsd:element name="CertDigest" type="DigestAlgAndValueType"/>
+ <xsd:element name="IssuerSerialV2" type="xsd:base64Binary" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/>
+ </xsd:complexType>
+ <!-- End SigningCertificateV2 and CertIDListV2Type -->
<!-- Start SignaturePolicyIdentifier -->
<xsd:element name="SignaturePolicyIdentifier" type="SignaturePolicyIdentifierType"/>
<xsd:complexType name="SignaturePolicyIdentifierType">
@@ -287,6 +308,7 @@ EncapsulatedPKIDataType and containers for time-stamp tokens -->
<xsd:sequence>
<xsd:element ref="ds:Signature"/>
</xsd:sequence>
+ <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
</xsd:complexType>
<!-- End CounterSignature -->
<!-- Start DataObjectFormat -->
@@ -330,6 +352,18 @@ EncapsulatedPKIDataType and containers for time-stamp tokens -->
</xsd:sequence>
</xsd:complexType>
<!-- End SignatureProductionPlace -->
+ <!-- Start SignatureProductionPlaceV2 and SignatureProductionPlaceV2Type -->
+ <xsd:element name="SignatureProductionPlaceV2" type="SignatureProductionPlaceV2Type"/>
+ <xsd:complexType name="SignatureProductionPlaceV2Type">
+ <xsd:sequence>
+ <xsd:element name="City" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="StreetAddress" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="StateOrProvince" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="PostalCode" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="CountryName" type="xsd:string" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <!-- End SignatureProductionPlace -->
<!-- Start SignerRole -->
<xsd:element name="SignerRole" type="SignerRoleType"/>
<xsd:complexType name="SignerRoleType">
@@ -349,6 +383,38 @@ EncapsulatedPKIDataType and containers for time-stamp tokens -->
</xsd:sequence>
</xsd:complexType>
<!-- End SignerRole -->
+ <!-- Start SignerRoleV2 and SignerRoleV2Type -->
+ <xsd:element name="SignerRoleV2" type="SignerRoleV2Type"/>
+ <xsd:complexType name="SignerRoleV2Type">
+ <xsd:sequence>
+ <xsd:element ref="ClaimedRoles" minOccurs="0"/>
+ <xsd:element ref="CertifiedRolesV2" minOccurs="0"/>
+ <xsd:element ref="SignedAssertions" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="ClaimedRoles" type="ClaimedRolesListType"/>
+ <xsd:element name="CertifiedRolesV2" type="CertifiedRolesListTypeV2"/>
+ <xsd:element name="SignedAssertions" type="SignedAssertionsListType"/>
+ <xsd:complexType name="CertifiedRolesListTypeV2">
+ <xsd:sequence>
+ <xsd:element name="CertifiedRole" type="CertifiedRoleTypeV2" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="CertifiedRoleTypeV2">
+ <xsd:choice>
+ <xsd:element ref="X509AttributeCertificate"/>
+ <xsd:element ref="OtherAttributeCertificate"/>
+ </xsd:choice>
+ </xsd:complexType>
+ <xsd:element name="X509AttributeCertificate" type="EncapsulatedPKIDataType"/>
+ <xsd:element name="OtherAttributeCertificate" type="AnyType"/>
+ <xsd:complexType name="SignedAssertionsListType">
+ <xsd:sequence>
+ <xsd:element ref="SignedAssertion" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="SignedAssertion" type="AnyType"/>
+ <!-- End SignerRoleV2 and SignerRoleV2Type -->
<xsd:element name="AllDataObjectsTimeStamp" type="XAdESTimeStampType"/>
<xsd:element name="IndividualDataObjectsTimeStamp" type="XAdESTimeStampType"/>
<xsd:element name="SignatureTimeStamp" type="XAdESTimeStampType"/>
@@ -464,3 +530,4 @@ EncapsulatedPKIDataType and containers for time-stamp tokens -->
<xsd:element name="AttributeRevocationValues" type="RevocationValuesType"/>
<xsd:element name="ArchiveTimeStamp" type="XAdESTimeStampType"/>
</xsd:schema>
+
diff --git a/id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES01903v141-201601.xsd b/id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES01903v141-201601.xsd
new file mode 100644
index 000000000..1f3aaf935
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/resources/resources/schemas/XAdES01903v141-201601.xsd
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema targetNamespace="http://uri.etsi.org/01903/v1.4.1#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns="http://uri.etsi.org/01903/v1.4.1#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" elementFormDefault="qualified">
+ <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd"/>
+ <xsd:import namespace="http://uri.etsi.org/01903/v1.3.2#" schemaLocation="http://uri.etsi.org/01903/v1.3.2/XAdES01903v132-201601.xsd"/>
+ <!-- Start CertificateValues -->
+ <xsd:element name="TimeStampValidationData" type="ValidationDataType"/>
+ <xsd:complexType name="ValidationDataType">
+ <xsd:sequence>
+ <xsd:element ref="xades:CertificateValues" minOccurs="0"/>
+ <xsd:element ref="xades:RevocationValues" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
+ <xsd:attribute name="URI" type="xsd:anyURI" use="optional"/>
+ </xsd:complexType>
+ <xsd:element name="SignaturePolicyStore" type="SignaturePolicyStoreType"/>
+ <xsd:complexType name="SignaturePolicyStoreType">
+ <xsd:sequence>
+ <xsd:element ref="SPDocSpecification"/>
+ <xsd:choice>
+ <xsd:element name="SignaturePolicyDocument" type="xsd:base64Binary"/>
+ <xsd:element name="SigPolDocLocalURI" type="xsd:anyURI"/>
+ </xsd:choice>
+ </xsd:sequence>
+ <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
+ </xsd:complexType>
+ <xsd:element name="SPDocSpecification" type="xades:ObjectIdentifierType"/>
+ <!-- -->
+ <!-- Start RenewedDigests-->
+ <!-- -->
+ <xsd:element name="RenewedDigests" type="RenewedDigestsType"/>
+ <xsd:complexType name="RenewedDigestsType">
+ <xsd:sequence>
+ <xsd:element ref="ds:DigestMethod"/>
+ <xsd:element ref="RecomputedDigestValue" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
+ </xsd:complexType>
+ <xsd:element name="RecomputedDigestValue" type="RecomputedDigestValueType"/>
+ <xsd:complexType name="RecomputedDigestValueType">
+ <xsd:simpleContent>
+ <xsd:extension base="ds:DigestValueType">
+ <xsd:attribute name="Order" type="xsd:integer" use="required"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <!-- -->
+ <!-- End RenewedDigests-->
+ <!-- -->
+ <!-- ArchiveTimeStamp in namespace with URI 'http://uri.etsi.org/01903/v1.4.1#'-->
+ <xsd:element name="ArchiveTimeStamp" type="xades:XAdESTimeStampType"/>
+ <!--CompleteCertificateRefsV2 and AttributeCertificateRefsV2-->
+ <xsd:element name="CompleteCertificateRefsV2" type="CompleteCertificateRefsTypeV2"/>
+ <xsd:element name="AttributeCertificateRefsV2" type="CompleteCertificateRefsTypeV2"/>
+ <xsd:complexType name="CompleteCertificateRefsTypeV2">
+ <xsd:sequence>
+ <xsd:element name="CertRefs" type="xades:CertIDListV2Type"/>
+ </xsd:sequence>
+ <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
+ </xsd:complexType>
+ <!-- SigAndRefsTimeStampV2 and RefsOnlyTimeStampV2-->
+ <xsd:element name="SigAndRefsTimeStampV2" type="xades:XAdESTimeStampType"/>
+ <xsd:element name="RefsOnlyTimeStampV2" type="xades:XAdESTimeStampType"/>
+</xsd:schema>
+
diff --git a/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java b/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java
index 66bf1faff..51297fce3 100644
--- a/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java
+++ b/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/MOATestCase.java
@@ -36,8 +36,8 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
+import at.gv.egiz.eaaf.core.impl.utils.DOMUtils;
import at.gv.egovernment.moa.util.Constants;
-import at.gv.egovernment.moa.util.DOMUtils;
import junit.framework.TestCase;
/**
diff --git a/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java b/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java
index 7b1c0cb67..ac121a0b2 100644
--- a/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java
+++ b/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/DOMUtilsTest.java
@@ -31,8 +31,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
+import at.gv.egiz.eaaf.core.impl.utils.DOMUtils;
import at.gv.egovernment.moa.util.Constants;
-import at.gv.egovernment.moa.util.DOMUtils;
import test.at.gv.egovernment.moa.MOATestCase;
/**
diff --git a/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java b/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java
index e3468b89f..749879c35 100644
--- a/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java
+++ b/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/DateTimeUtilsTest.java
@@ -26,14 +26,11 @@ 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;
+import junit.framework.TestCase;
/**
* @author Patrick Peck
diff --git a/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/FileUtils.java b/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/FileUtils.java
index 8941ab4cf..c52f52fa8 100644
--- a/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/FileUtils.java
+++ b/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/FileUtils.java
@@ -26,13 +26,13 @@ import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
-import at.gv.egovernment.moa.util.StreamUtils;
+import at.gv.egiz.eaaf.core.impl.utils.StreamUtils;
/**
* @author tlenz
*
*/
-public class FileUtils extends at.gv.egovernment.moa.util.FileUtils {
+public class FileUtils extends at.gv.egiz.eaaf.core.impl.utils.FileUtils {
/**
* Reads a file, given by URL, into a String.
diff --git a/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java b/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java
index be5581139..6d341b88b 100644
--- a/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java
+++ b/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/KeyStoreUtilsTest.java
@@ -34,8 +34,7 @@ import java.security.Security;
import java.security.cert.X509Certificate;
import java.util.Enumeration;
-import at.gv.egovernment.moa.util.KeyStoreUtils;
-
+import at.gv.egiz.eaaf.core.impl.utils.KeyStoreUtils;
import junit.framework.TestCase;
/**
diff --git a/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java b/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java
index 15e6a62f3..4837caa2b 100644
--- a/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java
+++ b/id/server/moa-id-commons/src/test/java/test/at/gv/egovernment/moa/util/XPathUtilsTest.java
@@ -26,10 +26,9 @@ package test.at.gv.egovernment.moa.util;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
+import at.gv.egiz.eaaf.core.impl.utils.XPathUtils;
import test.at.gv.egovernment.moa.MOATestCase;
-import at.gv.egovernment.moa.util.XPathUtils;
-
/**
* @author Patrick Peck