aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/moa-id-commons/src/main')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egiz/components/configuration/api/AbstractConfigurationImpl.java546
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java109
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java1722
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java277
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java254
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrateConfiguration.java103
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java69
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/CLIConstants.java37
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java127
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MigrateConfigurationParams.java106
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/JsonMapper.java73
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java55
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java191
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java679
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java310
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java450
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java137
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java216
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java23
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/JsonMapper.java73
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java230
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/MOAHttpProtocolSocketFactory.java5
-rw-r--r--id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml20
-rw-r--r--id/server/moa-id-commons/src/main/resources/bindings.xjb (renamed from id/server/moa-id-commons/src/main/resources/config/bindings.xjb)0
-rw-r--r--id/server/moa-id-commons/src/main/resources/config/moaid_config_3.0.xsd (renamed from id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd)0
-rw-r--r--id/server/moa-id-commons/src/main/resources/configuration.beans.xml64
-rw-r--r--id/server/moa-id-commons/src/main/resources/configuration.beans.xml_old59
-rw-r--r--id/server/moa-id-commons/src/main/resources/hibernate_moasession.cfg.xml (renamed from id/server/moa-id-commons/src/main/resources/config/hibernate_moasession.cfg.xml)0
-rw-r--r--id/server/moa-id-commons/src/main/resources/hibernate_statistic.cfg.xml (renamed from id/server/moa-id-commons/src/main/resources/config/hibernate_statistic.cfg.xml)0
-rw-r--r--id/server/moa-id-commons/src/main/resources/moaid.migration.beans.xml40
-rw-r--r--id/server/moa-id-commons/src/main/resources/moaid_config_2.0.xsd1057
-rw-r--r--id/server/moa-id-commons/src/main/resources/persistence_template.xml (renamed from id/server/moa-id-commons/src/main/resources/config/persistence_template.xml)11
32 files changed, 6551 insertions, 492 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egiz/components/configuration/api/AbstractConfigurationImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egiz/components/configuration/api/AbstractConfigurationImpl.java
new file mode 100644
index 000000000..e2db54609
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egiz/components/configuration/api/AbstractConfigurationImpl.java
@@ -0,0 +1,546 @@
+/*
+ * 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.egiz.components.configuration.api;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author tlenz
+ *
+ */
+@Transactional("transactionManager")
+public abstract class AbstractConfigurationImpl implements Configuration {
+
+ private static final Logger logger = LoggerFactory
+ .getLogger(AbstractConfigurationImpl.class);
+
+ /**
+ * Get all keys from configuration
+ * @return The List<string> values or null if no keys found
+ */
+ abstract protected List<String> getAllKeys() throws ConfigurationException;
+
+ /**
+ * Get key specific value from configuration
+ * @param key The cfg id
+ * @return The string value or null if not found
+ */
+ abstract protected String getValue(String key) throws ConfigurationException;
+
+ /**
+ * Check configuration contains a specific key
+ * @param key The cfg id
+ * @return True if the cfg key is found
+ */
+ abstract protected boolean containsKey(String key) throws ConfigurationException;
+
+ /**
+ * Store a key/value pair to configuration
+ * @param key The cfg key
+ * @param value The cfg value
+ */
+ abstract protected void storeKey(String key, String value) throws ConfigurationException;
+
+ /**
+ * Delete a key from configuration
+ * @param key The cfg key
+ */
+ abstract protected void deleteKey(String key) throws ConfigurationException;
+
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getStringValue(java.lang.String)
+ */
+ @Override
+ public String getStringValue(String id) throws ConfigurationException {
+ return getStringValue(id, null);
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getStringValue(java.lang.String, java.lang.String)
+ */
+ @Override
+ public String getStringValue(String id, String defaultValue)
+ throws ConfigurationException {
+ String value = getValue(id);
+ if (value == null) {
+ return defaultValue;
+ }
+ return value;
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#setStringValue(java.lang.String, java.lang.String)
+ */
+ @Override
+ public void setStringValue(String id, String value)
+ throws ConfigurationException {
+ if (containsKey(id)) {
+ logger.debug("{} is overwritten with {}", id, value);
+ }
+ storeKey(id, value);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getByteValue(java.lang.String)
+ */
+ @Override
+ public byte getByteValue(String id) throws ConfigurationException {
+ return getByteValue(id, (byte) 0);
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getByteValue(java.lang.String, byte)
+ */
+ @Override
+ public byte getByteValue(String id, byte defaultValue)
+ throws ConfigurationException {
+ String value = getValue(id);
+ if (value == null)
+ return defaultValue;
+ try {
+ byte bvalue = Byte.parseByte(value);
+ return bvalue;
+ } catch (Throwable e) {
+ logger.warn("Invalid configuration value {} is not a byte value",
+ id, e);
+ }
+ return defaultValue;
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#setByteValue(java.lang.String, byte)
+ */
+ @Override
+ public void setByteValue(String id, byte value)
+ throws ConfigurationException {
+ setStringValue(id, String.valueOf(value));
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getShortValue(java.lang.String)
+ */
+ @Override
+ public short getShortValue(String id) throws ConfigurationException {
+ return getShortValue(id, (short) 0);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getShortValue(java.lang.String, short)
+ */
+ @Override
+ public short getShortValue(String id, short defaultValue)
+ throws ConfigurationException {
+ String value = getValue(id);
+ if (value == null)
+ return defaultValue;
+ try {
+ short svalue = Short.parseShort(value);
+ return svalue;
+ } catch (Throwable e) {
+ logger.warn("Invalid configuration value {} is not a short value",
+ id, e);
+ }
+ return defaultValue;
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#setShortValue(java.lang.String, short)
+ */
+ @Override
+ public void setShortValue(String id, short value)
+ throws ConfigurationException {
+ setStringValue(id, String.valueOf(value));
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getIntegerValue(java.lang.String)
+ */
+ @Override
+ public int getIntegerValue(String id) throws ConfigurationException {
+ return getIntegerValue(id, 0);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getIntegerValue(java.lang.String, int)
+ */
+ @Override
+ public int getIntegerValue(String id, int defaultValue)
+ throws ConfigurationException {
+ String value = getValue(id);
+ if (value == null)
+ return defaultValue;
+ try {
+ int ivalue = Integer.parseInt(value);
+ return ivalue;
+ } catch (Throwable e) {
+ logger.warn("Invalid configuration value {} is not a int value",
+ id, e);
+ }
+ return defaultValue;
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#setIntegerValue(java.lang.String, int)
+ */
+ @Override
+ public void setIntegerValue(String id, int value)
+ throws ConfigurationException {
+ setStringValue(id, String.valueOf(value));
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getLongValue(java.lang.String)
+ */
+ @Override
+ public long getLongValue(String id) throws ConfigurationException {
+ return getLongValue(id, 0L);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getLongValue(java.lang.String, long)
+ */
+ @Override
+ public long getLongValue(String id, long defaultValue)
+ throws ConfigurationException {
+ String value = getValue(id);
+ if (value == null)
+ return defaultValue;
+ try {
+ long lvalue = Long.parseLong(value);
+ return lvalue;
+ } catch (Throwable e) {
+ logger.warn("Invalid configuration value {} is not a long value",
+ id, e);
+ }
+ return defaultValue;
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#setLongValue(java.lang.String, long)
+ */
+ @Override
+ public void setLongValue(String id, long value)
+ throws ConfigurationException {
+ setStringValue(id, String.valueOf(value));
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getFloatValue(java.lang.String)
+ */
+ @Override
+ public float getFloatValue(String id) throws ConfigurationException {
+ return getFloatValue(id, 0.0F);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getFloatValue(java.lang.String, float)
+ */
+ @Override
+ public float getFloatValue(String id, float defaultValue)
+ throws ConfigurationException {
+ String value = getValue(id);
+ if (value == null)
+ return defaultValue;
+ try {
+ float fvalue = Float.parseFloat(value);
+ return fvalue;
+ } catch (Throwable e) {
+ logger.warn("Invalid configuration value {} is not a float value",
+ id, e);
+ }
+ return defaultValue;
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#setFloatValue(java.lang.String, float)
+ */
+ @Override
+ public void setFloatValue(String id, float value)
+ throws ConfigurationException {
+ setStringValue(id, String.valueOf(value));
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getDoubleValue(java.lang.String)
+ */
+ @Override
+ public double getDoubleValue(String id) throws ConfigurationException {
+ return getDoubleValue(id, 0.0D);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getDoubleValue(java.lang.String, double)
+ */
+ @Override
+ public double getDoubleValue(String id, double defaultValue)
+ throws ConfigurationException {
+ String value = getValue(id);
+ if (value == null)
+ return defaultValue;
+ try {
+ double dvalue = Double.parseDouble(value);
+ return dvalue;
+ } catch (Throwable e) {
+ logger.warn("Invalid configuration value {} is not a double value",
+ id, e);
+ }
+ return defaultValue;
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#setDoubleValue(java.lang.String, double)
+ */
+ @Override
+ public void setDoubleValue(String id, double value)
+ throws ConfigurationException {
+ setStringValue(id, String.valueOf(value));
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getBooleanValue(java.lang.String)
+ */
+ @Override
+ public boolean getBooleanValue(String id) throws ConfigurationException {
+ return getBooleanValue(id, false);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getBooleanValue(java.lang.String, boolean)
+ */
+ @Override
+ public boolean getBooleanValue(String id, boolean defaultValue)
+ throws ConfigurationException {
+ String value = getValue(id);
+ if (value == null)
+ return defaultValue;
+ try {
+ boolean bvalue = Boolean.parseBoolean(value);
+ return bvalue;
+ } catch (Throwable e) {
+ logger.warn(
+ "Invalid configuration value {} is not a boolean value",
+ id, e);
+ }
+ return defaultValue;
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#setBooleanValue(java.lang.String, boolean)
+ */
+ @Override
+ public void setBooleanValue(String id, boolean value)
+ throws ConfigurationException {
+ setStringValue(id, String.valueOf(value));
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getCharValue(java.lang.String)
+ */
+ @Override
+ public char getCharValue(String id) throws ConfigurationException {
+ return getCharValue(id, '\0');
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getCharValue(java.lang.String, char)
+ */
+ @Override
+ public char getCharValue(String id, char defaultValue)
+ throws ConfigurationException {
+ String value = getValue(id);
+ if (value == null) {
+ return defaultValue;
+ }
+ if (value.toCharArray().length > 0) {
+ return value.toCharArray()[0];
+ }
+ logger.warn("Invalid configuration value {} is not a char value", id);
+ return defaultValue;
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#setCharValue(java.lang.String, short)
+ */
+ @Override
+ public void setCharValue(String id, short value)
+ throws ConfigurationException {
+ setStringValue(id, String.valueOf(value));
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getObjectValue(java.lang.String, java.lang.Class)
+ */
+ @Override
+ public <T> T getObjectValue(String id, Class<T> cls)
+ throws ConfigurationException {
+ return getObjectValue(id, cls, null);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getObjectValue(java.lang.String, java.lang.Class, java.lang.Object)
+ */
+ @Override
+ public <T> T getObjectValue(String id, Class<T> cls, T defaultValue)
+ throws ConfigurationException {
+ String savedValue = getStringValue(id);
+ if (savedValue == null) {
+ return defaultValue;
+ }
+ ObjectTranslator objectTranslator = ConfigurationFactory
+ .getObjectTranslator(cls);
+ if (objectTranslator == null) {
+ logger.warn(
+ "Found object value but could not find Object Transator for cls {}",
+ cls.getName());
+
+ throw new ConfigurationException("No Object Translator for ["
+ + cls.getName() + "] available");
+ }
+ return objectTranslator.toObject(savedValue, cls);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#setObjectValue(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public <T> void setObjectValue(String id, Object object)
+ throws ConfigurationException {
+ ObjectTranslator objectTranslator = ConfigurationFactory
+ .getObjectTranslator(object);
+ if (objectTranslator == null) {
+ logger.warn("Could not find Object Transator for cls {}", object
+ .getClass().getName());
+
+ throw new ConfigurationException("No Object Translator for ["
+ + object.getClass().getName() + "] available");
+ }
+ String cfgValue = objectTranslator.toString(object);
+ setStringValue(id, cfgValue);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#findConfigurationId(java.lang.String)
+ */
+ @Override
+ abstract public String[] findConfigurationId(String searchString)
+ throws ConfigurationException;
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#findByValue(java.lang.String)
+ */
+ @Override
+ abstract public String[] findByValue(String searchString)
+ throws ConfigurationException;
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getConfigurationIds()
+ */
+ @Override
+ public String[] getConfigurationIds() throws ConfigurationException {
+ List<String> allKeys = getAllKeys();
+ return allKeys.toArray(new String[allKeys.size()]);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getConfigurationIdNextLevel(java.lang.String)
+ */
+ @Override
+ public String[] getConfigurationIdNextLevel(String prefix)
+ throws ConfigurationException {
+ String[] allIds = getConfigurationIds();
+ Set<String> subIds = new HashSet<String>();
+
+ for (String id : allIds) {
+ if (id.startsWith(prefix)) {
+ String idAfterPrefix = id.substring(prefix.length());
+ int index = idAfterPrefix.indexOf(".");
+
+ if (index == 0) {
+ idAfterPrefix = idAfterPrefix.substring(1);
+ index = idAfterPrefix.indexOf(".");
+ }
+
+ if (index > 0) {
+ String adding = idAfterPrefix.substring(0, index);
+ if (!(adding.isEmpty())) {
+ subIds.add(adding);
+ }
+ } else if (!(idAfterPrefix.isEmpty())) {
+ subIds.add(idAfterPrefix);
+ }
+ }
+
+ }
+
+ String[] subIdarray = new String[subIds.size()];
+ subIdarray = (String[]) subIds.toArray(subIdarray);
+ return subIdarray;
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#deleteIds(java.lang.String)
+ */
+ @Override
+ abstract public void deleteIds(String idSearch) throws ConfigurationException;
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#synchronize()
+ */
+ @Override
+ abstract public void synchronize() throws ConfigurationException;
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.Configuration#getName()
+ */
+ @Override
+ abstract public String getName();
+
+}
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
new file mode 100644
index 000000000..e084c07e5
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java
@@ -0,0 +1,109 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author tlenz
+ *
+ */
+public class MOAIDConstants {
+
+ //general configuration constants
+
+ public static final String FILE_URI_PREFIX = "file:/";
+
+ public static final String PREFIX_WPBK = "urn:publicid:gv.at:wbpk+";
+ public static final String PREFIX_STORK = "urn:publicid:gv.at:storkid+";
+
+ public static final String IDENIFICATIONTYPE_FN = "FN";
+ public static final String IDENIFICATIONTYPE_ERSB = "ERSB";
+ public static final String IDENIFICATIONTYPE_ZVR = "ZVR";
+ public static final String IDENIFICATIONTYPE_STORK = "STORK";
+
+ public static final String KEYBOXIDENTIFIER_SECURE = "SecureSignatureKeypair";
+ public static final String KEYBOXIDENTIFIER_CERTIFIED = "CertifiedKeypair";
+
+ public static final String TESTCREDENTIALROOTOID = "1.2.40.0.10.2.4.1";
+
+ public static final String REDIRECTTARGET_TOP = "_top";
+ public static final String REDIRECTTARGET_SELF = "_self";
+ public static final String REDIRECTTARGET_PARENT = "_parent";
+ public static final String REDIRECTTARGET_BLANK = "_blank";
+
+ public static final Map<String, String> BUSINESSSERVICENAMES;
+ public static final List<String> ALLOWED_WBPK_PREFIXES;
+ public static final List<String> ALLOWED_KEYBOXIDENTIFIER;
+ public static final List<String> ALLOWED_REDIRECTTARGETNAMES;
+ public static final List<String> ALLOWED_STORKATTRIBUTEPROVIDERS;
+
+
+ static {
+ Hashtable<String, String> tmp = new Hashtable<String, String>();
+ tmp.put(IDENIFICATIONTYPE_FN, "Firmenbuchnummer");
+ tmp.put(IDENIFICATIONTYPE_ZVR, "Vereinsnummer");
+ tmp.put(IDENIFICATIONTYPE_ERSB, "ERsB Kennzahl");
+ tmp.put(IDENIFICATIONTYPE_STORK, "STORK");
+ BUSINESSSERVICENAMES = Collections.unmodifiableMap(tmp);
+
+ List<String> awbpk = new ArrayList<String>();
+ awbpk.add(IDENIFICATIONTYPE_FN);
+ awbpk.add(IDENIFICATIONTYPE_ERSB);
+ awbpk.add(IDENIFICATIONTYPE_ZVR);
+ awbpk.add(PREFIX_WPBK + IDENIFICATIONTYPE_FN);
+ awbpk.add(PREFIX_WPBK + IDENIFICATIONTYPE_ERSB);
+ awbpk.add(PREFIX_WPBK + IDENIFICATIONTYPE_ZVR);
+ ALLOWED_WBPK_PREFIXES = Collections.unmodifiableList(awbpk);
+
+ List<String> keyboxIDs = new ArrayList<String>();
+ awbpk.add(KEYBOXIDENTIFIER_SECURE);
+ awbpk.add(KEYBOXIDENTIFIER_CERTIFIED);
+ ALLOWED_KEYBOXIDENTIFIER = Collections.unmodifiableList(keyboxIDs);
+
+ List<String> redirectTargets = new ArrayList<String>();
+ redirectTargets.add(REDIRECTTARGET_BLANK);
+ redirectTargets.add(REDIRECTTARGET_PARENT);
+ redirectTargets.add(REDIRECTTARGET_SELF);
+ redirectTargets.add(REDIRECTTARGET_TOP);
+ ALLOWED_REDIRECTTARGETNAMES = Collections.unmodifiableList(redirectTargets);
+
+ }
+
+ static {
+ List<String> storkAttrProvider = new ArrayList<String>();
+ storkAttrProvider.add("StorkAttributeRequestProvider");
+ storkAttrProvider.add("EHvdAttributeProvider_deprecated");
+ storkAttrProvider.add("EHvdAttributeProvider");
+ storkAttrProvider.add("SignedDocAttributeRequestProvider");
+ storkAttrProvider.add("MandateAttributeRequestProvider");
+ storkAttrProvider.add("PVPAuthenticationProvider");
+ ALLOWED_STORKATTRIBUTEPROVIDERS = Collections.unmodifiableList(storkAttrProvider);
+
+ }
+
+}
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
new file mode 100644
index 000000000..4f47efb78
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java
@@ -0,0 +1,1722 @@
+/*
+moaidconfigmoaidconfigmoaidconfig * 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.config;
+
+import iaik.x509.X509Certificate;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.security.cert.CertificateException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import at.gv.egovernment.moa.id.commons.db.dao.config.AttributeProviderPlugin;
+import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral;
+import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA;
+import at.gv.egovernment.moa.id.commons.db.dao.config.BKUSelectionCustomizationType;
+import at.gv.egovernment.moa.id.commons.db.dao.config.BKUURLS;
+import at.gv.egovernment.moa.id.commons.db.dao.config.BPKDecryption;
+import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS;
+import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModeType;
+import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes;
+import at.gv.egovernment.moa.id.commons.db.dao.config.ConnectionParameterClientAuthType;
+import at.gv.egovernment.moa.id.commons.db.dao.config.Contact;
+import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs;
+import at.gv.egovernment.moa.id.commons.db.dao.config.EncBPKInformation;
+import at.gv.egovernment.moa.id.commons.db.dao.config.ForeignIdentities;
+import at.gv.egovernment.moa.id.commons.db.dao.config.GeneralConfiguration;
+import at.gv.egovernment.moa.id.commons.db.dao.config.IdentificationNumber;
+import at.gv.egovernment.moa.id.commons.db.dao.config.IdentityLinkSigners;
+import at.gv.egovernment.moa.id.commons.db.dao.config.InterfederationGatewayType;
+import at.gv.egovernment.moa.id.commons.db.dao.config.InterfederationIDPType;
+import at.gv.egovernment.moa.id.commons.db.dao.config.LegacyAllowed;
+import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration;
+import at.gv.egovernment.moa.id.commons.db.dao.config.MOAKeyBoxSelector;
+import at.gv.egovernment.moa.id.commons.db.dao.config.MOASP;
+import at.gv.egovernment.moa.id.commons.db.dao.config.Mandates;
+import at.gv.egovernment.moa.id.commons.db.dao.config.OAOAUTH20;
+import at.gv.egovernment.moa.id.commons.db.dao.config.OAPVP2;
+import at.gv.egovernment.moa.id.commons.db.dao.config.OASAML1;
+import at.gv.egovernment.moa.id.commons.db.dao.config.OASSO;
+import at.gv.egovernment.moa.id.commons.db.dao.config.OASTORK;
+import at.gv.egovernment.moa.id.commons.db.dao.config.OAStorkAttribute;
+import at.gv.egovernment.moa.id.commons.db.dao.config.OAuth;
+import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
+import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineMandates;
+import at.gv.egovernment.moa.id.commons.db.dao.config.Organization;
+import at.gv.egovernment.moa.id.commons.db.dao.config.PVP2;
+import at.gv.egovernment.moa.id.commons.db.dao.config.Protocols;
+import at.gv.egovernment.moa.id.commons.db.dao.config.SAML1;
+import at.gv.egovernment.moa.id.commons.db.dao.config.SLRequestTemplates;
+import at.gv.egovernment.moa.id.commons.db.dao.config.SSO;
+import at.gv.egovernment.moa.id.commons.db.dao.config.STORK;
+import at.gv.egovernment.moa.id.commons.db.dao.config.SecurityLayer;
+import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute;
+import at.gv.egovernment.moa.id.commons.db.dao.config.TemplateType;
+import at.gv.egovernment.moa.id.commons.db.dao.config.TemplatesType;
+import at.gv.egovernment.moa.id.commons.db.dao.config.TestCredentials;
+import at.gv.egovernment.moa.id.commons.db.dao.config.TimeOuts;
+import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType;
+import at.gv.egovernment.moa.id.commons.db.dao.config.VerifyAuthBlock;
+import at.gv.egovernment.moa.id.commons.db.dao.config.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;
+import at.gv.egovernment.moa.util.MiscUtil;
+
+/**
+ * @author tlenz
+ *
+ */
+public class ConfigurationMigrationUtils {
+
+ public static final String MOA_CONFIG_BUSINESSSERVICE = "businessService";
+ public static final String MOA_CONFIG_STORKSERVICE = "storkService";
+ public static final String MOA_CONFIG_PROTOCOL_SAML1 = "id_saml1";
+ public static final String MOA_CONFIG_PROTOCOL_PVP2 = "id_pvp2x";
+ public static final String MOA_CONFIG_PROTOCOL_STORK2 = "id_stork2";
+
+ public static final long DEFAULTTIMEOUTASSERTION = 120; //sec
+ public static final long DEFAULTTIMEOUTMOASESSIONCREATED = 1200; //sec
+ public static final long DEFAULTTIMEOUTMOASESSIONUPDATED = 2700; //sec
+
+ /**
+ * Convert a MOA-ID 2.x OnlineApplication JaxB DAO to a 3.x key/value configuration
+ * The keys in the result only contains the OA specific suffix keys
+ * but no MOA-ID configuration prefix
+ *
+ * @param oa MOA-ID 2.x OnlineApplication configuration
+ * @param storkConfig
+ * @return MOA-ID 3.x OnlineApplication configuration without prefix but never Null
+ */
+ public static Map<String, String> convertHyberJaxBOnlineApplicationToKeyValue(OnlineApplication oa, STORK storkConfig) {
+ Map<String, String> result = new HashMap<String, String>();
+ if (oa != null) {
+ //convert oaID and friendlyname
+ result.put(MOAIDConfigurationConstants.SERVICE_FRIENDLYNAME, oa.getFriendlyName());
+ result.put(MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER, oa.getPublicURLPrefix());
+
+ //convert isActive flag
+ if (oa.isIsActive() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_ISACTIVE, oa.isIsActive().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_ISACTIVE, Boolean.FALSE.toString());
+
+ //convert oa type
+ if (oa.getType().equals(MOA_CONFIG_BUSINESSSERVICE))
+ result.put(MOAIDConfigurationConstants.SERVICE_BUSINESSSERVICE, Boolean.TRUE.toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_BUSINESSSERVICE, Boolean.FALSE.toString());
+
+
+ //convert target
+ String target_full = oa.getTarget();
+ if (MiscUtil.isNotEmpty(target_full)) {
+ if (TargetValidator.isValidTarget(target_full)) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET, target_full);
+
+ } else {
+ String[] target_split = target_full.split("-");
+
+ if (TargetValidator.isValidTarget(target_split[0])) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET, target_split[0]);
+
+ if (target_split.length > 1) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB, target_split[1]);
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_USE_SUB, Boolean.TRUE.toString());
+
+ }
+
+ } else {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_OWN_TARGET, target_full);
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_USE_OWN, Boolean.TRUE.toString());
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_OWN_NAME, oa.getTargetFriendlyName());
+
+ }
+ }
+ }
+
+ AuthComponentOA oaauth = oa.getAuthComponentOA();
+ if (oaauth != null) {
+
+ //convert business identifier
+ IdentificationNumber idnumber = oaauth.getIdentificationNumber();
+ if (idnumber != null) {
+ String number = idnumber.getValue();
+ if (MiscUtil.isNotEmpty(number)) {
+ String[] split = number.split("\\+");
+
+ if (MOAIDConfigurationConstants.PREFIX_WPBK.startsWith(split[0]) && split.length >= 2) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE, split[1]);
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE, split[2]);
+
+ } else if (MOAIDConfigurationConstants.PREFIX_STORK.startsWith(split[0]) && split.length >= 2) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE, MOAIDConfigurationConstants.IDENIFICATIONTYPE_STORK);
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE, split[2]);
+ }
+ }
+ }
+
+ //concert BKU URLs
+ BKUURLS bkuurls = oaauth.getBKUURLS();
+ if (bkuurls != null) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_HANDY, bkuurls.getHandyBKU());
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_LOCAL, bkuurls.getLocalBKU());
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_ONLINE, bkuurls.getOnlineBKU());
+
+ }
+
+ //concert mandates
+ Mandates mandates = oaauth.getMandates();
+ if (mandates != null) {
+ String mandateProfiles = null;
+ List<String> profileList = mandates.getProfileName();
+ for (String el : profileList) {
+ if (mandateProfiles == null)
+ mandateProfiles = el;
+ else
+ mandateProfiles += "," + el;
+ }
+
+ //only for RC1
+ if (MiscUtil.isNotEmpty(mandates.getProfiles())) {
+ if (mandateProfiles == null)
+ mandateProfiles = mandates.getProfiles();
+
+ else
+ mandateProfiles += "," + mandates.getProfiles();
+
+ }
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_PROFILES, mandateProfiles);
+
+ if (mandateProfiles != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_USE, Boolean.TRUE.toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_USE, Boolean.FALSE.toString());
+ }
+
+ //convert KeyBoxSelector
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_KEYBOXIDENTIFIER,
+ oa.getKeyBoxIdentifier().value());
+
+ //convert securtiyLayer templates
+ TemplatesType templates = oaauth.getTemplates();
+ if (templates != null) {
+ List<TemplateType> templatetype = templates.getTemplate();
+ if (templatetype != null) {
+ if (templatetype.size() > 0) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_FIRST_VALUE, templatetype.get(0).getURL());
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_LEGACY, Boolean.TRUE.toString());
+
+ } else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_LEGACY, Boolean.FALSE.toString());
+
+ if (templatetype.size() > 1)
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_SECOND_VALUE, templatetype.get(1).getURL());
+
+ if (templatetype.size() > 2)
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_THIRD_VALUE, templatetype.get(2).getURL());
+
+ }
+ }
+
+ //convert test credentials
+ if (oaauth.getTestCredentials() != null) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_ENABLED, String.valueOf(oaauth.getTestCredentials().isEnableTestCredentials()));
+
+ if (oaauth.getTestCredentials().getCredentialOID() != null) {
+ String oids = null;
+ for (String el : oaauth.getTestCredentials().getCredentialOID()) {
+ if (oids == null)
+ oids = el;
+ else
+ oids += "," + oids;
+
+ }
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_OIDs, oids);
+ }
+ }
+
+ //convert foreign bPK
+ try {
+ EncBPKInformation bPKEncDec = oaauth.getEncBPKInformation();
+ if (bPKEncDec != null) {
+ BPKDecryption bPKDec = bPKEncDec.getBPKDecryption();
+ if (bPKDec != null) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB, Base64Utils.encode(bPKDec.getKeyInformation()));
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV, Base64Utils.encode(bPKDec.getIv()));
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_KEYALIAS, bPKDec.getKeyAlias());
+ if (bPKDec.getKeyStoreFileName() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_FILENAME, bPKDec.getKeyStoreFileName());
+
+ }
+ }
+ } catch (Exception e) {
+ Logger.warn("Foreign bPK decryption information can not converted.", e);
+ }
+
+ //convert SSO
+ OASSO ssoconfig = oaauth.getOASSO();
+ if(ssoconfig != null) {
+ if (ssoconfig.isUseSSO() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_SSO_ENABLED, ssoconfig.isUseSSO().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_SSO_ENABLED, Boolean.FALSE.toString());
+
+ if (ssoconfig.isAuthDataFrame() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_SSO_USERREQUEST, ssoconfig.isAuthDataFrame().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_SSO_USERREQUEST, Boolean.TRUE.toString());
+ }
+
+ //convert interfederation configuration
+ InterfederationIDPType moaIDP = oa.getInterfederationIDP();
+ if (moaIDP != null) {
+ result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_IIDP);
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_ATTRIBUTQUERY_URL,
+ moaIDP.getAttributeQueryURL());
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_SSO_INBOUND,
+ String.valueOf(moaIDP.isInboundSSO()));
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_SSO_OUTBOUND,
+ String.valueOf(moaIDP.isOutboundSSO()));
+
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_SSO_STORE,
+ String.valueOf(moaIDP.isStoreSSOSession()));
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_LOCALAUTHONERROR,
+ String.valueOf(moaIDP.isPerformLocalAuthenticationOnError()));
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_PASSIVEREQUEST,
+ String.valueOf(moaIDP.isPerformPassivRequest()));
+ }
+
+ //convert STORK <-> PVP2X gateway configuration
+ InterfederationGatewayType gateway = oa.getInterfederationGateway();
+ if (gateway != null) {
+ result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_GATEWAY);
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_FORWARD_IDPIDENTIFIER,
+ gateway.getForwardIDPIdentifier());
+
+ }
+
+ //convert STORK config
+ OASTORK config = oaauth.getOASTORK();
+ if(config != null) {
+ if (config.isStorkLogonEnabled() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ENABLED, config.isStorkLogonEnabled().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ENABLED, Boolean.FALSE.toString());
+
+ if (config.getQaa() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_MINQAALEVEL, config.getQaa().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_MINQAALEVEL, "4");
+
+
+ // fetch vidp config
+ if (config.isRequireConsent() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_REQUIRECONSENT,
+ config.isRequireConsent().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_REQUIRECONSENT,
+ Boolean.FALSE.toString());
+
+ List<AttributeProviderPlugin> attributeProviderPlugins = config.getAttributeProviders();
+ if (attributeProviderPlugins != null) {
+ for(int i=0; i<attributeProviderPlugins.size(); i++) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST
+ + "." + String.valueOf(i) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST_NAME,
+ attributeProviderPlugins.get(i).getName());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST
+ + "." + String.valueOf(i) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST_URL,
+ attributeProviderPlugins.get(i).getUrl());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST
+ + "." + String.valueOf(i) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST_ATTRIBUTES,
+ attributeProviderPlugins.get(i).getAttributes());
+
+ result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_VIDP);
+
+ }
+ }
+
+ //only fetch C-PEPS and attributes if service is an OA
+ if (!result.containsKey(MOAIDConfigurationConstants.PREFIX_SERVICES)) {
+ //fetch C-PEPS config
+ List<String> configuredCPEPs = new ArrayList<String>();
+ if (storkConfig != null && storkConfig.getCPEPS() != null) {
+ for (CPEPS el : storkConfig.getCPEPS()) {
+ if (MiscUtil.isNotEmpty(el.getCountryCode()))
+ configuredCPEPs.add(el.getCountryCode());
+
+ }
+ }
+ int listCounter = 0;
+ if (config.getCPEPS() != null) {
+ Iterator<CPEPS> oaCPEPSInterator = config.getCPEPS().iterator();
+ while(oaCPEPSInterator.hasNext()) {
+ CPEPS oaCpeps = oaCPEPSInterator.next();
+ String oaCountryCode = oaCpeps.getCountryCode();
+ if (MiscUtil.isNotEmpty(oaCountryCode)) {
+ if (configuredCPEPs.contains(oaCountryCode))
+ configuredCPEPs.remove(oaCountryCode);
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_ENABLED,
+ Boolean.TRUE.toString());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_COUNTRYCODE,
+ oaCountryCode);
+
+ listCounter++;
+ }
+ }
+ }
+ Iterator<String> confCPEPS = configuredCPEPs.iterator();
+ while (confCPEPS.hasNext()) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_ENABLED,
+ Boolean.TRUE.toString());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_COUNTRYCODE,
+ confCPEPS.next());
+ listCounter++;
+
+ }
+
+ //fetch STORK attributes
+ List<String> configuredAttributs = new ArrayList<String>();
+ if (storkConfig != null && storkConfig.getAttributes() != null) {
+ for (StorkAttribute el : storkConfig.getAttributes()) {
+ if (MiscUtil.isNotEmpty(el.getName()))
+ configuredAttributs.add(el.getName());
+
+ }
+ }
+ listCounter = 0;
+ if (config.getOAAttributes() != null) {
+ Iterator<OAStorkAttribute> oaAttributeInterator = config.getOAAttributes().iterator();
+ while (oaAttributeInterator.hasNext()) {
+ OAStorkAttribute oaAttr = oaAttributeInterator.next();
+ if (MiscUtil.isNotEmpty(oaAttr.getName())) {
+ if (configuredAttributs.contains(oaAttr.getName()))
+ configuredAttributs.remove(oaAttr.getName());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_NAME,
+ oaAttr.getName());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_REQUESTED,
+ Boolean.TRUE.toString());
+
+
+ if (oaAttr.isMandatory() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY,
+ oaAttr.isMandatory().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY,
+ Boolean.FALSE.toString());
+ listCounter++;
+ }
+ }
+ }
+ Iterator<String> configuredAttributsInterator = configuredAttributs.iterator();
+ while (configuredAttributsInterator.hasNext()) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_NAME,
+ configuredAttributsInterator.next());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_REQUESTED,
+ Boolean.TRUE.toString());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY,
+ Boolean.FALSE.toString());
+ listCounter++;
+
+ }
+ }
+ }
+
+ //convert protocols SAML1
+ OASAML1 saml1 = oaauth.getOASAML1();
+ if (saml1 != null) {
+ if (saml1.isProvideAUTHBlock() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_AUTHBLOCK,
+ saml1.isProvideAUTHBlock().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_AUTHBLOCK,
+ Boolean.FALSE.toString());
+
+ if (saml1.isProvideCertificate() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_CERTIFICATE,
+ saml1.isProvideCertificate().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_CERTIFICATE,
+ Boolean.FALSE.toString());
+
+ if (saml1.isProvideFullMandatorData() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_MANDATE,
+ saml1.isProvideFullMandatorData().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_MANDATE,
+ Boolean.FALSE.toString());
+
+ if (saml1.isProvideIdentityLink() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_IDL,
+ saml1.isProvideIdentityLink().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_IDL,
+ Boolean.FALSE.toString());
+
+ if (saml1.isProvideStammzahl() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_BASEID,
+ saml1.isProvideStammzahl().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_BASEID,
+ Boolean.FALSE.toString());
+
+ if (saml1.isProvideAllErrors() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_RETURNERROR,
+ saml1.isProvideAllErrors().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_RETURNERROR,
+ Boolean.TRUE.toString());
+
+ if (saml1.isIsActive() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_ENABLED,
+ saml1.isIsActive().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_ENABLED,
+ Boolean.FALSE.toString());
+ }
+
+ //convert protocols PVP2X
+ OAPVP2 pvp2 = oaauth.getOAPVP2();
+ if (pvp2 != null) {
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_URL,
+ pvp2.getMetadataURL());
+
+ try {
+ byte[] cert = pvp2.getCertificate();
+
+ if (MiscUtil.isNotEmpty(cert)) {
+ X509Certificate x509 = new X509Certificate(cert);
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE,
+ Base64Utils.encode(cert));
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE_SUBJECT,
+ x509.getSubjectDN().getName());
+ }
+ } catch (CertificateException | IOException e) {
+ Logger.warn("PVP2 certificate can not be loaded from Online-Applikation");
+ }
+ }
+
+ //convert protocol OpenID Connect
+ OAOAUTH20 openID = oaauth.getOAOAUTH20();
+ if (openID != null) {
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_OPENID_CLIENTSECRET,
+ openID.getOAuthClientSecret());
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_OPENID_CLIENTID,
+ openID.getOAuthClientId());
+ result.put(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_OPENID_REDIRECTURL,
+ openID.getOAuthRedirectUri());
+ }
+
+
+ //convert BKU selection form customization
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_AUTHBLOCK_REMOVEBPK,
+ String.valueOf(oa.isRemoveBPKFromAuthBlock()));
+
+ if (templates != null) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_AUTHBLOCKTEXT,
+ templates.getAditionalAuthBlockText());
+
+ TransformsInfoType bkuSelectTemplate = templates.getBKUSelectionTemplate();
+ if (bkuSelectTemplate != null && MiscUtil.isNotEmpty(bkuSelectTemplate.getFilename())) {
+ try {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA,
+ Base64Utils.encode(bkuSelectTemplate.getTransformation()));
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW,
+ bkuSelectTemplate.getFilename());
+
+ } catch (Exception e) {
+ Logger.warn("BKU selection templated can not converted.", e);
+
+ }
+
+
+ }
+
+ TransformsInfoType sendAssertionTemplate = templates.getSendAssertionTemplate();
+ if (sendAssertionTemplate != null && MiscUtil.isNotEmpty(sendAssertionTemplate.getFilename())) {
+ try {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA,
+ Base64Utils.encode(sendAssertionTemplate.getTransformation()));
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW,
+ sendAssertionTemplate.getFilename());
+
+ } catch (Exception e) {
+ Logger.warn("Send assertion templated can not converted.", e);
+
+ }
+ }
+
+ BKUSelectionCustomizationType formcustom = templates.getBKUSelectionCustomization();
+ if (formcustom != null) {
+
+ if (formcustom.isOnlyMandateLoginAllowed() != null) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_ONLY,
+ formcustom.isOnlyMandateLoginAllowed().toString());
+ } else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_ONLY,
+ Boolean.FALSE.toString());
+
+ if (formcustom.getAppletHeight() != null) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_APPLETHEIGHT,
+ formcustom.getAppletHeight());
+ }
+
+ if (formcustom.getAppletWidth() != null) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_APPLETWIDTH,
+ formcustom.getAppletWidth());
+ }
+
+ if (MiscUtil.isNotEmpty(formcustom.getAppletRedirectTarget()))
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_APPLETREDIRECTTARGET,
+ formcustom.getAppletRedirectTarget());
+
+ if (MiscUtil.isNotEmpty(formcustom.getBackGroundColor())) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BACKGROUNDCOLOR,
+ formcustom.getBackGroundColor());
+ }
+
+ if (MiscUtil.isNotEmpty(formcustom.getButtonBackGroundColor())) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BUTTONBACKGROUNDCOLOR,
+ formcustom.getButtonBackGroundColor());
+ }
+
+ if (MiscUtil.isNotEmpty(formcustom.getButtonBackGroundColorFocus())) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BUTTONBACLGROUNDCOLORFOCUS,
+ formcustom.getButtonBackGroundColorFocus());
+ }
+
+ if (MiscUtil.isNotEmpty(formcustom.getButtonFontColor())) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BUTTONFRONTCOLOR,
+ formcustom.getButtonFontColor());
+ }
+
+ if (MiscUtil.isNotEmpty(formcustom.getFontType())) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_FONTTYPE,
+ formcustom.getFontType());
+ }
+
+ if (MiscUtil.isNotEmpty(formcustom.getFrontColor())) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_FRONTCOLOR,
+ formcustom.getFrontColor());
+ }
+
+ if (MiscUtil.isNotEmpty(formcustom.getHeaderBackGroundColor())) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_HEADERBACKGROUNDCOLOR,
+ formcustom.getHeaderBackGroundColor());
+ }
+
+ if (MiscUtil.isNotEmpty(formcustom.getHeaderFrontColor())) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_HEADERFRONTCOLOR,
+ formcustom.getHeaderFrontColor());
+ }
+
+ if (MiscUtil.isNotEmpty(formcustom.getHeaderText())) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_HEADERTEXT,
+ formcustom.getHeaderText());
+ }
+ }
+ }
+ }
+
+ //set onlineapplication identifier if nothing is set
+ if (!result.containsKey(MOAIDConfigurationConstants.PREFIX_SERVICES)) {
+ result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_OA);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Convert a MOA-ID 3.x key/value OnlineApplication to a 2.x JaxB DAO
+ *
+ * @param oa MOA-ID 3.x key/value OnlineApplication configuration. The MOA-ID specific prefix must be removed
+ * @return MOA-ID 2.x {OnlineApplication} or Null if oa contains no OnlineApplication keys
+ */
+ public static OnlineApplication convertKeyValueToHyberJaxBOnlineApplication(Map<String, String> oa) {
+ OnlineApplication dbOA = new OnlineApplication();
+
+ AuthComponentOA authoa = dbOA.getAuthComponentOA();
+ if (authoa == null) {
+ authoa = new AuthComponentOA();
+ dbOA.setAuthComponentOA(authoa);
+ }
+
+ dbOA.setIsActive(Boolean.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_ISACTIVE)));
+ dbOA.setPublicURLPrefix(oa.get(MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER));
+ dbOA.setFriendlyName(oa.get(MOAIDConfigurationConstants.SERVICE_FRIENDLYNAME));
+
+ if (Boolean.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_BUSINESSSERVICE))) {
+ dbOA.setType(MOA_CONFIG_BUSINESSSERVICE);
+
+ IdentificationNumber idnumber = authoa.getIdentificationNumber();
+ if (idnumber == null)
+ idnumber = new IdentificationNumber();
+
+ if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE).equals(MOAIDConfigurationConstants.IDENIFICATIONTYPE_STORK)) {
+ idnumber.setValue(MOAIDConfigurationConstants.PREFIX_STORK + "AT" + "+" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE));
+ idnumber.setType(MOAIDConfigurationConstants.BUSINESSSERVICENAMES.get(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE)));
+ } else {
+ idnumber.setValue(MOAIDConfigurationConstants.PREFIX_WPBK + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE) + "+" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE));
+ idnumber.setType(MOAIDConfigurationConstants.BUSINESSSERVICENAMES.get(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE)));
+ }
+
+ authoa.setIdentificationNumber(idnumber);
+
+ } else {
+ dbOA.setType(null);
+
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_OWN_TARGET))
+ && Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_USE_OWN))) {
+ dbOA.setTarget(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_OWN_TARGET));
+ dbOA.setTargetFriendlyName(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_OWN_NAME));
+
+ } else {
+
+ String target = oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET);
+
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB))
+ && Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_USE_SUB)))
+ dbOA.setTarget(target + "-" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB));
+ else
+ dbOA.setTarget(target);
+
+ String targetname = TargetValidator.getTargetFriendlyName(target);
+ if (MiscUtil.isNotEmpty(targetname))
+ dbOA.setTargetFriendlyName(targetname);
+ }
+ }
+
+ //store BKU-URLs
+ BKUURLS bkuruls = new BKUURLS();
+ authoa.setBKUURLS(bkuruls);
+ bkuruls.setHandyBKU(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_HANDY));
+ bkuruls.setLocalBKU(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_LOCAL));
+ bkuruls.setOnlineBKU(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_ONLINE));
+
+ //store SecurtiyLayerTemplates
+ TemplatesType templates = authoa.getTemplates();
+ if (templates == null) {
+ templates = new TemplatesType();
+ authoa.setTemplates(templates);
+ }
+ List<TemplateType> template = templates.getTemplate();
+ if (Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_LEGACY))) {
+
+ if (template == null)
+ template = new ArrayList<TemplateType>();
+ else
+ template.clear();
+
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_FIRST_VALUE))) {
+ TemplateType el = new TemplateType();
+ el.setURL(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_FIRST_VALUE));
+ template.add(el);
+ } else
+ template.add(new TemplateType());
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_SECOND_VALUE))) {
+ TemplateType el = new TemplateType();
+ el.setURL(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_SECOND_VALUE));
+ template.add(el);
+ } else
+ template.add(new TemplateType());
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_THIRD_VALUE))) {
+ TemplateType el = new TemplateType();
+ el.setURL(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_THIRD_VALUE));
+ template.add(el);
+ } else
+ template.add(new TemplateType());
+
+ } else {
+ if (template != null && template.size() > 0) template.clear();
+ }
+
+
+ //store keyBox Identifier
+ dbOA.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_KEYBOXIDENTIFIER)));
+
+ Mandates mandates = new Mandates();
+ if (Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_USE))) {
+
+ if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_PROFILES) != null) {
+ String[] profileList = oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_PROFILES).split(",");
+
+ List<String> dbProfiles = mandates.getProfileName();
+ if (dbProfiles == null) {
+ dbProfiles = new ArrayList<String>();
+ mandates.setProfileName(dbProfiles);
+
+ }
+
+ for (String el: profileList)
+ dbProfiles.add(el.trim());
+
+ mandates.setProfiles(null);
+ }
+
+ } else {
+ mandates.setProfiles(null);
+ mandates.getProfileName().clear();
+ }
+ authoa.setMandates(mandates);
+
+ if (Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_ENABLED))) {
+ TestCredentials testing = authoa.getTestCredentials();
+ testing = new TestCredentials();
+ authoa.setTestCredentials(testing);
+ testing.setEnableTestCredentials(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_ENABLED)));
+
+ if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_OIDs) != null) {
+ String[] profileList = oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_OIDs).split(",");
+ List<String> testCredentialOIDs = Arrays.asList(profileList);
+ testing.setCredentialOID(testCredentialOIDs);
+ }
+
+ } else {
+ TestCredentials testing = authoa.getTestCredentials();
+ if (testing != null) {
+ testing.setEnableTestCredentials(false);
+ }
+
+ }
+
+
+ EncBPKInformation bPKEncDec = authoa.getEncBPKInformation();
+ if (bPKEncDec == null) {
+ bPKEncDec = new EncBPKInformation();
+ authoa.setEncBPKInformation(bPKEncDec);
+
+ }
+
+ BPKDecryption bPKDec = bPKEncDec.getBPKDecryption();
+ if (bPKDec == null) {
+ bPKDec = new BPKDecryption();
+ bPKEncDec.setBPKDecryption(bPKDec);
+ }
+
+ bPKDec.setKeyStoreFileName(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_FILENAME));
+ bPKDec.setKeyAlias(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_KEYALIAS));
+
+ try {
+ bPKDec.setIv(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV), false));
+ bPKDec.setKeyInformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB), false));
+
+ } catch (IOException e) {
+ Logger.error("Configuration encryption FAILED.", e);
+
+ }
+
+ OASSO sso = authoa.getOASSO();
+ if (sso == null) {
+ sso = new OASSO();
+ authoa.setOASSO(sso);
+ sso.setAuthDataFrame(true);
+ }
+ sso.setUseSSO(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_SSO_ENABLED)));
+ sso.setAuthDataFrame(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_SSO_USERREQUEST)));
+
+ OASTORK stork = authoa.getOASTORK();
+ if (stork == null) {
+ // if there is none, create a new one with default values.
+ stork = new OASTORK();
+ authoa.setOASTORK(stork);
+ stork.setStorkLogonEnabled(false);
+ }
+ // transfer the incoming data to the database model
+ stork.setStorkLogonEnabled(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ENABLED)));
+ stork.setQaa(Integer.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_MINQAALEVEL)));
+
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES))
+ && oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_VIDP))
+ stork.setVidpEnabled(true);
+
+ stork.setRequireConsent(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_REQUIRECONSENT)));
+
+ Map<String, AttributeProviderPlugin> pluginMap = new HashMap<String, AttributeProviderPlugin>();
+ Map<String, OAStorkAttribute> attrMap = new HashMap<String, OAStorkAttribute>();
+ Map<String, CPEPS> cpepsMap = new HashMap<String, CPEPS>();
+
+ for (String el : oa.keySet()) {
+ if (el.startsWith(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST)) {
+ String index = KeyValueUtils.getFirstChildAfterPrefix(el, MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST);
+ OAStorkAttribute attr = new OAStorkAttribute();
+ attr.setName(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST_NAME));
+
+ attr.setMandatory(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY)));
+
+ if (Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_REQUESTED)))
+ attrMap.put(index, attr);
+
+
+ } else if (el.startsWith(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST)) {
+ String index = KeyValueUtils.getFirstChildAfterPrefix(el, MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST);
+ AttributeProviderPlugin attr = new AttributeProviderPlugin();
+ attr.setName(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST_NAME));
+ attr.setUrl(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST_URL));
+ attr.setAttributes(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST_ATTRIBUTES));
+ pluginMap.put(index, attr);
+
+
+ } else if (el.startsWith(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST)) {
+ String index = KeyValueUtils.getFirstChildAfterPrefix(el, MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST);
+ CPEPS attr = new CPEPS();
+ attr.setCountryCode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_COUNTRYCODE));
+
+ if (Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_ENABLED)))
+ cpepsMap.put(index, attr);
+
+ }
+ }
+
+ stork.setAttributeProviders(new ArrayList<AttributeProviderPlugin>(pluginMap.values()));
+ stork.setOAAttributes(new ArrayList<OAStorkAttribute>(attrMap.values()));
+ stork.setCPEPS(new ArrayList<CPEPS>(cpepsMap.values()));
+
+ OASAML1 saml1 = authoa.getOASAML1();
+ if (saml1 == null) {
+ saml1 = new OASAML1();
+ authoa.setOASAML1(saml1);
+ saml1.setIsActive(false);
+ }
+ saml1.setIsActive(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_ENABLED)));
+ saml1.setProvideAUTHBlock(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_AUTHBLOCK)));
+ saml1.setProvideCertificate(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_CERTIFICATE)));
+ saml1.setProvideFullMandatorData(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_MANDATE)));
+ saml1.setProvideIdentityLink(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_IDL)));
+ saml1.setProvideStammzahl(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_BASEID)));
+ saml1.setUseCondition(false);
+ saml1.setProvideAllErrors(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_SAML1_RETURNERROR)));
+ saml1.setConditionLength(BigInteger.valueOf(-1));
+
+ OAPVP2 pvp2 = authoa.getOAPVP2();
+ if (pvp2 == null) {
+ pvp2 = new OAPVP2();
+ authoa.setOAPVP2(pvp2);
+ }
+
+ try {
+ pvp2.setCertificate(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE), false));
+
+ } catch (IOException e) {
+ Logger.warn("Uploaded Certificate can not be parsed", e);
+
+ }
+
+ pvp2.setMetadataURL(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_URL));
+
+ OAOAUTH20 oaOAuth20 = authoa.getOAOAUTH20();
+ if (oaOAuth20 == null) {
+ oaOAuth20 = new OAOAUTH20();
+ authoa.setOAOAUTH20(oaOAuth20);
+ }
+ oaOAuth20.setOAuthClientId(dbOA.getPublicURLPrefix());
+ oaOAuth20.setOAuthRedirectUri(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_OPENID_REDIRECTURL));
+ oaOAuth20.setOAuthClientSecret(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_OPENID_CLIENTSECRET));
+
+
+
+ dbOA.setRemoveBPKFromAuthBlock(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_AUTHBLOCK_REMOVEBPK)));
+ templates.setAditionalAuthBlockText(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_AUTHBLOCKTEXT));
+
+ //store BKU-selection and send-assertion templates
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA))) {
+ TransformsInfoType el1 = new TransformsInfoType();
+ try {
+ el1.setTransformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA), false));
+ el1.setFilename(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW));
+ templates.setBKUSelectionTemplate(el1);
+
+ } catch (IOException e) {
+ Logger.warn("Converting BKU selection template FAILED.", e);
+ }
+ }
+
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA))) {
+ TransformsInfoType el1 = new TransformsInfoType();
+ try {
+ el1.setTransformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA), false));
+ el1.setFilename(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW));
+ templates.setSendAssertionTemplate(el1);
+
+ } catch (IOException e) {
+ Logger.warn("Converting Send Assertion template FAILED.", e);
+ }
+ }
+
+ BKUSelectionCustomizationType bkuselectioncustom = templates.getBKUSelectionCustomization();
+ if (bkuselectioncustom == null) {
+ bkuselectioncustom = new BKUSelectionCustomizationType();
+ templates.setBKUSelectionCustomization(bkuselectioncustom);
+ }
+
+
+ bkuselectioncustom.setMandateLoginButton(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_USE)));
+ bkuselectioncustom.setOnlyMandateLoginAllowed(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_ONLY)));
+
+ bkuselectioncustom.setBackGroundColor(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BACKGROUNDCOLOR));
+ bkuselectioncustom.setFrontColor(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_FRONTCOLOR));
+
+ bkuselectioncustom.setHeaderBackGroundColor(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_HEADERBACKGROUNDCOLOR));
+ bkuselectioncustom.setHeaderFrontColor(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_HEADERFRONTCOLOR));
+ bkuselectioncustom.setHeaderText(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_HEADERTEXT));
+
+ bkuselectioncustom.setButtonBackGroundColor(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BUTTONBACKGROUNDCOLOR));
+ bkuselectioncustom.setButtonBackGroundColorFocus(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BUTTONBACLGROUNDCOLORFOCUS));
+ bkuselectioncustom.setButtonFontColor(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BUTTONFRONTCOLOR));
+
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_APPLETREDIRECTTARGET)))
+ bkuselectioncustom.setAppletRedirectTarget(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_APPLETREDIRECTTARGET));
+
+ bkuselectioncustom.setFontType(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_FONTTYPE));
+
+ bkuselectioncustom.setAppletHeight(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_APPLETHEIGHT));
+ bkuselectioncustom.setAppletWidth(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_APPLETWIDTH));
+
+
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES))
+ && oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_IIDP))
+ dbOA.setIsInterfederationIDP(true);
+
+ InterfederationIDPType moaIDP = dbOA.getInterfederationIDP();
+ if (moaIDP == null) {
+ moaIDP = new InterfederationIDPType();
+ dbOA.setInterfederationIDP(moaIDP);
+ }
+
+ moaIDP.setAttributeQueryURL(oa.get(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_ATTRIBUTQUERY_URL));
+ moaIDP.setInboundSSO(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_SSO_INBOUND)));
+ moaIDP.setOutboundSSO(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_SSO_OUTBOUND)));
+ moaIDP.setStoreSSOSession(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_SSO_STORE)));
+ moaIDP.setPerformLocalAuthenticationOnError(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_LOCALAUTHONERROR)));
+ moaIDP.setPerformPassivRequest(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_PASSIVEREQUEST)));
+
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES))
+ && oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_GATEWAY))
+ dbOA.setIsInterfederationGateway(true);
+ InterfederationGatewayType gateway = dbOA.getInterfederationGateway();
+ if (gateway == null) {
+ gateway = new InterfederationGatewayType();
+ dbOA.setInterfederationGateway(gateway);
+ }
+ gateway.setForwardIDPIdentifier(oa.get(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_FORWARD_IDPIDENTIFIER));
+
+
+ return dbOA;
+ }
+
+
+ /**
+ * Convert a MOA-ID 2.x MOAIDConfiguration JaxB DAO to a 3.x key/value configuration
+ *
+ * @param config MOA-ID 2.x configuration
+ * @return MOA-ID 3.x key/value configuration but never null
+ */
+ public static Map<String, String> convertHyberJaxBMOAIDConfigToKeyValue(MOAIDConfiguration config) {
+ Map<String, String> result = new HashMap<String, String>();
+ if (config != null) {
+ AuthComponentGeneral auth = config.getAuthComponentGeneral();
+
+ if (auth != null) {
+ ForeignIdentities foreign = auth.getForeignIdentities();
+
+ if (foreign != null) {
+ ConnectionParameterClientAuthType connect_foreign = foreign.getConnectionParameter();
+ if (connect_foreign != null) {
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL,
+ connect_foreign.getURL());
+ }
+ }
+
+ GeneralConfiguration authgen = auth.getGeneralConfiguration();
+ if (authgen != null) {
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_CERTSTORE_URL,
+ authgen.getCertStoreDirectory());
+
+ if (authgen.isTrustManagerRevocationChecking() != null)
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_REVOCATIONCHECKING,
+ authgen.isTrustManagerRevocationChecking().toString());
+ else
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_REVOCATIONCHECKING,
+ Boolean.TRUE.toString());
+
+ result.put(MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX,
+ authgen.getPublicURLPreFix());
+
+ TimeOuts timeouts = authgen.getTimeOuts();
+ if (timeouts != null) {
+
+ if(timeouts.getAssertion() != null)
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_TIMEOUTS_TRANSACTION,
+ String.valueOf(timeouts.getAssertion().longValue()));
+ if(timeouts.getMOASessionCreated() != null)
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_TIMEOUS_SSO_CREATE,
+ String.valueOf(timeouts.getMOASessionCreated().longValue()));
+ if(timeouts.getMOASessionUpdated() != null)
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_TIMEOUS_SSO_UPDATE,
+ String.valueOf(timeouts.getMOASessionUpdated().longValue()));
+
+ }
+ }
+
+ MOASP moaspss = auth.getMOASP();
+ if (moaspss != null) {
+ ConnectionParameterClientAuthType con = moaspss.getConnectionParameter();
+ if (con != null)
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_URL,
+ con.getURL());
+
+ VerifyAuthBlock authblock = moaspss.getVerifyAuthBlock();
+ if (authblock != null) {
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_AUTHBLOCK_PROD,
+ authblock.getTrustProfileID());
+
+ List<String> list = authblock.getVerifyTransformsInfoProfileID();
+ if (list.size() == 1)
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_AUTHBLOCK_TRANSFORM,
+ list.get(0));
+
+ else {
+ Logger.warn("More the one AuthBlocktransformation are not supported any more.");
+ }
+ }
+
+ VerifyIdentityLink idl = moaspss.getVerifyIdentityLink();
+ if (idl != null) {
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_IDL_PROD,
+ idl.getTrustProfileID());
+ }
+ }
+
+ OnlineMandates mandates = auth.getOnlineMandates();
+ if (mandates != null) {
+ ConnectionParameterClientAuthType con = mandates.getConnectionParameter();
+ if (con != null) {
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL,
+ con.getURL());
+ }
+ }
+
+ Protocols protocols = auth.getProtocols();
+ if (protocols != null) {
+ LegacyAllowed legacy = protocols.getLegacyAllowed();
+
+ if (legacy != null) {
+ List<String> list = legacy.getProtocolName();
+ if (list.contains(MOA_CONFIG_PROTOCOL_SAML1))
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_SAML1_LEGACY,
+ Boolean.TRUE.toString());
+
+ if (list.contains(MOA_CONFIG_PROTOCOL_PVP2))
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_LEGACY,
+ Boolean.TRUE.toString());
+ }
+
+ SAML1 saml1 = protocols.getSAML1();
+ if (saml1 != null) {
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_SAML1_ENABLED,
+ String.valueOf(saml1.isIsActive()));
+
+ if (MiscUtil.isEmpty(saml1.getSourceID()) && MiscUtil.isNotEmpty(authgen.getAlternativeSourceID()))
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_SAML1_SOURCEID,
+ authgen.getAlternativeSourceID());
+ else
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_SAML1_SOURCEID,
+ saml1.getSourceID());
+
+ }
+
+ OAuth oauth = protocols.getOAuth();
+ if (oauth != null) {
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_OPENID_ENABLED,
+ String.valueOf(oauth.isIsActive()));
+
+ }
+
+ PVP2 pvp2 = protocols.getPVP2();
+ if (pvp2 != null) {
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_ENABLED,
+ String.valueOf(pvp2.isIsActive()));
+
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_SERVICENAMME,
+ pvp2.getIssuerName());
+
+ List<Contact> con = pvp2.getContact();
+
+ if (con != null && con.size() > 0) {
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_COMPANY,
+ con.get(0).getCompany());
+
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_FAMLIYNAME,
+ con.get(0).getSurName());
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_GIVENNAME,
+ con.get(0).getGivenName());
+ if (!con.get(0).getMail().isEmpty())
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_MAIL,
+ con.get(0).getMail().get(0));
+ if (!con.get(0).getPhone().isEmpty())
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_PHONE,
+ con.get(0).getPhone().get(0));
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_TYPE,
+ con.get(0).getType());
+ }
+
+ Organization org = pvp2.getOrganization();
+ if (org != null) {
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_FULLNAME,
+ org.getDisplayName());
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_SHORTNAME,
+ org.getName());
+ result.put(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_URL,
+ org.getURL());
+ }
+ }
+ }
+
+ SecurityLayer seclayer = auth.getSecurityLayer();
+ if (seclayer != null) {
+ List<TransformsInfoType> list = seclayer.getTransformsInfo();
+ if (!list.isEmpty()) {
+// try {
+ //TODO: check if Transformation is always BASE64 encoded
+// result.put(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64,
+// Base64Utils.encode(list.get(0).getTransformation()));
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64,
+ new String(list.get(0).getTransformation()));
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_NAME,
+ list.get(0).getFilename());
+
+// } catch (IOException e) {
+// Logger.warn("AuthBlockTransformation can not converted.", e);
+//
+// }
+
+ } else {
+ Logger.warn("AuthBlockTransformation can not converted.");
+
+ }
+ }
+
+ SSO sso = auth.getSSO();
+ if (sso != null) {
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_SERVICENAME,
+ sso.getFriendlyName());
+
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_AUTHBLOCK_TEXT,
+ sso.getSpecialText());
+
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_TARGET,
+ sso.getTarget());
+ }
+ }
+
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_TRUSTSTORE_URL,
+ config.getTrustedCACertificates());
+
+
+ DefaultBKUs defaultbkus = config.getDefaultBKUs();
+ if (defaultbkus != null) {
+ result.put(MOAIDConfigurationConstants.GENERAL_DEFAULTS_BKU_HANDY,
+ defaultbkus.getHandyBKU());
+ result.put(MOAIDConfigurationConstants.GENERAL_DEFAULTS_BKU_LOCAL,
+ defaultbkus.getLocalBKU());
+ result.put(MOAIDConfigurationConstants.GENERAL_DEFAULTS_BKU_ONLINE,
+ defaultbkus.getOnlineBKU());
+ }
+
+ SLRequestTemplates slreq = config.getSLRequestTemplates();
+ if (slreq != null) {
+ result.put(MOAIDConfigurationConstants.GENERAL_DEFAULTS_TEMPLATES_HANDY,
+ slreq.getHandyBKU());
+ result.put(MOAIDConfigurationConstants.GENERAL_DEFAULTS_TEMPLATES_LOCAL,
+ slreq.getLocalBKU());
+ result.put(MOAIDConfigurationConstants.GENERAL_DEFAULTS_TEMPLATES_ONLINE,
+ slreq.getOnlineBKU());
+
+ }
+
+ ForeignIdentities foreign = auth.getForeignIdentities();
+
+ if (foreign != null) {
+ STORK stork = foreign.getSTORK();
+
+ if (stork != null) {
+ // deep clone all the things
+ // to foreclose lazyloading session timeouts
+ if (stork.getCPEPS() != null) {
+ for (int i=0; i<stork.getCPEPS().size(); i++) {
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST
+ + "." + String.valueOf(i) + "."
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY,
+ stork.getCPEPS().get(i).getCountryCode());
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST
+ + "." + String.valueOf(i) + "."
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL,
+ stork.getCPEPS().get(i).getURL());
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST
+ + "." + String.valueOf(i) + "."
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG,
+ String.valueOf(stork.getCPEPS().get(i).isSupportsXMLSignature()));
+
+ }
+ }
+
+ List<StorkAttribute> tmp = stork.getAttributes();
+ if(null != tmp) {
+ for (int i=0; i<tmp.size(); i++) {
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(i) + "."
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME,
+ tmp.get(i).getName());
+
+ if (tmp.get(i).isMandatory() != null)
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(i) + "."
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY,
+ tmp.get(i).isMandatory().toString());
+ else
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(i) + "."
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY,
+ Boolean.FALSE.toString());
+
+ }
+ }
+
+ try {
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_QAA,
+ String.valueOf(stork.getQualityAuthenticationAssuranceLevel()));
+
+ } catch(NullPointerException e) {
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_QAA,
+ String.valueOf(4));
+ }
+ }
+
+ }
+
+ }
+
+ return result;
+ }
+
+ /**
+ * Convert a MOA-ID 3.x key/value general configuration to a 2.x JaxB DAO
+ *
+ * @param moaconfig MOA-ID 3.x key/value general configuration
+ * @return MOA-ID 2.x {MOAIDConfiguration} or Null if moaconfig contains no MOA-ID configuration keys
+ */
+ public static MOAIDConfiguration convertKeyValueToHyberJaxBMOAIDConfiguration(Map<String, String> moaconfig) {
+
+ MOAIDConfiguration dbconfig = new MOAIDConfiguration();
+
+
+ AuthComponentGeneral dbauth = dbconfig.getAuthComponentGeneral();
+ if (dbauth == null) {
+ dbauth = new AuthComponentGeneral();
+ dbconfig.setAuthComponentGeneral(dbauth);
+ }
+
+ GeneralConfiguration dbauthgeneral = dbauth.getGeneralConfiguration();
+ if (dbauthgeneral == null) {
+ dbauthgeneral = new GeneralConfiguration();
+ dbauth.setGeneralConfiguration(dbauthgeneral);
+ }
+
+ dbauthgeneral.setPublicURLPreFix(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX));
+
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_CERTSTORE_URL)))
+ dbauthgeneral.setCertStoreDirectory(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_CERTSTORE_URL));
+
+ dbauthgeneral.setTrustManagerRevocationChecking(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_REVOCATIONCHECKING)));
+
+ TimeOuts dbtimeouts = dbauthgeneral.getTimeOuts();
+ if (dbtimeouts == null) {
+ dbtimeouts = new TimeOuts();
+ dbauthgeneral.setTimeOuts(dbtimeouts);
+ }
+
+ dbtimeouts.setAssertion(new BigInteger(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_TIMEOUTS_TRANSACTION)));
+ dbtimeouts.setMOASessionCreated(new BigInteger(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_TIMEOUS_SSO_CREATE)));
+ dbtimeouts.setMOASessionUpdated(new BigInteger(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_TIMEOUS_SSO_UPDATE)));
+
+ Protocols dbprotocols = dbauth.getProtocols();
+ if (dbprotocols == null) {
+ dbprotocols = new Protocols();
+ dbauth.setProtocols(dbprotocols);
+ }
+ LegacyAllowed legprot = dbprotocols.getLegacyAllowed();
+ if (legprot == null) {
+ legprot = new LegacyAllowed();
+ dbprotocols.setLegacyAllowed(legprot);
+ }
+
+ List<String> el = legprot.getProtocolName();
+ if (el == null) {
+ el = new ArrayList<String>();
+ legprot.setProtocolName(el);
+
+ }
+
+ //Workaround for DB cleaning is only needed for one or the releases (insert in 2.1.1)
+ if (el.size() > 2)
+ el.clear();
+
+ if (el.contains(MOA_CONFIG_PROTOCOL_PVP2)) {
+ if (!Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_LEGACY)))
+ el.remove(MOA_CONFIG_PROTOCOL_PVP2);
+
+ } else {
+ if (Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_LEGACY)))
+ el.add(MOA_CONFIG_PROTOCOL_PVP2);
+ }
+
+ if (el.contains(MOA_CONFIG_PROTOCOL_SAML1)) {
+ if (!Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_SAML1_LEGACY)))
+ el.remove(MOA_CONFIG_PROTOCOL_SAML1);
+
+ } else {
+ if (Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_SAML1_LEGACY)))
+ el.add(MOA_CONFIG_PROTOCOL_SAML1);
+ }
+
+ SAML1 saml1= dbprotocols.getSAML1();
+ if (saml1 == null) {
+ saml1 = new SAML1();
+ dbprotocols.setSAML1(saml1);
+ }
+ saml1.setIsActive(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_SAML1_ENABLED)));
+
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_SAML1_SOURCEID))) {
+ saml1.setSourceID(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_SAML1_SOURCEID));
+ }
+
+ OAuth oauth= dbprotocols.getOAuth();
+ if (oauth == null) {
+ oauth = new OAuth();
+ dbprotocols.setOAuth(oauth);
+ }
+ oauth.setIsActive(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_OPENID_ENABLED)));
+
+ PVP2 pvp2 = dbprotocols.getPVP2();
+ if (pvp2 == null) {
+ pvp2 = new PVP2();
+ dbprotocols.setPVP2(pvp2);
+ }
+
+ pvp2.setIsActive(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_ENABLED)));
+
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_SERVICENAMME)))
+ pvp2.setIssuerName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_SERVICENAMME));
+
+ Organization pvp2org = pvp2.getOrganization();
+ if (pvp2org == null) {
+ pvp2org = new Organization();
+ pvp2.setOrganization(pvp2org);
+ }
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_FULLNAME)))
+ pvp2org.setDisplayName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_FULLNAME));
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_SHORTNAME)))
+ pvp2org.setName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_SHORTNAME));
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_URL)))
+ pvp2org.setURL(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_URL));
+
+ List<Contact> pvp2cont = pvp2.getContact();
+ if (pvp2cont == null) {
+ pvp2cont = new ArrayList<Contact>();
+ pvp2.setContact(pvp2cont);
+ }
+
+ if (pvp2cont.size() == 0) {
+ Contact cont = new Contact();
+ pvp2cont.add(cont);
+ }
+
+ Contact cont = pvp2cont.get(0);
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_COMPANY)))
+ cont.setCompany(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_COMPANY));
+
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_GIVENNAME)))
+ cont.setGivenName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_GIVENNAME));
+
+ cont.setMail(Arrays.asList(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_MAIL)));
+
+ cont.setPhone(Arrays.asList(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_PHONE)));
+
+ cont.setSurName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_FAMLIYNAME));
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_TYPE)))
+ cont.setType(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_TYPE));
+
+ SSO dbsso = dbauth.getSSO();
+ if (dbsso == null) {
+ dbsso = new SSO();
+ dbauth.setSSO(dbsso);
+ }
+
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_SERVICENAME)))
+ dbsso.setFriendlyName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_SERVICENAME));
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_AUTHBLOCK_TEXT)))
+ dbsso.setSpecialText(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_AUTHBLOCK_TEXT));
+
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_TARGET))) {
+ dbsso.setTarget(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_TARGET));
+ }
+
+ DefaultBKUs dbbkus = dbconfig.getDefaultBKUs();
+
+ if (dbbkus == null) {
+ dbbkus = new DefaultBKUs();
+ dbconfig.setDefaultBKUs(dbbkus);
+ }
+
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_DEFAULTS_BKU_HANDY)))
+ dbbkus.setHandyBKU(moaconfig.get(MOAIDConfigurationConstants.GENERAL_DEFAULTS_BKU_HANDY));
+
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_DEFAULTS_BKU_ONLINE)))
+ dbbkus.setOnlineBKU(moaconfig.get(MOAIDConfigurationConstants.GENERAL_DEFAULTS_BKU_ONLINE));
+
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_DEFAULTS_BKU_LOCAL)))
+ dbbkus.setLocalBKU(moaconfig.get(MOAIDConfigurationConstants.GENERAL_DEFAULTS_BKU_LOCAL));
+
+ ChainingModes dbchainingmodes = dbconfig.getChainingModes();
+ if (dbchainingmodes == null) {
+ dbchainingmodes = new ChainingModes();
+ dbconfig.setChainingModes(dbchainingmodes);
+ }
+
+ dbchainingmodes.setSystemDefaultMode(
+ ChainingModeType.PKIX);
+
+ IdentityLinkSigners idlsigners = dbauth.getIdentityLinkSigners();
+ if (idlsigners == null) {
+ idlsigners = new IdentityLinkSigners();
+ dbauth.setIdentityLinkSigners(idlsigners);
+ }
+
+ ForeignIdentities dbforeign = dbauth.getForeignIdentities();
+ if (dbforeign == null) {
+ dbforeign = new ForeignIdentities();
+ dbauth.setForeignIdentities(dbforeign);
+ }
+
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL))) {
+ ConnectionParameterClientAuthType forcon = dbforeign.getConnectionParameter();
+ if (forcon == null) {
+ forcon = new ConnectionParameterClientAuthType();
+ dbforeign.setConnectionParameter(forcon);
+ }
+ forcon.setURL(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL));
+ }
+
+ ForeignIdentities foreign = dbauth.getForeignIdentities();
+ if (foreign != null) {
+ STORK stork = foreign.getSTORK();
+ if (stork == null) {
+ stork = new STORK();
+ foreign.setSTORK(stork);
+
+ }
+
+ Map<String, StorkAttribute> attrMap = new HashMap<String, StorkAttribute>();
+ Map<String, CPEPS> cpepsMap = new HashMap<String, CPEPS>();
+
+ for (String key : moaconfig.keySet()) {
+ if (key.startsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST)) {
+ String index = KeyValueUtils.getFirstChildAfterPrefix(key, MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST);
+ StorkAttribute attr = new StorkAttribute();
+ attr.setName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME));
+ attr.setMandatory(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY)));
+ attrMap.put(index, attr);
+
+ } else if (key.startsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST)) {
+ String index = KeyValueUtils.getFirstChildAfterPrefix(key, MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST);
+ CPEPS attr = new CPEPS();
+ attr.setCountryCode(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY));
+
+ attr.setURL(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL));
+
+ attr.setSupportsXMLSignature(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST
+ + "." + index + "."
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG)));
+
+ cpepsMap.put(index, attr);
+
+ }
+ }
+
+ stork.setAttributes(new ArrayList<StorkAttribute>(attrMap.values()));
+ stork.setCPEPS(new ArrayList<CPEPS>(cpepsMap.values()));
+
+ }
+
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL))) {
+ OnlineMandates dbmandate = dbauth.getOnlineMandates();
+ if (dbmandate == null) {
+ dbmandate = new OnlineMandates();
+ dbauth.setOnlineMandates(dbmandate);
+ }
+ ConnectionParameterClientAuthType dbmandateconnection = dbmandate.getConnectionParameter();
+
+ if (dbmandateconnection == null) {
+ dbmandateconnection = new ConnectionParameterClientAuthType();
+ dbmandate.setConnectionParameter(dbmandateconnection);
+ }
+ dbmandateconnection.setURL(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL));
+ }
+
+ MOASP dbmoasp = dbauth.getMOASP();
+ if (dbmoasp == null) {
+ dbmoasp = new MOASP();
+ dbauth.setMOASP(dbmoasp);
+ }
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_URL))) {
+ ConnectionParameterClientAuthType moaspcon = dbmoasp.getConnectionParameter();
+ if (moaspcon == null) {
+ moaspcon = new ConnectionParameterClientAuthType();
+ dbmoasp.setConnectionParameter(moaspcon);
+ }
+ moaspcon.setURL(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_URL));
+ }
+ VerifyIdentityLink moaidl = dbmoasp.getVerifyIdentityLink();
+ if (moaidl == null) {
+ moaidl = new VerifyIdentityLink();
+ dbmoasp.setVerifyIdentityLink(moaidl);
+ }
+ moaidl.setTrustProfileID(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_IDL_PROD));
+ VerifyAuthBlock moaauth = dbmoasp.getVerifyAuthBlock();
+ if (moaauth == null) {
+ moaauth = new VerifyAuthBlock();
+ dbmoasp.setVerifyAuthBlock(moaauth);
+ }
+ moaauth.setTrustProfileID(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_AUTHBLOCK_PROD));
+
+ if (moaauth.getVerifyTransformsInfoProfileID() == null) {
+ moaauth.setVerifyTransformsInfoProfileID(new ArrayList<String>());
+
+ }
+ moaauth.getVerifyTransformsInfoProfileID().add(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_AUTHBLOCK_TRANSFORM));
+
+ SecurityLayer seclayertrans = dbauth.getSecurityLayer();
+ if (seclayertrans == null) {
+ seclayertrans = new SecurityLayer();
+ dbauth.setSecurityLayer(seclayertrans);
+ }
+
+ try {
+ List<TransformsInfoType> trans = new ArrayList<TransformsInfoType>();
+ TransformsInfoType elem = new TransformsInfoType();
+ elem.setTransformation(Base64Utils.decode(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64), false));
+ elem.setFilename(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_NAME));
+ trans.add(elem);
+ seclayertrans.setTransformsInfo(trans);
+
+ } catch (IOException e) {
+ Logger.warn("Converting AuthBlock transformation FAILED.", e);
+ }
+
+
+ SLRequestTemplates slrequesttempl = dbconfig.getSLRequestTemplates();
+ if (slrequesttempl == null) {
+ slrequesttempl = new SLRequestTemplates();
+ dbconfig.setSLRequestTemplates(slrequesttempl);
+ }
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_DEFAULTS_TEMPLATES_HANDY)))
+ slrequesttempl.setHandyBKU(moaconfig.get(MOAIDConfigurationConstants.GENERAL_DEFAULTS_TEMPLATES_HANDY));
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_DEFAULTS_TEMPLATES_LOCAL)))
+ slrequesttempl.setLocalBKU(moaconfig.get(MOAIDConfigurationConstants.GENERAL_DEFAULTS_TEMPLATES_LOCAL));
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_DEFAULTS_TEMPLATES_ONLINE)))
+ slrequesttempl.setOnlineBKU(moaconfig.get(MOAIDConfigurationConstants.GENERAL_DEFAULTS_TEMPLATES_ONLINE));
+
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_TRUSTSTORE_URL)))
+ dbconfig.setTrustedCACertificates(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_TRUSTSTORE_URL));
+
+
+ return dbconfig;
+ }
+
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java
new file mode 100644
index 000000000..399533d3f
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java
@@ -0,0 +1,277 @@
+package at.gv.egovernment.moa.id.commons.config;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+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.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration;
+import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
+import at.gv.egovernment.moa.id.commons.db.dao.config.STORK;
+import at.gv.egovernment.moa.logging.Logger;
+import at.gv.egovernment.moa.util.MiscUtil;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+public class ConfigurationUtil {
+
+ final boolean isOverwriteData;
+
+ public ConfigurationUtil(boolean isOverwriteData){
+ this.isOverwriteData = isOverwriteData;
+ }
+
+ /**
+ * Read an input MOAID 2 XML file, transfer it to properties and write the
+ * properties to a MOAID 3 property file.
+ *
+ * @param inStream
+ * the input stream to read from.
+ * @param outFile
+ * the output file to write to.
+ * @throws JAXBException
+ */
+ public void readFromXMLFileConvertToPropertyFile(FileInputStream inStream, File outFile) throws JAXBException {
+
+ try (FileOutputStream outStream = new FileOutputStream(outFile);) {
+
+ // get config from xml file
+ JAXBContext jc = JAXBContext.newInstance("at.gv.egovernment.moa.id.commons.db.dao.config");
+ Unmarshaller m = jc.createUnmarshaller();
+ MOAIDConfiguration config = (MOAIDConfiguration) m.unmarshal(inStream);
+
+ // serialize config to JSON properties
+ Properties result = moaIdConfigToJsonProperties(config);
+
+ // write to output stream
+ result.store(outStream, null);
+
+ } catch (FileNotFoundException e) {
+ System.out.println("Could not find the output file.");
+ System.exit(1);
+ } catch (IOException e) {
+ System.out.println("Could not write to the output file.");
+ System.exit(1);
+ }
+ }
+
+ /**
+ * Helper method to serialize a {@link MOAIDConfiguration} to Properties
+ * with JSON encoded values.
+ *
+ * @param config
+ * the MOAIDConfiguration to serialize
+ * @return {@link Properties} containing the database key and the serialized
+ * values
+ * @throws JsonProcessingException
+ * is thrown if problem occurred while serializing one of the
+ * database values
+ */
+ private Properties moaIdConfigToJsonProperties(MOAIDConfiguration config) throws JsonProcessingException {
+
+ Properties result = new Properties();
+
+ if (config == null) {
+ return null;
+
+ }
+ STORK storkConfig = null;
+ try {
+ storkConfig = config.getAuthComponentGeneral().getForeignIdentities().getSTORK();
+
+ } catch (Exception e) {
+ Logger.debug("No general STORK configuration found.");
+
+ }
+
+ //convert all online applications
+ List<OnlineApplication> oaList = config.getOnlineApplication();
+ for (int i=0; i<oaList.size(); i++) {
+ OnlineApplication oa = oaList.get(i);
+ Map<String, String> keyValueOA = ConfigurationMigrationUtils.convertHyberJaxBOnlineApplicationToKeyValue(oa, storkConfig);
+
+ String serviceIdentifier = keyValueOA.get(MOAIDConfigurationConstants.PREFIX_SERVICES);
+ if (MiscUtil.isEmpty(serviceIdentifier)) {
+ Logger.info("Use default ServiceIdentifier.");
+ serviceIdentifier = MOAIDConfigurationConstants.PREFIX_OA;
+ }
+
+ //write all OA key/value pairs to configuration
+ for (String key : keyValueOA.keySet()) {
+ if (MiscUtil.isNotEmpty(keyValueOA.get(key)))
+ result.put(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES
+ + "." + serviceIdentifier + "." + String.valueOf(i) + "."
+ + key,
+ keyValueOA.get(key));
+
+ }
+ //set correct metadata list identifier
+ result.put(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES
+ + "." + serviceIdentifier + "." + String.valueOf(i) + "."
+ + MOAIDConfigurationConstants.METADATA_LIST +".0",
+ MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES
+ + "." + serviceIdentifier);
+ }
+
+ Map<String, String> keyValueGeneral = ConfigurationMigrationUtils.convertHyberJaxBMOAIDConfigToKeyValue(config);
+ //write all OA key/value pairs to configuration
+ for (String key : keyValueGeneral.keySet()) {
+ if (MiscUtil.isNotEmpty(keyValueGeneral.get(key)))
+ result.put(key, keyValueGeneral.get(key));
+
+ }
+
+ return result;
+ }
+
+ /**
+ * Exports a key-value database to a property file, where keys are the same
+ * as in the database, and the values are serialized JSON objects.
+ *
+ * @param inputDBConfigFilePath
+ * the path to the database properties, for the db the data is
+ * read from.
+ * @param outFile
+ * the destination file for the exported data.
+ */
+ public void readFromDBWriteToFile(String inputDBConfigFilePath, File outFile) {
+
+ try (FileOutputStream outStream = new FileOutputStream(outFile);) {
+
+ Properties result = new Properties();
+
+ System.getProperties().setProperty("location", "file:" + inputDBConfigFilePath);
+ ApplicationContext context = new ClassPathXmlApplicationContext("configuration.beans.xml");
+ Configuration dbConfiguration = (Configuration) context.getBean("config");
+ String[] allKeys = dbConfiguration.getConfigurationIds();
+
+ for (String key : allKeys) {
+
+ // extract database value
+ String value = dbConfiguration.getStringValue(key);
+
+ // add to properties
+ result.setProperty(key, value);
+ }
+
+ // write to output stream
+ result.store(outStream, null);
+
+ System.out.println("Property configuration written to:");
+ System.out.println(outFile.getAbsolutePath());
+
+ } catch (FileNotFoundException e) {
+ System.out.println("Could not find the output file.");
+ System.exit(1);
+ } catch (IOException e) {
+ System.out.println("Could not write to the output file.");
+ System.exit(1);
+
+ } catch (ConfigurationException e) {
+ System.out.println("Could not read from database.");
+ System.exit(1);
+
+ }
+ }
+
+ /**
+ * Read an input property file, deserialize it's values and write them to
+ * the given database.
+ *
+ * @param inStream
+ * the FileInputStream to read from.
+ * @param outputDBConfigFilePath
+ * the path to the database properties, for the db which is
+ * written.
+ * @throws IOException
+ * is thrown in case the properties could not be loaded from the
+ * stream
+ */
+ @Transactional
+ public void readFromFileWriteToDB(FileInputStream inStream, String outputDBConfigFilePath) throws IOException {
+
+ Properties inProperties = new Properties();
+ inProperties.load(inStream);
+
+ System.getProperties().setProperty("moa.id.webconfig", "file:" + outputDBConfigFilePath);
+ ApplicationContext context = new ClassPathXmlApplicationContext(
+ new String[]{
+ "configuration.beans.xml",
+ "moaid.migration.beans.xml"
+ });
+ Configuration dbConfiguration = (Configuration) context.getBean("moaidconfig");
+
+ List<String> keys = null;
+ try {
+ keys = Arrays.asList(dbConfiguration.getConfigurationIds());
+
+ } catch (ConfigurationException e1) {
+ System.out.println("Database can not be read.");
+ System.exit(1);
+ }
+
+ if (keys == null) {
+ System.out.println("Database can not be read.");
+ System.exit(1);
+ }
+
+ if (!keys.isEmpty() && !isOverwriteData) {
+ System.out.println("The database already contains configuration data.");
+ System.out.println("Use force switch if you want to override data)");
+ System.exit(1);
+ }
+
+ if (isOverwriteData) {
+ // remove existing entries
+ for (String key : keys) {
+ try {
+ dbConfiguration.deleteIds(key);
+ } catch (ConfigurationException e) {
+ System.out.println("Could NOT persist the configuration file's information in the database.");
+
+ }
+ }
+ }
+
+ Enumeration<?> propertyNames = inProperties.propertyNames();
+
+ while (propertyNames.hasMoreElements()) {
+ String key = (String) propertyNames.nextElement();
+ String json = inProperties.getProperty(key);
+
+ // add to database
+ try {
+ dbConfiguration.setStringValue(key, json);
+
+ } catch (ConfigurationException e) {
+ System.out.println("Could NOT persist the configuration file's information in the database.");
+
+ }
+
+
+
+ }
+ System.out.println("Data has been successfully written to the database.");
+ }
+
+ private static void readFromDBWriteToDB(String inputDBConfigFilePath, String outputDBConfigFilePath) {
+ //TODO: implement
+ }
+
+}
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
new file mode 100644
index 000000000..fab5b437f
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java
@@ -0,0 +1,254 @@
+package at.gv.egovernment.moa.id.commons.config;
+
+import at.gv.egovernment.moa.id.commons.MOAIDConstants;
+
+/**
+ *
+ *
+ */
+public final class MOAIDConfigurationConstants extends MOAIDConstants {
+
+ private MOAIDConfigurationConstants() {
+ // restrict instantiation
+ }
+ public static final String METADATA_LIST = "__LI";
+
+ public static final String WEBGUI_EMPTY_ELEMENT = "null";
+
+ //Basic key namespaces
+ public static final String PREFIX_MOAID = "moa.id";
+ public static final String PREFIX_GENERAL = "general";
+ public static final String PREFIX_SERVICES = "services";
+ public static final String PREFIX_OA = "oa";
+ public static final String PREFIX_VIDP = "vidp";
+ public static final String PREFIX_IIDP = "iidp";
+ public static final String PREFIX_GATEWAY = "gateway";
+
+ public static final String PREFIX_MOAID_GENERAL = PREFIX_MOAID + "." + PREFIX_GENERAL;
+ public static final String PREFIX_MOAID_SERVICES = PREFIX_MOAID + "." + PREFIX_SERVICES;
+ public static final String PREFIX_MOAID_SERVICES_OA = PREFIX_MOAID_SERVICES + "." + PREFIX_OA;
+ public static final String PREFIX_MOAID_SERVICES_VIDP = PREFIX_MOAID_SERVICES + "." + PREFIX_VIDP;
+ public static final String PREFIX_MOAID_SERVICES_IIDP = PREFIX_MOAID_SERVICES + "." + PREFIX_IIDP;
+ 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_FRIENDLYNAME = "friendlyName"; //friendlyName
+ public static final String SERVICE_BUSINESSSERVICE = "businessservice"; //type
+ public static final String SERVICE_ISACTIVE = "isActive"; //isActive
+
+ //service authentication keys
+ private static final String AUTH = "auth";
+ private static final String TARGET = "target";
+ private static final String BKU = "bku";
+ private static final String TESTCREDENTIALS = "testcredentials";
+ private static final String MANDATES = "mandates";
+ private static final String FOREIGNBPK = "foreignbPK";
+ private static final String SSO = "sso";
+ private static final String STORK = "stork";
+ private static final String TEMPLATES = "templates";
+ private static final String INTERFEDERATION = "interfederation";
+
+ private static final String PROTOCOLS = "protocols";
+ private static final String SAML1 = "saml1";
+ private static final String PVP2X = "pvp2x";
+ private static final String OPENID = "openID";
+
+ private static final String SERVICE_AUTH_TARGET = AUTH + "." + TARGET;
+ private static final String SERVICE_AUTH_TARGET_PUBLIC = SERVICE_AUTH_TARGET + ".public";
+ 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_PUBLIC_TARGET = SERVICE_AUTH_TARGET_PUBLIC + ".target";
+ public static final String SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB = SERVICE_AUTH_TARGET_PUBLIC + ".target.sub";
+ public static final String SERVICE_AUTH_TARGET_PUBLIC_USE_SUB = SERVICE_AUTH_TARGET_PUBLIC + ".use.sub";
+ public static final String SERVICE_AUTH_TARGET_PUBLIC_USE_OWN = SERVICE_AUTH_TARGET_PUBLIC + ".own.use";
+ public static final String SERVICE_AUTH_TARGET_PUBLIC_OWN_TARGET = SERVICE_AUTH_TARGET_PUBLIC + ".own.target";
+ public static final String SERVICE_AUTH_TARGET_PUBLIC_OWN_NAME = SERVICE_AUTH_TARGET_PUBLIC + ".own.name";
+
+ private static final String SERVICE_AUTH_BKU = AUTH + "." + BKU;
+ public static final String SERVICE_AUTH_BKU_ONLINE = SERVICE_AUTH_BKU + ".onlineBKU";
+ public static final String SERVICE_AUTH_BKU_LOCAL = SERVICE_AUTH_BKU + ".localBKU";
+ public static final String SERVICE_AUTH_BKU_HANDY = SERVICE_AUTH_BKU + ".handyBKU";
+ public static final String SERVICE_AUTH_BKU_KEYBOXIDENTIFIER = SERVICE_AUTH_BKU + ".keyBoxIdentifier";
+ public static final String SERVICE_AUTH_BKU_TEMPLATE = SERVICE_AUTH_BKU + ".template"; //SecurityLayer Templates
+ public static final String SERVICE_AUTH_BKU_TEMPLATE_LEGACY = SERVICE_AUTH_BKU_TEMPLATE + ".legacy";
+ public static final String SERVICE_AUTH_BKU_TEMPLATE_FIRST_VALUE = SERVICE_AUTH_BKU_TEMPLATE + ".first.url";
+ public static final String SERVICE_AUTH_BKU_TEMPLATE_SECOND_VALUE = SERVICE_AUTH_BKU_TEMPLATE + ".second.url";
+ public static final String SERVICE_AUTH_BKU_TEMPLATE_THIRD_VALUE = SERVICE_AUTH_BKU_TEMPLATE + ".third.url";
+ public static final String SERVICE_AUTH_BKU_AUTHBLOCKTEXT = AUTH + ".authblock.additionaltext";
+ public static final String SERVICE_AUTH_BKU_AUTHBLOCK_REMOVEBPK = AUTH + ".authblock.removebPK";
+
+ 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";
+ public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_FILENAME = SERVICE_AUTH_TEMPLATES + ".bkuselection.filename";
+ public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA = SERVICE_AUTH_TEMPLATES + ".sendAssertion.data";
+ public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW = SERVICE_AUTH_TEMPLATES + ".sendAssertion.preview";
+ public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_FILENAME = SERVICE_AUTH_TEMPLATES + ".sendAssertion.filename";
+ private static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION = SERVICE_AUTH_TEMPLATES + ".customize";
+ public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_FONTTYPE = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".fonttype";
+ public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BACKGROUNDCOLOR = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".color.back";
+ public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_FRONTCOLOR = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".color.front";
+ public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_HEADERBACKGROUNDCOLOR = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".header.color.back";
+ public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_HEADERFRONTCOLOR = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".header.color.front";
+ public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_HEADERTEXT = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".header.text";
+ public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BUTTONBACKGROUNDCOLOR = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".button.color.back";
+ public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BUTTONBACLGROUNDCOLORFOCUS = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".button.color.back.focus";
+ public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BUTTONFRONTCOLOR = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".button.color.front";
+ public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_APPLETREDIRECTTARGET = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".applet.redirecttarget";
+ public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_APPLETHEIGHT = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".applet.hight";
+ public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_APPLETWIDTH = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".applet.width";
+
+ private static final String SERVICE_AUTH_TESTCREDENTIALS = AUTH + "." + TESTCREDENTIALS;
+ public static final String SERVICE_AUTH_TESTCREDENTIALS_ENABLED = SERVICE_AUTH_TESTCREDENTIALS + ".enabled";
+ public static final String SERVICE_AUTH_TESTCREDENTIALS_OIDs = SERVICE_AUTH_TESTCREDENTIALS + ".oids";
+
+ private static final String SERVICE_AUTH_MANDATES = AUTH + "." + MANDATES;
+ public static final String SERVICE_AUTH_MANDATES_USE = SERVICE_AUTH_MANDATES + "use";
+ public static final String SERVICE_AUTH_MANDATES_ONLY = SERVICE_AUTH_MANDATES + "only";
+ public static final String SERVICE_AUTH_MANDATES_PROFILES = SERVICE_AUTH_MANDATES + "profiles";
+
+ public static final String SERVICE_AUTH_FOREIGNBPK = AUTH + "." + FOREIGNBPK;
+ public static final String SERVICE_AUTH_FOREIGNBPK_DECRYPT = SERVICE_AUTH_FOREIGNBPK + ".decrypt";
+ public static final String SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV = SERVICE_AUTH_FOREIGNBPK_DECRYPT + ".iv";
+ public static final String SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB = SERVICE_AUTH_FOREIGNBPK_DECRYPT + ".blob";
+ public static final String SERVICE_AUTH_FOREIGNBPK_DECRYPT_FILENAME= SERVICE_AUTH_FOREIGNBPK_DECRYPT + ".filename";
+ public static final String SERVICE_AUTH_FOREIGNBPK_DECRYPT_KEYSTORE = SERVICE_AUTH_FOREIGNBPK_DECRYPT + ".keystore";
+ public static final String SERVICE_AUTH_FOREIGNBPK_DECRYPT_KEYSTOREPASSWORD = SERVICE_AUTH_FOREIGNBPK_DECRYPT + ".keystore.password";
+ public static final String SERVICE_AUTH_FOREIGNBPK_DECRYPT_KEYALIAS = SERVICE_AUTH_FOREIGNBPK_DECRYPT + ".key.alias";
+ public static final String SERVICE_AUTH_FOREIGNBPK_DECRYPT_KEYPASSWORD = SERVICE_AUTH_FOREIGNBPK_DECRYPT + ".key.password";
+
+ private static final String SERVICE_AUTH_SSO = AUTH + "." + SSO;
+ public static final String SERVICE_AUTH_SSO_ENABLED = SERVICE_AUTH_SSO + ".enabled";
+ public static final String SERVICE_AUTH_SSO_USERREQUEST = SERVICE_AUTH_SSO + ".userRequest";
+
+ private static final String SERVICE_AUTH_STORK = AUTH + "." + STORK;
+ public static final String SERVICE_AUTH_STORK_ENABLED = SERVICE_AUTH_STORK + ".enabled";
+ public static final String SERVICE_AUTH_STORK_MINQAALEVEL = SERVICE_AUTH_STORK + ".minqaalevel";
+ public static final String SERVICE_AUTH_STORK_COUNTRIES_LIST = SERVICE_AUTH_STORK + ".countries";
+ public static final String SERVICE_AUTH_STORK_COUNTRIES_LIST_ENABLED = "enabled";
+ public static final String SERVICE_AUTH_STORK_COUNTRIES_LIST_COUNTRYCODE = "countrycode";
+ public static final String SERVICE_AUTH_STORK_ATTRIBUTES_LIST = SERVICE_AUTH_STORK + ".attributes";
+ public static final String SERVICE_AUTH_STORK_ATTRIBUTES_LIST_NAME = "name";
+ public static final String SERVICE_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY = "mandatory";
+ public static final String SERVICE_AUTH_STORK_ATTRIBUTES_LIST_REQUESTED = "requested";
+ public static final String SERVICE_AUTH_STORK_REQUIRECONSENT = SERVICE_AUTH_STORK + ".requireConsent";
+ public static final String SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST = SERVICE_AUTH_STORK + ".attributeprovider";
+ public static final String SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST_NAME = "name";
+ public static final String SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST_URL = "url";
+ public static final String SERVICE_AUTH_STORK_ATTRIBUTPROVIDER_LIST_ATTRIBUTES = "attributes";
+
+ private static final String SERVICE_PROTOCOLS_SAML1 = PROTOCOLS + "." + SAML1;
+ public static final String SERVICE_PROTOCOLS_SAML1_ENABLED = SERVICE_PROTOCOLS_SAML1 + ".enabled";
+ public static final String SERVICE_PROTOCOLS_SAML1_IDL = SERVICE_PROTOCOLS_SAML1 + ".idl";
+ public static final String SERVICE_PROTOCOLS_SAML1_BASEID = SERVICE_PROTOCOLS_SAML1 + ".baseid";
+ public static final String SERVICE_PROTOCOLS_SAML1_AUTHBLOCK = SERVICE_PROTOCOLS_SAML1 + ".authblock";
+ public static final String SERVICE_PROTOCOLS_SAML1_CERTIFICATE = SERVICE_PROTOCOLS_SAML1 + ".certificate";
+ public static final String SERVICE_PROTOCOLS_SAML1_MANDATE = SERVICE_PROTOCOLS_SAML1 + ".mandate";
+ public static final String SERVICE_PROTOCOLS_SAML1_RETURNERROR = SERVICE_PROTOCOLS_SAML1 + ".returnError";
+
+ private static final String SERVICE_PROTOCOLS_PVP2X = PROTOCOLS + "." + PVP2X;
+ public static final String SERVICE_PROTOCOLS_PVP2X_RELOAD = SERVICE_PROTOCOLS_PVP2X + ".reload";
+ public static final String SERVICE_PROTOCOLS_PVP2X_URL = SERVICE_PROTOCOLS_PVP2X + ".URL";
+ public static final String SERVICE_PROTOCOLS_PVP2X_CERTIFICATE = SERVICE_PROTOCOLS_PVP2X + ".certificate.data";
+ public static final String SERVICE_PROTOCOLS_PVP2X_CERTIFICATE_SUBJECT = SERVICE_PROTOCOLS_PVP2X + ".certificate.preview";
+
+ private static final String SERVICE_PROTOCOLS_OPENID = PROTOCOLS + "." + OPENID;
+ public static final String SERVICE_PROTOCOLS_OPENID_CLIENTID = SERVICE_PROTOCOLS_OPENID + ".clientID";
+ public static final String SERVICE_PROTOCOLS_OPENID_CLIENTSECRET = SERVICE_PROTOCOLS_OPENID + ".secret";
+ public static final String SERVICE_PROTOCOLS_OPENID_REDIRECTURL = SERVICE_PROTOCOLS_OPENID + ".redirectURL";
+
+ public static final String SERVICE_INTERFEDERATION_SSO_INBOUND = INTERFEDERATION + ".SSO.inbound";
+ public static final String SERVICE_INTERFEDERATION_SSO_OUTBOUND = INTERFEDERATION + ".SSO.outbound";
+ public static final String SERVICE_INTERFEDERATION_SSO_STORE = INTERFEDERATION + ".SSO.store";
+ public static final String SERVICE_INTERFEDERATION_ATTRIBUTQUERY_URL = INTERFEDERATION + ".attributequery.url";
+
+ public static final String SERVICE_INTERFEDERATION_PASSIVEREQUEST = INTERFEDERATION + ".passiveReqeust";
+ public static final String SERVICE_INTERFEDERATION_LOCALAUTHONERROR = INTERFEDERATION + ".localAuthOnError";
+ public static final String SERVICE_INTERFEDERATION_FORWARD_IDPIDENTIFIER = INTERFEDERATION + ".forward.IDP";
+ public static final String SERVICE_INTERFEDERATION_FORWARD_PROTOCOL = INTERFEDERATION + ".forward.protocol";
+
+
+
+ //Namespaces for general MOA-ID config
+ public static final String GENERAL_PUBLICURLPREFIX = PREFIX_MOAID_GENERAL + ".publicURLPrefix";
+
+ private static final String GENERAL_DEFAULTS = PREFIX_MOAID_GENERAL + ".defaults";
+ private static final String GENERAL_DEFAULTS_BKU = GENERAL_DEFAULTS + "." + BKU;
+ public static final String GENERAL_DEFAULTS_BKU_ONLINE = GENERAL_DEFAULTS_BKU + ".onlineBKU";
+ public static final String GENERAL_DEFAULTS_BKU_HANDY = GENERAL_DEFAULTS_BKU + ".handyBKU";
+ public static final String GENERAL_DEFAULTS_BKU_LOCAL = GENERAL_DEFAULTS_BKU + ".localBKU";
+ private static final String GENERAL_DEFAULTS_TEMPLATES = GENERAL_DEFAULTS + "." + TEMPLATES;
+ public static final String GENERAL_DEFAULTS_TEMPLATES_LOCAL = GENERAL_DEFAULTS_TEMPLATES + ".localBKU";
+ public static final String GENERAL_DEFAULTS_TEMPLATES_HANDY = GENERAL_DEFAULTS_TEMPLATES + ".handyBKU";
+ public static final String GENERAL_DEFAULTS_TEMPLATES_ONLINE = GENERAL_DEFAULTS_TEMPLATES + ".onlineBKU";
+
+ private static final String GENERAL_AUTH = PREFIX_MOAID_GENERAL + ".auth";
+ private static final String GENERAL_AUTH_CERTIFICATE = GENERAL_AUTH + ".certificate";
+ public static final String GENERAL_AUTH_CERTSTORE_URL = GENERAL_AUTH_CERTIFICATE + ".certstore.url";
+ public static final String GENERAL_AUTH_TRUSTSTORE_URL = GENERAL_AUTH_CERTIFICATE + ".truststore.url";
+ public static final String GENERAL_AUTH_REVOCATIONCHECKING = GENERAL_AUTH_CERTIFICATE + ".revocationchecking";
+
+ public static final String GENERAL_AUTH_TIMEOUTS_TRANSACTION = GENERAL_AUTH + ".timeouts.transaction"; //Anmeldedaten
+ public static final String GENERAL_AUTH_TIMEOUS_SSO_CREATE = GENERAL_AUTH + ".timeouts.sso.create";
+ public static final String GENERAL_AUTH_TIMEOUS_SSO_UPDATE = GENERAL_AUTH + ".timeouts.sso.update";
+
+ public static final String GENERAL_AUTH_MOASP_TRUSTPROFILE_IDL_PROD = GENERAL_AUTH + ".moasp.trustprofile.idl.prod";
+ public static final String GENERAL_AUTH_MOASP_TRUSTPROFILE_IDL_TEST = GENERAL_AUTH + ".moasp.trustprofile.idl.test";
+ public static final String GENERAL_AUTH_MOASP_TRUSTPROFILE_AUTHBLOCK_PROD = GENERAL_AUTH + ".moasp.trustprofile.authblock.prod";
+ public static final String GENERAL_AUTH_MOASP_TRUSTPROFILE_AUTHBLOCK_TEST = GENERAL_AUTH + ".moasp.trustprofile.authblock.test";
+ public static final String GENERAL_AUTH_MOASP_AUTHBLOCK_TRANSFORM = GENERAL_AUTH + ".moasp.authblock.transform";
+ 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_SSO_SERVICENAME = GENERAL_AUTH + "." + SSO + ".servicename";
+ public static final String GENERAL_AUTH_SSO_TARGET = GENERAL_AUTH + "." + SSO + ".target";
+ public static final String GENERAL_AUTH_SSO_AUTHBLOCK_TEXT = GENERAL_AUTH + "." + SSO + ".authblock.text";
+
+ public static final String GENERAL_PROTOCOLS = PREFIX_MOAID_GENERAL + "." + PROTOCOLS;
+ public static final String GENERAL_PROTOCOLS_SAML1 = GENERAL_PROTOCOLS + "." + SAML1;
+ public static final String GENERAL_PROTOCOLS_PVP2X = GENERAL_PROTOCOLS + "." + PVP2X;
+ public static final String GENERAL_PROTOCOLS_OPENID = GENERAL_PROTOCOLS + "." + OPENID;
+ public static final String GENERAL_PROTOCOLS_SAML1_ENABLED = GENERAL_PROTOCOLS_SAML1 + ".enabled";
+ public static final String GENERAL_PROTOCOLS_SAML1_LEGACY = GENERAL_PROTOCOLS_SAML1 + ".legacy";
+ public static final String GENERAL_PROTOCOLS_SAML1_SOURCEID = GENERAL_PROTOCOLS_SAML1 + ".sourceID";
+ public static final String GENERAL_PROTOCOLS_OPENID_ENABLED = GENERAL_PROTOCOLS_OPENID + ".enabled";
+ public static final String GENERAL_PROTOCOLS_OPENID_LEGACY = GENERAL_PROTOCOLS_OPENID + ".legacy";
+
+ public static final String GENERAL_PROTOCOLS_PVP2X_ENABLED = GENERAL_PROTOCOLS_PVP2X + ".enabled";
+ public static final String GENERAL_PROTOCOLS_PVP2X_LEGACY = GENERAL_PROTOCOLS_PVP2X + ".legacy";
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA = GENERAL_PROTOCOLS_PVP2X + ".metadata";
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_SERVICENAMME = GENERAL_PROTOCOLS_PVP2X_METADATA + ".servicename";
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_ORG = GENERAL_PROTOCOLS_PVP2X_METADATA + ".org";
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_SHORTNAME = GENERAL_PROTOCOLS_PVP2X_METADATA_ORG + ".name.short";
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_FULLNAME = GENERAL_PROTOCOLS_PVP2X_METADATA_ORG + ".name.full";
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_ORG_URL = GENERAL_PROTOCOLS_PVP2X_METADATA_ORG + ".url";
+
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT = GENERAL_PROTOCOLS_PVP2X_METADATA + ".contact";
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_FAMLIYNAME = GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT + ".familyname";
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_GIVENNAME = GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT + ".givenname";
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_MAIL = GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT + ".mail";
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_PHONE = GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT + ".phone";
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_COMPANY = GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT + ".company";
+ public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_TYPE = GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT + ".type";
+
+ public static final String GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_NAME = GENERAL_AUTH + ".authblock.transformation.preview";
+ public static final String GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_FILENAME = GENERAL_AUTH + ".authblock.transformation.filename";
+ public static final String GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64 = GENERAL_AUTH + ".authblock.transformation.data";
+
+ public static final String GENERAL_AUTH_STORK = GENERAL_AUTH + "." + STORK;
+ public static final String GENERAL_AUTH_STORK_QAA = GENERAL_AUTH_STORK + ".qaa";
+ public static final String GENERAL_AUTH_STORK_CPEPS_LIST = GENERAL_AUTH_STORK + ".cpeps";
+ public static final String GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY = "countrycode";
+ public static final String GENERAL_AUTH_STORK_CPEPS_LIST_URL = "url";
+ public static final String GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG = "support.xmldsig";
+
+ public static final String GENERAL_AUTH_STORK_ATTRIBUTES_LIST = GENERAL_AUTH_STORK + ".attributes";
+ public static final String GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME = "friendlyname";
+ public static final String GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY = "mandatory";
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrateConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrateConfiguration.java
new file mode 100644
index 000000000..4e8c7dffd
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrateConfiguration.java
@@ -0,0 +1,103 @@
+package at.gv.egovernment.moa.id.commons.config;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import javax.xml.bind.JAXBException;
+
+import at.gv.egovernment.moa.id.commons.config.cli.MOAIDConfCLI;
+import at.gv.egovernment.moa.id.commons.config.cli.MigrateConfigurationParams;
+
+/**
+ * CLI tool which is able to perform the following tasks:
+ * <ul>
+ * <li>transform a MoaID 2 XML configuration XML file to a MoaID 3 property file
+ * </li>
+ * <li>read a property file and transfer it's content to a database</li>
+ * <li>write the content of a database to a property file</li>
+ * </ul>
+ */
+public class MigrateConfiguration {
+
+ public static void main(String[] args) {
+
+ MOAIDConfCLI cli = new MOAIDConfCLI();
+ MigrateConfigurationParams parsedParameters = cli.parse(args);
+
+ // consider settings of force switch
+ boolean isOverwriteData = parsedParameters.isOverwriteData();
+ ConfigurationUtil configUtil = new ConfigurationUtil(isOverwriteData);
+
+ if (!parsedParameters.isInputDB() && (parsedParameters.getInputTarget() != null)) {
+ // read input from file
+ workWithInputFromFile(parsedParameters.getInputTarget(), parsedParameters, configUtil);
+
+ } else if (parsedParameters.getInputDBConfig() != null) {
+ // read input from database
+ workWithImputFromDB(parsedParameters, configUtil);
+
+ } else {
+ System.exit(1);
+ }
+ }
+
+ /**
+ * Handle the case where input from a file is read.
+ *
+ * @param inputFileUrl
+ * the url of the input file.
+ * @param parsedParameters
+ * the command line parameters.
+ * @param configUtil
+ * the class for working with the configuration.
+ */
+ private static void workWithInputFromFile(String inputFileUrl, MigrateConfigurationParams parsedParameters,
+ ConfigurationUtil configUtil) {
+ File inFile = new File(inputFileUrl);
+ try (FileInputStream inStream = new FileInputStream(inFile);) {
+
+ if (!parsedParameters.isOutputDB() && (parsedParameters.getOutputFile() != null)) {
+ // input from file and output to a file is desired
+ File outFile = new File(parsedParameters.getOutputFile());
+ configUtil.readFromXMLFileConvertToPropertyFile(inStream, outFile);
+
+ } else if (parsedParameters.getOutputDBConfig() != null) {
+ // input from file and output to a database is desired
+ configUtil.readFromFileWriteToDB(inStream, parsedParameters.getOutputDBConfig());
+ }
+ } catch (JAXBException e) {
+ System.out.println("MOA-ID XML configuration can not be loaded from given file.");
+ System.exit(1);
+ } catch (FileNotFoundException e) {
+ System.out.println("Could not find the input file.");
+ System.exit(1);
+ } catch (IOException e) {
+ System.out.println("Could not read from the input file.");
+ System.exit(1);
+ }
+ }
+
+ /**
+ * Handle the case where input is read from a database.
+ *
+ * @param parsedParameters
+ * the command line parameters.
+ * @param configUtil
+ * the class for working with the configuration.
+ */
+ private static void workWithImputFromDB(MigrateConfigurationParams parsedParameters, ConfigurationUtil configUtil) {
+ if (!parsedParameters.isOutputDB() && (parsedParameters.getOutputFile() != null)) {
+ // input from database and output to a file is desired
+ File outFile = new File(parsedParameters.getOutputFile());
+ String inputDBConfigFilePath = parsedParameters.getInputDBConfig();
+ configUtil.readFromDBWriteToFile(inputDBConfigFilePath, outFile);
+
+ } else if (parsedParameters.getOutputDBConfig() != null) {
+ // input from database and output to a database is desired
+ // configUtil.readFromDBWriteToDB(inDBConfigFilePath,
+ // outDBConfigFilePath);
+ }
+ }
+} \ No newline at end of file
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java
new file mode 100644
index 000000000..c472299b9
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.config;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import javax.xml.bind.JAXBException;
+
+/**
+ * @author tlenz
+ *
+ */
+public class MigrationTest {
+
+ public static void main(String[] args) {
+
+ String inputFile = "D:/Projekte/svn/moa-id/MOAID-2.0_config_labda_12.05.2015.xml";
+ String outputFile = "D:/Projekte/svn/moa-id/MOAID-3.0_config.propery";
+
+ String moaidconfig = "D:/Projekte/svn/moa-id/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/conf/moa-id-configuration/moa-id.properties";
+ try {
+ FileInputStream input = new FileInputStream(inputFile);
+ File out = new File(outputFile);
+
+ ConfigurationUtil utils = new ConfigurationUtil(true);
+ utils.readFromXMLFileConvertToPropertyFile(input, out);
+
+ FileInputStream dbInput = new FileInputStream(outputFile);
+ utils.readFromFileWriteToDB(dbInput, moaidconfig);
+
+
+ } catch (JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/CLIConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/CLIConstants.java
new file mode 100644
index 000000000..c652645fc
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/CLIConstants.java
@@ -0,0 +1,37 @@
+package at.gv.egovernment.moa.id.commons.config.cli;
+
+/**
+ * Constants for the CLI.
+ * @author Christian Wagner
+ *
+ */
+public class CLIConstants {
+ private CLIConstants() {
+ }
+
+ public static final String CMD_LINE_SYNTAX = "java -jar migrateMOAIDconfiguration.jar";
+
+ public static final String HELP_HEADER = "Convert a given MOAID 2.x config-file.";
+ public static final String HELP_FOOTER = "";
+ // default width of a printed row
+ public static final int HELP_ROW_WIDTH = 80;
+
+ public static final int HELP_SPACE_BEFORE_OPT = 2;
+ public static final int HELP_SPACE_BEFORE_DESC = 4;
+
+ public static final String CLI_PARAM_IN = "in";
+ public static final String CLI_PARAM_IN_LONG = "input-file";
+ public static final String CLI_PARAM_OUT = "out";
+ public static final String CLI_PARAM_OUT_LONG = "output-file";
+ public static final String CLI_PARAM_INDB = "indb";
+ public static final String CLI_PARAM_INDB_LONG = "input-dbconf";
+ public static final String CLI_PARAM_OUTDB = "outdb";
+ public static final String CLI_PARAM_OUTDB_LONG = "output-dbconf";
+
+ public static final String CLI_PARAM_HELP = "h";
+ public static final String CLI_PARAM_HELP_LONG = "help";
+
+ public static final String CLI_PARAM_FORCE = "f";
+ public static final String CLI_PARAM_FORCE_LONG = "force";
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java
new file mode 100644
index 000000000..f2753c3d0
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java
@@ -0,0 +1,127 @@
+package at.gv.egovernment.moa.id.commons.config.cli;
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+
+import org.apache.commons.cli.BasicParser;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionGroup;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The command-line interface for MOAID configuration migration
+ * @author Christian Wagner
+ *
+ */
+public class MOAIDConfCLI {
+
+ // the default output to write usage information and help text to
+ private static final OutputStream OUTPUT_STREAM = System.out;
+
+ private Logger log = LoggerFactory.getLogger(getClass());
+
+ /**
+ * Parses the given command-line arguments using a {@link BasicParser} with small modifications.
+ * @param commandLineArgs the command-line arguments.
+ */
+ public MigrateConfigurationParams parse(String[] commandLineArgs) {
+
+ CommandLineParser parser = new BasicParser();
+ CommandLine cmd = null;
+ MigrateConfigurationParams result = null;
+ try {
+
+ if (null == commandLineArgs || commandLineArgs.length == 0) {
+ printUsage(OUTPUT_STREAM, true);
+ System.exit(0);
+ }
+
+ cmd = parser.parse(createOptions(), commandLineArgs, true);
+
+ if( null != cmd && cmd.hasOption(CLIConstants.CLI_PARAM_HELP)){
+ printUsage(OUTPUT_STREAM, true);
+ System.exit(0);
+ }
+
+ result = new MigrateConfigurationParams(cmd);
+
+ } catch (ParseException e) {
+ log.warn("Encountered exception while parsing: {}", e.getMessage());
+ System.err.println(e.getMessage());
+ printUsage(OUTPUT_STREAM, false);
+ System.exit(1);
+ }
+ return result;
+ }
+
+ /**
+ * Prints information about the usage to the given output.
+ * @param out the {@link OutputStream} to write to
+ * @param printOptions determines whether the available options are printed
+ */
+ private void printUsage(OutputStream out, boolean printOptions) {
+
+ PrintWriter pOut = new PrintWriter(out);
+
+ HelpFormatter formatter = new HelpFormatter();
+ pOut.println();
+ pOut.println("usage: " + CLIConstants.CMD_LINE_SYNTAX + " -" + CLIConstants.CLI_PARAM_FORCE + " -"
+ + CLIConstants.CLI_PARAM_IN + " <inputfile> | -" + CLIConstants.CLI_PARAM_INDB + " <dbconfig> -"
+ + CLIConstants.CLI_PARAM_OUT + " <outputfile> | -" + CLIConstants.CLI_PARAM_OUTDB + " <dbconfig> [-"
+ + CLIConstants.CLI_PARAM_HELP + "]");
+ pOut.println();
+ pOut.println(CLIConstants.HELP_HEADER);
+ if(printOptions){
+ pOut.println();
+ formatter.printOptions(pOut, CLIConstants.HELP_ROW_WIDTH, createOptions(), CLIConstants.HELP_SPACE_BEFORE_OPT, CLIConstants.HELP_SPACE_BEFORE_DESC);
+ }
+ pOut.flush();
+
+ }
+
+ /**
+ * Create all {@linkplain Option options} that should be available in the CLI.
+ * @return The {@linkplain Options options}
+ */
+ private Options createOptions() {
+
+ Options options = new Options();
+
+ OptionGroup inGroup = new OptionGroup();
+ Option optionInput = new Option(CLIConstants.CLI_PARAM_IN, CLIConstants.CLI_PARAM_IN_LONG, true, "MOAID config-file to convert");
+ optionInput.setArgName("inputfile");
+ Option optionDBInput = new Option(CLIConstants.CLI_PARAM_INDB, CLIConstants.CLI_PARAM_INDB_LONG, true, "config for database to read from");
+ optionDBInput.setArgName("dbconfig");
+
+ inGroup.addOption(optionDBInput);
+ inGroup.addOption(optionInput);
+ optionInput.setRequired(false);
+
+ OptionGroup outGroup = new OptionGroup();
+ Option optionOutput = new Option(CLIConstants.CLI_PARAM_OUT, CLIConstants.CLI_PARAM_OUT_LONG, true, "target file to write to");
+ optionOutput.setArgName("outputfile");
+ Option optionDBOutput = new Option(CLIConstants.CLI_PARAM_OUTDB, CLIConstants.CLI_PARAM_OUTDB_LONG, true, "config for database to write to");
+ optionDBOutput.setArgName("dbconfig");
+
+ outGroup.addOption(optionDBOutput);
+ outGroup.addOption(optionOutput);
+ outGroup.setRequired(false);
+
+ options.addOptionGroup(inGroup);
+ options.addOptionGroup(outGroup);
+
+ Option optForce = new Option(CLIConstants.CLI_PARAM_FORCE, CLIConstants.CLI_PARAM_FORCE_LONG, false, "overwrite existing data with imported data");
+ options.addOption(optForce);
+
+ Option optHelp = new Option(CLIConstants.CLI_PARAM_HELP, CLIConstants.CLI_PARAM_HELP_LONG, false, "prints this message");
+ options.addOption(optHelp);
+ return options;
+ }
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MigrateConfigurationParams.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MigrateConfigurationParams.java
new file mode 100644
index 000000000..86bde1310
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MigrateConfigurationParams.java
@@ -0,0 +1,106 @@
+package at.gv.egovernment.moa.id.commons.config.cli;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.MissingOptionException;
+
+/**
+ * The result set for the parsed command line arguments
+ * @author Christian Wagner
+ *
+ */
+public class MigrateConfigurationParams {
+
+ private String inputFile = null;
+ private String outputFile = null;
+ private String inputDbConfigFile = null;
+ private String outputDbConfigFile = null;
+
+ private boolean overwriteData = false;
+
+ /**
+ * Get the path to the input source which is MOAID 2.x config file in XML-format.
+ * @return the path to the input source or {@code null} if not set.
+ */
+ public String getInputTarget() {
+ return this.inputFile;
+ }
+
+ /**
+ * Get the path to the output file to write to.
+ * @return the path to the output file or {@code null} if not set.
+ */
+ public String getOutputFile() {
+ return outputFile;
+ }
+
+ /**
+ * Get the path to the configuration file for the input database.
+ * @return the path to the config file or {@code null} if not set.
+ */
+ public String getInputDBConfig() {
+ return inputDbConfigFile;
+ }
+
+ /**
+ * Get the path to the configuration file for the output database.
+ * @return the path to the config file or {@code null} if not set.
+ */
+ public String getOutputDBConfig() {
+ return outputDbConfigFile;
+ }
+
+ /**
+ * Returns whether the desired input is a config file for a database.
+ * @return <code>true</code> if the stored path points at a database config file; <code>false</code> otherwise.
+ */
+ public boolean isInputDB() {
+ return inputDbConfigFile != null;
+ }
+
+ /**
+ * Returns whether the desired output is a config file for a database.
+ * @return <code>true</code> if the stored path points at a database config file; <code>false</code> otherwise.
+ */
+ public boolean isOutputDB() {
+ return outputDbConfigFile != null;
+ }
+
+ /**
+ * Returns whether existing data should be overwritten by the imported data or not.
+ * @return <code>true</code> if the existing data should be overwritten; <code>false</code> otherwise.
+ */
+ public boolean isOverwriteData() {
+ return overwriteData;
+ }
+
+ /**
+ *
+ * @param cmdLine
+ * @throws MissingOptionException
+ */
+ public MigrateConfigurationParams(CommandLine cmdLine) throws MissingOptionException {
+ inputFile = cmdLine.getOptionValue(CLIConstants.CLI_PARAM_IN);
+ inputDbConfigFile = cmdLine.getOptionValue(CLIConstants.CLI_PARAM_INDB);
+ outputFile = cmdLine.getOptionValue(CLIConstants.CLI_PARAM_OUT);
+ outputDbConfigFile = cmdLine.getOptionValue(CLIConstants.CLI_PARAM_OUTDB);
+ overwriteData = cmdLine.hasOption(CLIConstants.CLI_PARAM_FORCE);
+
+ if (null == inputFile && null == inputDbConfigFile) {
+ throw new MissingOptionException("One of [-" + CLIConstants.CLI_PARAM_IN + ", -" + CLIConstants.CLI_PARAM_INDB + "] required.");
+ }
+
+ if (null == outputFile && null == outputDbConfigFile) {
+ throw new MissingOptionException("One of [-" + CLIConstants.CLI_PARAM_OUT + ", -" + CLIConstants.CLI_PARAM_OUTDB + "] required.");
+ }
+
+ if (null != inputFile && null != inputDbConfigFile) {
+ throw new MissingOptionException("Only one of [-" + CLIConstants.CLI_PARAM_IN + ", -" + CLIConstants.CLI_PARAM_INDB + "] allowed.");
+ }
+
+ if (null != outputFile && null != outputDbConfigFile) {
+ throw new MissingOptionException("Only one of [-" + CLIConstants.CLI_PARAM_OUT + ", -" + CLIConstants.CLI_PARAM_OUTDB + "] allowed.");
+ }
+
+ }
+
+} \ No newline at end of file
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/JsonMapper.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/JsonMapper.java
new file mode 100644
index 000000000..6138d571b
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/JsonMapper.java
@@ -0,0 +1,73 @@
+package at.gv.egovernment.moa.id.commons.config.persistence;
+
+import java.io.IOException;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+
+/**
+ * Helper class to handle the JSON (de-)serialization.
+ *
+ */
+public class JsonMapper {
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ /**
+ * The default constructor where the default pretty printer is disabled.
+ */
+ public JsonMapper() {
+ this(false);
+ }
+
+ /**
+ * The constructor.
+ * @param prettyPrint enables or disables the default pretty printer
+ */
+ public JsonMapper(boolean prettyPrint) {
+ mapper.setVisibility(PropertyAccessor.ALL, Visibility.NONE);
+ mapper.setVisibility(PropertyAccessor.GETTER, Visibility.PUBLIC_ONLY);
+ mapper.setVisibility(PropertyAccessor.IS_GETTER, Visibility.PUBLIC_ONLY);
+ if (prettyPrint) {
+ mapper.enable(SerializationFeature.INDENT_OUTPUT);
+ }
+ }
+
+ /**
+ * Serialize an object to a JSON string.
+ * @param value the object to serialize
+ * @return a JSON string
+ * @throws JsonProcessingException thrown when an error occurs during serialization
+ */
+ public String serialize(Object value) throws JsonProcessingException {
+ return mapper.writeValueAsString(value);
+ }
+
+ /**
+ * Deserialize a JSON string.
+ *
+ * @param value the JSON string to deserialize
+ * @param clazz optional parameter that determines the type of the returned object. If not set, an {@link Object} is returned.
+ * @return the deserialized JSON string as an object of type {@code clazz} or {@link Object}
+ * @throws JsonParseException if the JSON string contains invalid content.
+ * @throws JsonMappingException if the input JSON structure does not match structure expected for result type
+ * @throws IOException if an I/O problem occurs (e.g. unexpected end-of-input)
+ */
+ public <T> Object deserialize(String value, Class<T> clazz) throws JsonParseException, JsonMappingException, IOException{
+
+ ObjectMapper mapper = new ObjectMapper();
+ if (clazz != null) {
+ JavaType javaType = TypeFactory.defaultInstance().constructType(clazz);
+ return mapper.readValue(value, javaType);
+ } else {
+ return mapper.readValue(value, Object.class);
+ }
+ }
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java
new file mode 100644
index 000000000..fbb1597f3
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java
@@ -0,0 +1,55 @@
+package at.gv.egovernment.moa.id.commons.config.persistence;
+
+import java.util.Map;
+import java.util.Properties;
+
+import at.gv.egiz.components.configuration.api.Configuration;
+import at.gv.egiz.components.configuration.api.ConfigurationException;
+
+/**
+ * An interface for a key-value configuration.
+ */
+public interface MOAIDConfiguration extends Configuration {
+
+ /**
+ * Get all key/value pairs with a prefix
+ *
+ * @param preFix: A key prefix
+ * @param removePrefix: Indicates, if the prefix should be removed from the result key
+ * @return All key/value pairs with this prefix or null if no key is found. The prefix is removed from the key.
+ *
+ **/
+ public Map<String, String> getPropertySubset(String preFix) throws ConfigurationException;
+
+
+ /**
+ * Searches the configuration use '*' or '%' for wildcards.
+ *
+ * Example:
+ *
+ * db.server1.url=...
+ * db.server1.user=...
+ * db.server1.password=...
+ * db.server1.driver=...
+ * db.server2.url=...
+ * db.server2.user=...
+ * db.server2.password=...
+ * db.server2.driver=...
+ *
+ * searchString: "db.server1.*" returns
+ * ["db.server1.url", "db.server1.user", "db.server1.password", "db.server1.driver"]
+ * @param searchkey The search string
+ * @return All key/value pairs with this prefix or null if no key is found. The prefix is not removed from the key.
+ * @throws ConfigurationException if something went wrong
+ */
+ public Map<String, String> searchPropertiesWithWildcard(String searchkey) throws ConfigurationException;
+
+ /**
+ * Load an OnlineApplication configuration and remove the OA key prefix
+ *
+ * @param publicURLPrefix: Unique identifier of online application
+ * @return Properties of the online application or null if no OA is found
+ * @throws ConfigurationException in case of an configuration access error
+ */
+ public Map<String, String> getOnlineApplication(String publicURLPrefix) throws ConfigurationException;
+} \ No newline at end of file
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
new file mode 100644
index 000000000..805bcb33e
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
@@ -0,0 +1,191 @@
+package at.gv.egovernment.moa.id.commons.config.persistence;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+
+import org.springframework.stereotype.Component;
+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.egovernment.moa.id.commons.config.MOAIDConfigurationConstants;
+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;
+
+/**
+ * The implementation of a key-value configuration implementing the {@link Configuration} interface.
+ * It employs the {@link ConfigPropertyDao} to persist configuration data.
+ */
+@Component
+@Transactional("transactionManager")
+public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implements MOAIDConfiguration {
+
+// Configuration configPropertyDao;
+//
+// /**
+// * Sets the {@link ConfigPropertyDao}.
+// * @param configPropertyDao the ConfigPropertyDao
+// */
+// @Required
+// public void setConfigPropertyDao(Configuration configPropertyDao) {
+// this.configPropertyDao = configPropertyDao;
+// }
+
+ public void setStringValue(String id, String value) throws ConfigurationException {
+ super.setStringValue(id, value);
+
+ }
+
+ public void deleteIds(String idSearch) throws ConfigurationException {
+ super.deleteIds(idSearch);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration#getPropertySubset(java.lang.String)
+ */
+ public Map<String, String> getPropertySubset(String preFix) throws ConfigurationException{
+ EntityManager em = this.getPersistenceContext();
+ if (null == em) {
+ Logger.error("No EntityManager set!");
+ throw new ConfigurationException("No EntityManager set!");
+
+ }
+
+ TypedQuery<ConfigProperty> configQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", ConfigProperty.class);
+ configQuery.setParameter("key", preFix + "%");
+ List<ConfigProperty> configResult = configQuery.getResultList();
+
+ if (configResult == null || configResult.isEmpty()) {
+ Logger.warn("Found no configuration keys with prefix: " + preFix + ".%");
+ return null;
+
+ }
+ Logger.trace("Find " + configResult.size() + " key/value pairs with prefix: " + preFix + ".%");
+
+ //build key/value configuration map from database entries
+ Map<String, String> result = getKeyValueFromDatabaseDAO(
+ configResult.iterator(), preFix, true);
+ return result;
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration#searchPropertiesWithWildcard(java.lang.String)
+ */
+ @Override
+ public Map<String, String> searchPropertiesWithWildcard(String searchKey)
+ throws ConfigurationException {
+ EntityManager em = this.getPersistenceContext();
+ if (null == em) {
+ Logger.error("No EntityManager set!");
+ throw new ConfigurationException("No EntityManager set!");
+
+ }
+
+ TypedQuery<ConfigProperty> configQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", ConfigProperty.class);
+ configQuery.setParameter("key", searchKey.replace("*", "%"));
+ List<ConfigProperty> configResult = configQuery.getResultList();
+
+ if (configResult == null || configResult.isEmpty()) {
+ Logger.warn("Found no configuration keys with searchKey: " + searchKey);
+ return null;
+
+ }
+ Logger.trace("Find " + configResult.size() + " key/value pairs with searchKey: " + searchKey);
+
+ //build key/value configuration map from database entries
+ Map<String, String> result = getKeyValueFromDatabaseDAO(
+ configResult.iterator(), null, false);
+ return result;
+
+ }
+
+ @Override
+ public Map<String, String> getOnlineApplication(String publicURLPrefix)
+ throws ConfigurationException {
+ EntityManager em = this.getPersistenceContext();
+ if (null == em) {
+ Logger.error("No EntityManager set!");
+ throw new ConfigurationException("No EntityManager set!");
+
+ }
+
+ //search key prefix for online application with this publicURLPrefix
+ String keyId = MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES
+ + ".%."
+ + MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER;
+
+ TypedQuery<ConfigProperty> oaSearchQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key and dbconfig.value = SUBSTRING(:uniqueID, 1, LENGTH(dbconfig.value))", ConfigProperty.class);
+ oaSearchQuery.setParameter("key", keyId);
+ oaSearchQuery.setParameter("uniqueID", publicURLPrefix);
+ List<ConfigProperty> oaSearchResult = oaSearchQuery.getResultList();
+
+ if (oaSearchResult.size() == 0) {
+ Logger.debug("No entries found.");
+ return null; }
+
+ if (oaSearchResult.size() > 1) {
+ Logger.warn("OAIdentifier match to more then one DB-entry!");
+ return null;
+ }
+
+ String oaIdKey = oaSearchResult.get(0).getKey();
+ String oaIdValue = oaSearchResult.get(0).getValue();
+ Logger.trace("Find online application with uniqueID: " + oaIdValue + " and keyID: " + oaIdKey);
+
+ //load all online application key/value pairs from database
+ String oaType = KeyValueUtils.getFirstChildAfterPrefix(oaIdKey, MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES);
+ String oaKey = KeyValueUtils.getPrefixFromKey(oaIdKey, MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER);
+
+ TypedQuery<ConfigProperty> oaConfigQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", ConfigProperty.class);
+ oaConfigQuery.setParameter("key", oaKey + ".%");
+ List<ConfigProperty> oaConfigResult = oaConfigQuery.getResultList();
+
+ if (oaConfigResult == null) {
+ Logger.warn("Found no configuration keys with prefix: " + oaKey + ".%");
+ return null;
+ }
+ Logger.trace("Find " + oaConfigResult.size() + " key/value pairs with prefix: " + oaKey + ".%");
+
+ //build key/value configuration map from database entries
+ Map<String, String> result = getKeyValueFromDatabaseDAO(
+ oaConfigResult.iterator(), oaKey, true);
+ result.put(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES, oaType);
+
+ return result;
+ }
+
+ /**
+ * Small helper method. NOTE: may return empty configuration properties, but never {@code null}.
+ *
+ * @param propPrefix: the prefix of the desired property.
+ * @param input: List of database objects with key/value information.
+ * @param removePrefix: Indicates if the prefix should be removed from the result key
+ * @return the {@link Map} of configuration properties
+ */
+ private Map<String, String> getKeyValueFromDatabaseDAO(Iterator<ConfigProperty> input, final String prefix, boolean removePrefix) {
+ Map<String, String> configProp = new HashMap<String, String>();
+ while (input.hasNext()) {
+ ConfigProperty el = input.next();
+ if (removePrefix) {
+ if (el.getKey().startsWith(prefix)) {
+ String propertyName = KeyValueUtils.removePrefixFromKey(el.getKey(), prefix);
+ configProp.put(propertyName, el.getValue());
+
+ }
+ } else
+ configProp.put(el.getKey(), el.getValue());
+
+ }
+ return configProp;
+ }
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java
index 6efdd6223..5c14df671 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java
@@ -22,6 +22,15 @@
*******************************************************************************/
package at.gv.egovernment.moa.id.commons.db;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+
+import org.apache.commons.lang3.StringEscapeUtils;
+
import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration;
import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
@@ -29,15 +38,14 @@ import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
//import org.apache.commons.lang.StringEscapeUtils;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceException;
-
-import org.apache.commons.lang3.StringEscapeUtils;
+import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+/**
+ *
+ * @author tlenz
+ *
+ * @deprecated
+ */
@SuppressWarnings("rawtypes")
public class ConfigurationDBRead {
@@ -63,330 +71,333 @@ public class ConfigurationDBRead {
QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id");
}
- public static OnlineApplication getActiveOnlineApplication(String id) {
- MiscUtil.assertNotNull(id, "OnlineApplictionID");
- Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getActiveOnlineApplicationWithID"));
- //query.setParameter("id", id+"%");
- query.setParameter("id", StringEscapeUtils.escapeHtml4(id));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.debug("No entries found.");
- return null;
- }
-
- if (result.size() > 1) {
- Logger.warn("OAIdentifier match to more then one DB-entry!");
- return null;
- }
-
- return (OnlineApplication) result.get(0);
- }
-
- public static OnlineApplication getOnlineApplication(String id) {
- MiscUtil.assertNotNull(id, "OnlineApplictionID");
- Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithID"));
- //query.setParameter("id", id+"%");
- query.setParameter("id", id);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
-
- if (result.size() > 1) {
- Logger.warn("OAIdentifier match to more then one DB-entry!");
- return null;
- }
-
- return (OnlineApplication) result.get(0);
- }
-
- public static OnlineApplication getOnlineApplication(long dbid) {
- MiscUtil.assertNotNull(dbid, "OnlineApplictionID");
- Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithDBID"));
- //query.setParameter("id", id+"%");
- query.setParameter("id", dbid);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
-
- return (OnlineApplication) result.get(0);
- }
-
- public static MOAIDConfiguration getMOAIDConfiguration() {
- Logger.trace("Load MOAID Configuration from database.");
-
- List<MOAIDConfiguration> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getMOAIDConfiguration"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found. Create fresh instance.");
- return null;
- }
-
- return (MOAIDConfiguration) result.get(0);
- }
-
- public static List<OnlineApplication> getAllOnlineApplications() {
- Logger.trace("Get All OnlineApplications from database.");
-
- List<OnlineApplication> result = null;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOnlineApplications"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
-
- public static List<OnlineApplication> getAllNewOnlineApplications() {
- Logger.trace("Get All OnlineApplications from database.");
-
- List<OnlineApplication> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewOnlineApplications"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
-
- public static List<UserDatabase> getAllUsers() {
- Logger.trace("Get All OnlineApplications from database.");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllUsers"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
-
- public static List<OnlineApplication> getAllActiveOnlineApplications() {
- Logger.trace("Get All active OnlineApplications from database.");
-
- List<OnlineApplication> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllActiveOnlineApplications"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- result = new ArrayList<OnlineApplication>();
-
- }
- return result;
- }
-
- @SuppressWarnings("rawtypes")
- public static List<OnlineApplication> searchOnlineApplications(String id) {
- MiscUtil.assertNotNull(id, "OnlineApplictionID");
- Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
-
- List<OnlineApplication> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("searchOnlineApplicationsWithID"));
- query.setParameter("id", "%" + id + "%");
-
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
-
- return result;
- }
-
- public static UserDatabase getUserWithID(long id) {
- MiscUtil.assertNotNull(id, "UserID");
- Logger.trace("Getting Userinformation with ID " + id + " from database.");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserID"));
- query.setParameter("id", id);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return (UserDatabase) result.get(0);
- }
-
- public static UserDatabase getUsersWithOADBID(long id) {
- MiscUtil.assertNotNull(id, "OADBID");
- Logger.trace("Getting Userinformation with OADBID " + id + " from database.");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getUsersWithOADBID"));
- query.setParameter("id", id);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return (UserDatabase) result.get(0);
- }
-
- public static UserDatabase getUserWithUserName(String username) {
- MiscUtil.assertNotNull(username, "UserName");
- Logger.trace("Getting Userinformation with ID " + username + " from database.");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserUsername"));
- query.setParameter("username", username);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return (UserDatabase) result.get(0);
- }
-
- public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) {
- MiscUtil.assertNotNull(bpkwbpk, "bpk/wbpk");
- Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database.");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserBPKWBPK"));
- query.setParameter("bpk", bpkwbpk);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return (UserDatabase) result.get(0);
- }
-
- public static UserDatabase getNewUserWithTokken(String tokken) {
- MiscUtil.assertNotNull(tokken, "bpk/wbpk");
- Logger.trace("Getting Userinformation with Tokken " + tokken + " from database.");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getNewUserWithUserTokken"));
- query.setParameter("tokken", tokken);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return (UserDatabase) result.get(0);
- }
-
- public static List<UserDatabase> getAllNewUsers() {
- Logger.trace("Get all new Users from Database");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewUsers"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
-
- public static List<UserDatabase> getAllOpenUsersRequests() {
- Logger.trace("Get all new Users from Database");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOpenUsersRequests"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
+// public static OnlineApplication getActiveOnlineApplication(String id) {
+// MiscUtil.assertNotNull(id, "OnlineApplictionID");
+// Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+//
+// List result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getActiveOnlineApplicationWithID"));
+// //query.setParameter("id", id+"%");
+// query.setParameter("id", StringEscapeUtils.escapeHtml4(id));
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.debug("No entries found.");
+// return null;
+// }
+//
+// if (result.size() > 1) {
+// Logger.warn("OAIdentifier match to more then one DB-entry!");
+// return null;
+// }
+//
+// return (OnlineApplication) result.get(0);
+// }
+//
+// public static OnlineApplication getOnlineApplication(String id) {
+// MiscUtil.assertNotNull(id, "OnlineApplictionID");
+// Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+//
+// List result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithID"));
+// //query.setParameter("id", id+"%");
+// query.setParameter("id", id);
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+//
+// if (result.size() > 1) {
+// Logger.warn("OAIdentifier match to more then one DB-entry!");
+// return null;
+// }
+//
+// return (OnlineApplication) result.get(0);
+// }
+//
+// public static OnlineApplication getOnlineApplication(long dbid) {
+// MiscUtil.assertNotNull(dbid, "OnlineApplictionID");
+// Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database.");
+//
+// List result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithDBID"));
+// //query.setParameter("id", id+"%");
+// query.setParameter("id", dbid);
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+//
+// return (OnlineApplication) result.get(0);
+// }
+//
+// @JsonProperty("getMOAIDConfiguration")
+// public static MOAIDConfiguration getMOAIDConfiguration() {
+// Logger.trace("Load MOAID Configuration from database.");
+//
+// List<MOAIDConfiguration> result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getMOAIDConfiguration"));
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found. Create fresh instance.");
+// return null;
+// }
+//
+// return (MOAIDConfiguration) result.get(0);
+// }
+//
+// @JsonProperty("getAllOnlineApplications")
+// public static List<OnlineApplication> getAllOnlineApplications() {
+// Logger.trace("Get All OnlineApplications from database.");
+//
+// List<OnlineApplication> result = null;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOnlineApplications"));
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+// return result;
+// }
+//
+// public static List<OnlineApplication> getAllNewOnlineApplications() {
+// Logger.trace("Get All OnlineApplications from database.");
+//
+// List<OnlineApplication> result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewOnlineApplications"));
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+// return result;
+// }
+//
+// @JsonProperty("getAllUsers")
+// public static List<UserDatabase> getAllUsers() {
+// Logger.trace("Get All OnlineApplications from database.");
+//
+// List<UserDatabase> result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllUsers"));
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+// return result;
+// }
+//
+// public static List<OnlineApplication> getAllActiveOnlineApplications() {
+// Logger.trace("Get All active OnlineApplications from database.");
+//
+// List<OnlineApplication> result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllActiveOnlineApplications"));
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// result = new ArrayList<OnlineApplication>();
+//
+// }
+// return result;
+// }
+//
+// @SuppressWarnings("rawtypes")
+// public static List<OnlineApplication> searchOnlineApplications(String id) {
+// MiscUtil.assertNotNull(id, "OnlineApplictionID");
+// Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+//
+// List<OnlineApplication> result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("searchOnlineApplicationsWithID"));
+// query.setParameter("id", "%" + id + "%");
+//
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+//
+// return result;
+// }
+//
+// public static UserDatabase getUserWithID(long id) {
+// MiscUtil.assertNotNull(id, "UserID");
+// Logger.trace("Getting Userinformation with ID " + id + " from database.");
+//
+// List<UserDatabase> result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserID"));
+// query.setParameter("id", id);
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+// return (UserDatabase) result.get(0);
+// }
+//
+// public static UserDatabase getUsersWithOADBID(long id) {
+// MiscUtil.assertNotNull(id, "OADBID");
+// Logger.trace("Getting Userinformation with OADBID " + id + " from database.");
+//
+// List<UserDatabase> result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getUsersWithOADBID"));
+// query.setParameter("id", id);
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+// return (UserDatabase) result.get(0);
+// }
+//
+// public static UserDatabase getUserWithUserName(String username) {
+// MiscUtil.assertNotNull(username, "UserName");
+// Logger.trace("Getting Userinformation with ID " + username + " from database.");
+//
+// List<UserDatabase> result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserUsername"));
+// query.setParameter("username", username);
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+// return (UserDatabase) result.get(0);
+// }
+//
+// public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) {
+// MiscUtil.assertNotNull(bpkwbpk, "bpk/wbpk");
+// Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database.");
+//
+// List<UserDatabase> result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserBPKWBPK"));
+// query.setParameter("bpk", bpkwbpk);
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+// return (UserDatabase) result.get(0);
+// }
+//
+// public static UserDatabase getNewUserWithTokken(String tokken) {
+// MiscUtil.assertNotNull(tokken, "bpk/wbpk");
+// Logger.trace("Getting Userinformation with Tokken " + tokken + " from database.");
+//
+// List<UserDatabase> result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getNewUserWithUserTokken"));
+// query.setParameter("tokken", tokken);
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+// return (UserDatabase) result.get(0);
+// }
+//
+// public static List<UserDatabase> getAllNewUsers() {
+// Logger.trace("Get all new Users from Database");
+//
+// List<UserDatabase> result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewUsers"));
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+// return result;
+// }
+//
+// public static List<UserDatabase> getAllOpenUsersRequests() {
+// Logger.trace("Get all new Users from Database");
+//
+// List<UserDatabase> result;
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+//
+// javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOpenUsersRequests"));
+// result = query.getResultList();
+//
+// Logger.trace("Found entries: " + result.size());
+//
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+// return result;
+// }
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java
index 3dcfa8aa9..d9f0267df 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java
@@ -64,156 +64,170 @@ public final class ConfigurationDBUtils {
}
- /**
- * Checks if a session factory is currently available. If necessary a new
- * session factory is created.
- *
- * @return current (or new) session factory
- * @throws HibernateException
- * thrown if a hibernate error occurs
- */
- public static EntityManager getCurrentSession() {
- if (automaticSessionHandling) {
-
- return entitymanagerfactory.createEntityManager();
- }
-
- EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get();
-
- if (session != null && session.isOpen()) {
+// /**
+// * Checks if a session factory is currently available. If necessary a new
+// * session factory is created.
+// *
+// * @return current (or new) session factory
+// * @throws HibernateException
+// * thrown if a hibernate error occurs
+// */
+// public static EntityManager getCurrentSession() {
+// if (automaticSessionHandling) {
+//
+// return entitymanagerfactory.createEntityManager();
+// }
+//
+// EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get();
+//
+// if (session != null && session.isOpen()) {
+//
+// //maybe a hack, but sometimes we do not know if the session is closed (session already closed but isOpen()=true)
+// try {
+// javax.persistence.Query query = session.createQuery("select userdatabase from UserDatabase userdatabase");
+// query.getResultList();
+//
+// } catch (Throwable e) {
+// Logger.warn("JPA Session Handling Warning!!!! - This error should not occur.");
+// session = getNewSession();
+// }
+//
+// } else
+// session = getNewSession();
+//
+// return session;
+// }
+//
+// @SuppressWarnings("unchecked")
+// public static EntityManager getNewSession() {
+// if (automaticSessionHandling) {
+// Logger.warn("Session is being automatically handled by hibernate. Therefore this session maybe not being newly created. Use HibernateUtil.getCurrentSession() instead.");
+// return entitymanagerfactory.createEntityManager();
+// }
+// EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get();
+// if (session != null ) {
+// Logger.warn("Previous session has not been closed; closing ConfigDB session now.");
+// closeSession();
+// }
+// Logger.debug("Opening new ConfigDB hibernate session...");
+// try {
+// session = entitymanagerfactory.createEntityManager();
+// THREAD_LOCAL_CONFIG.set(session);
+// } catch (HibernateException hex) {
+// Logger.error(hex.getMessage());
+// }
+// return session;
+// }
- //maybe a hack, but sometimes we do not know if the session is closed (session already closed but isOpen()=true)
- try {
- javax.persistence.Query query = session.createQuery("select userdatabase from UserDatabase userdatabase");
- query.getResultList();
-
- } catch (Throwable e) {
- Logger.warn("JPA Session Handling Warning!!!! - This error should not occur.");
- session = getNewSession();
- }
-
- } else
- session = getNewSession();
-
- return session;
- }
-
- @SuppressWarnings("unchecked")
- public static EntityManager getNewSession() {
- if (automaticSessionHandling) {
- Logger.warn("Session is being automatically handled by hibernate. Therefore this session maybe not being newly created. Use HibernateUtil.getCurrentSession() instead.");
- return entitymanagerfactory.createEntityManager();
- }
- EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get();
- if (session != null ) {
- Logger.warn("Previous session has not been closed; closing ConfigDB session now.");
- closeSession();
- }
- Logger.debug("Opening new ConfigDB hibernate session...");
- try {
- session = entitymanagerfactory.createEntityManager();
- THREAD_LOCAL_CONFIG.set(session);
- } catch (HibernateException hex) {
- Logger.error(hex.getMessage());
- }
- return session;
- }
+ /**
+ * Closes the current session.
+ *
+ * @throws HibernateException
+ * thrown if session is already closed or a hibernate error
+ * occurs.
+ *
+ * @deprecated
+ */
+@SuppressWarnings("unchecked")
+public static void closeSession() {
- /**
- * Closes the current session.
- *
- * @throws HibernateException
- * thrown if session is already closed or a hibernate error
- * occurs.
- */
- @SuppressWarnings("unchecked")
- public static void closeSession() {
- if (automaticSessionHandling) {
- Logger.warn("Session is being automatically handled by hibernate. Therefore the current session cannot be closed on demand.");
- return;
- }
- Logger.debug("Closing current ConfigDB hibernate session...");
- EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get();
- THREAD_LOCAL_CONFIG.set(null);
- if (session != null) {
- try {
- session.close();
-
- } catch (HibernateException hex) {
- Logger.error(hex.getMessage());
- }
- }
- }
-
- public static boolean save(Object dbo) throws MOADatabaseException {
- EntityTransaction tx = null;
-
- try {
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
- tx = session.getTransaction();
-
- synchronized (session) {
- tx.begin();
- session.merge(dbo);
- tx.commit();
-
- session.clear();
- }
- return true;
-
- } catch(HibernateException e) {
- Logger.warn("Error during Config database saveOrUpdate. Rollback.", e);
- tx.rollback();
- throw new MOADatabaseException(e);
- }
- }
-
+}
- public static boolean saveOrUpdate(Object dbo) throws MOADatabaseException {
- EntityTransaction tx = null;
-
- try {
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
- tx = session.getTransaction();
-
- synchronized (session) {
- tx.begin();
-
- session.merge(dbo);
- session.flush();
-
- tx.commit();
-
- //session.clear();
- }
- return true;
-
- } catch(HibernateException e) {
- Logger.warn("Error during Config database saveOrUpdate. Rollback.", e);
- tx.rollback();
- throw new MOADatabaseException(e);
- }
- }
-
- public static boolean delete(Object dbo) {
- EntityTransaction tx = null;
- try {
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
- tx = session.getTransaction();
-
- synchronized (session) {
- tx.begin();
- session.remove(session.contains(dbo) ? dbo : session.merge(dbo));
- tx.commit();
- }
-
- return true;
-
- } catch(HibernateException e) {
- Logger.warn("Error during Config database delete. Rollback.", e);
- tx.rollback();
- return false;
- }
- }
+// /**
+// * Closes the current session.
+// *
+// * @throws HibernateException
+// * thrown if session is already closed or a hibernate error
+// * occurs.
+// */
+// @SuppressWarnings("unchecked")
+// public static void closeSession() {
+// if (automaticSessionHandling) {
+// Logger.warn("Session is being automatically handled by hibernate. Therefore the current session cannot be closed on demand.");
+// return;
+// }
+// Logger.debug("Closing current ConfigDB hibernate session...");
+// EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get();
+// THREAD_LOCAL_CONFIG.set(null);
+// if (session != null) {
+// try {
+// session.close();
+//
+// } catch (HibernateException hex) {
+// Logger.error(hex.getMessage());
+// }
+// }
+// }
+//
+// public static boolean save(Object dbo) throws MOADatabaseException {
+// EntityTransaction tx = null;
+//
+// try {
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+// tx = session.getTransaction();
+//
+// synchronized (session) {
+// tx.begin();
+// session.merge(dbo);
+// tx.commit();
+//
+// session.clear();
+// }
+// return true;
+//
+// } catch(HibernateException e) {
+// Logger.warn("Error during Config database saveOrUpdate. Rollback.", e);
+// tx.rollback();
+// throw new MOADatabaseException(e);
+// }
+// }
+//
+//
+// public static boolean saveOrUpdate(Object dbo) throws MOADatabaseException {
+// EntityTransaction tx = null;
+//
+// try {
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+// tx = session.getTransaction();
+//
+// synchronized (session) {
+// tx.begin();
+//
+// session.merge(dbo);
+// session.flush();
+//
+// tx.commit();
+//
+// //session.clear();
+// }
+// return true;
+//
+// } catch(HibernateException e) {
+// Logger.warn("Error during Config database saveOrUpdate. Rollback.", e);
+// tx.rollback();
+// throw new MOADatabaseException(e);
+// }
+// }
+//
+// public static boolean delete(Object dbo) {
+// EntityTransaction tx = null;
+// try {
+// EntityManager session = ConfigurationDBUtils.getCurrentSession();
+// tx = session.getTransaction();
+//
+// synchronized (session) {
+// tx.begin();
+// session.remove(session.contains(dbo) ? dbo : session.merge(dbo));
+// tx.commit();
+// }
+//
+// return true;
+//
+// } catch(HibernateException e) {
+// Logger.warn("Error during Config database delete. Rollback.", e);
+// tx.rollback();
+// return false;
+// }
+// }
}
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
new file mode 100644
index 000000000..8f6100f84
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
@@ -0,0 +1,450 @@
+package at.gv.egovernment.moa.id.commons.db;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import at.gv.egiz.components.configuration.api.ConfigurationException;
+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.AuthComponentGeneral;
+import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes;
+import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs;
+import at.gv.egovernment.moa.id.commons.db.dao.config.GenericConfiguration;
+import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
+
+import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
+import at.gv.egovernment.moa.logging.Logger;
+
+/**
+ *
+ *
+ */
+public class NewConfigurationDBRead {
+
+ private static MOAIDConfiguration conf;
+
+ @Autowired(required = true)
+ public void setConfiguration(MOAIDConfiguration conf) {
+ // https://jira.spring.io/browse/SPR-3845
+ NewConfigurationDBRead.conf = conf;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T extends Iterable<?>> T nullGuard(T item) {
+ if (item == null) {
+ return (T) Collections.emptyList();
+ } else {
+ return item;
+ }
+
+ }
+
+ public static Map<String, String> getOnlineApplicationKeyValueWithId(String id) {
+ try {
+ return conf.getOnlineApplication(id);
+
+ } catch (ConfigurationException e) {
+ Logger.warn("OnlineApplication with Id: " + id + " not found.", e);
+ return null;
+
+ }
+ }
+
+
+
+ /**
+ *
+ * @return
+ */
+ public static List<UserDatabase> getAllUsers() {
+ Logger.trace("Get All Users from database.");
+
+// // select userdatabase from UserDatabase userdatabase
+// List<UserDatabase> result = conf.getList("getAllUsers", UserDatabase.class);
+// if (result.size() == 0) {
+// Logger.trace("No entries found.");
+// return null;
+// }
+//
+// return result;
+
+ //TODO!!!
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static List<OnlineApplication> getAllOnlineApplications() {
+ Logger.trace("Get All OnlineApplications from database.");
+
+ // select onlineapplication from OnlineApplication onlineapplication
+// return conf.getList(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, OnlineApplication.class);
+
+ //TODO!!!
+ return null;
+
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static List<OnlineApplication> getAllNewOnlineApplications() {
+ Logger.trace("Get All New OnlineApplications from database.");
+
+ // select onlineapplication from OnlineApplication onlineapplication
+ // where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1'
+ List<OnlineApplication> result = new ArrayList<OnlineApplication>();
+ List<OnlineApplication> allOAs = getAllOnlineApplications();
+
+ for (OnlineApplication oa : nullGuard(allOAs)) {
+ if (!oa.isIsActive() && oa.isIsAdminRequired()) {
+ result.add(oa);
+ }
+ }
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+
+ return result;
+ }
+
+// /**
+// *
+// * @return
+// */
+// public static at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration getMOAIDConfiguration() {
+// Logger.trace("Load MOAID Configuration from database.");
+//
+// AuthComponentGeneral authComponent = (AuthComponentGeneral) conf.get(MOAIDConfigurationConstants.AUTH_COMPONENT_GENERAL_KEY,
+// AuthComponentGeneral.class);
+//
+// ChainingModes chainingModes = (ChainingModes) conf.get(MOAIDConfigurationConstants.CHAINING_MODES_KEY, ChainingModes.class);
+// List<GenericConfiguration> genericConfigurations = (List<GenericConfiguration>) conf.getList(
+// MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, GenericConfiguration.class);
+// String trustedCaCertificates = (String) conf.get(MOAIDConfigurationConstants.TRUSTED_CERTIFICATES_KEY, String.class);
+// DefaultBKUs defaultBKUs = (DefaultBKUs) conf.get(MOAIDConfigurationConstants.DEFAULT_BKUS_KEY, DefaultBKUs.class);
+// SLRequestTemplates slrRequestRemplates = (SLRequestTemplates) conf.get(MOAIDConfigurationConstants.SLREQUEST_TEMPLATES_KEY,
+// SLRequestTemplates.class);
+// Date timeStamp = (Date) conf.get(MOAIDConfigurationConstants.TIMESTAMP_ITEM_KEY, Date.class);
+// Date pvp2Refresh = (Date) conf.get(MOAIDConfigurationConstants.PVP2REFRESH_ITEM_KEY, Date.class);
+//
+// // if (authComponent == null || chainingModes == null || trustedCaCertificates == null || defaultBKUs == null
+// // || slrRequestRemplates == null || timeStamp == null || pvp2Refresh == null
+// //
+// // ) {
+// // // TODO: is there a better approach in case of error?
+// // Logger.trace("Not all necessary data available. Create fresh instance.");
+// // return new MOAIDConfiguration();
+// // }
+//
+// // select moaidconfiguration from MOAIDConfiguration moaidconfiguration
+// at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration result = new at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration();
+// result.setAuthComponentGeneral(authComponent);
+// result.setChainingModes(chainingModes);
+// result.setGenericConfiguration(genericConfigurations);
+// result.setTrustedCACertificates(trustedCaCertificates);
+// result.setDefaultBKUs(defaultBKUs);
+// result.setSLRequestTemplates(slrRequestRemplates);
+// result.setTimestampItem(timeStamp);
+// result.setPvp2RefreshItem(pvp2Refresh);
+//
+// return result;
+// }
+
+ /**
+ *
+ * @return
+ */
+ public static List<OnlineApplication> getAllActiveOnlineApplications() {
+ Logger.trace("Get All New OnlineApplications from database.");
+
+ // select onlineapplication from OnlineApplication onlineapplication
+ // where onlineapplication.isActive = '1'
+ List<OnlineApplication> result = new ArrayList<OnlineApplication>();
+ List<OnlineApplication> allOAs = getAllOnlineApplications();
+
+ for (OnlineApplication oa : nullGuard(allOAs)) {
+ if (oa.isIsActive()) {
+ result.add(oa);
+ }
+ }
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @param id
+ * @return
+ */
+ public static OnlineApplication getActiveOnlineApplication(String id) {
+ Logger.trace("Getting Active OnlineApplication with ID " + id + " from database.");
+
+ // select onlineapplication from OnlineApplication onlineapplication
+ // where onlineapplication.publicURLPrefix =
+ // SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1'
+ OnlineApplication result = null;
+ List<OnlineApplication> allActiveOAs = getAllActiveOnlineApplications();
+
+ for (OnlineApplication oa : nullGuard(allActiveOAs)) {
+ String publicUrlPrefix = oa.getPublicURLPrefix();
+ if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) {
+ if ((id.substring(1, publicUrlPrefix.length()).equals(publicUrlPrefix))) {
+ if (result != null) {
+ Logger.warn("OAIdentifier match to more then one DB-entry!");
+ return null;
+ } else {
+ result = oa;
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @param dbid
+ * @return
+ */
+ public static OnlineApplication getOnlineApplication(long dbid) {
+ Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database.");
+
+ // select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id
+ OnlineApplication result = null;
+ List<OnlineApplication> allOAs = getAllOnlineApplications();
+
+ for (OnlineApplication oa : nullGuard(allOAs)) {
+ if (oa.getHjid() == dbid) {
+ result = oa;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @param id
+ * @return
+ */
+ public static OnlineApplication getOnlineApplication(String id) {
+ Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+
+ // select onlineapplication from OnlineApplication onlineapplication
+ // where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix))
+ OnlineApplication result = null;
+ List<OnlineApplication> allOAs = getAllOnlineApplications();
+
+ for (OnlineApplication oa : nullGuard(allOAs)) {
+ String publicUrlPrefix = oa.getPublicURLPrefix();
+ if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) {
+ if (id.substring(1, publicUrlPrefix.length()).equals(publicUrlPrefix)) {
+ if (result != null) {
+ Logger.warn("OAIdentifier match to more then one DB-entry!");
+ return null;
+ } else {
+ result = oa;
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @param id
+ * @return
+ */
+ public static List<OnlineApplication> searchOnlineApplications(String id) {
+ Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+
+ // select onlineapplication from OnlineApplication onlineapplication
+ // where onlineapplication.friendlyName like :id
+ List<OnlineApplication> result = new ArrayList<OnlineApplication>();
+ List<OnlineApplication> allOAs = getAllOnlineApplications();
+
+ for (OnlineApplication oa : nullGuard(allOAs)) {
+ if (id.equals(oa.getFriendlyName())) {
+ result.add(oa);
+ }
+ }
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static List<UserDatabase> getAllOpenUsersRequests() {
+ Logger.trace("Get all new Users from Database");
+
+ // select userdatabase from UserDatabase userdatabase
+ // where userdatabase.userRequestTokken is not null
+ // and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0'
+ List<UserDatabase> result = new ArrayList<UserDatabase>();
+ List<UserDatabase> allUsers = getAllUsers();
+
+ for (UserDatabase user : nullGuard(allUsers)) {
+ // TODO check result of query "... userdatabase.userRequestTokken is not null" if Tokken is null -> (null, "NULL", "", ... ?)
+ if ((user.getUserRequestTokken() != null && !user.getUserRequestTokken().isEmpty() && !user.getUserRequestTokken().equals("NULL"))
+ && (user.isIsAdminRequest()) && (!user.isIsMailAddressVerified())) {
+ result.add(user);
+ }
+ }
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @param tokken
+ * @return
+ */
+ public static UserDatabase getNewUserWithTokken(String tokken) {
+ Logger.trace("Getting Userinformation with Tokken " + tokken + " from database.");
+
+ // select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken
+ UserDatabase result = null;
+ List<UserDatabase> allUsers = getAllUsers();
+
+ for (UserDatabase user : nullGuard(allUsers)) {
+ if (user.getUserRequestTokken().equals(tokken)) {
+ result = user;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @param id
+ * @return
+ */
+ public static UserDatabase getUsersWithOADBID(long id) {
+ Logger.trace("Getting Userinformation with OADBID " + id + " from database.");
+
+ // select userdatabase from UserDatabase userdatabase
+ // inner join userdatabase.onlineApplication oa where oa.hjid = :id
+ UserDatabase result = null;
+ List<UserDatabase> allUsers = getAllUsers();
+
+ boolean quit = false;
+ for (UserDatabase user : nullGuard(allUsers)) {
+
+ for (OnlineApplication oa : user.getOnlineApplication()) {
+
+ if (oa.getHjid() == id) {
+ result = user;
+ quit = true;
+ break;
+ }
+ }
+
+ if (quit) {
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @param id
+ * @return
+ */
+ public static UserDatabase getUserWithID(long id) {
+ Logger.trace("Getting Userinformation with ID " + id + " from database.");
+
+ // select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id
+ UserDatabase result = null;
+ List<UserDatabase> allUsers = getAllUsers();
+
+ for (UserDatabase user : nullGuard(allUsers)) {
+ if (user.getHjid() == id) {
+ result = user;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @param username
+ * @return
+ */
+ public static UserDatabase getUserWithUserName(String username) {
+ Logger.trace("Getting Userinformation with ID " + username + " from database.");
+
+ // select userdatabase from UserDatabase userdatabase where userdatabase.username = :username
+ UserDatabase result = null;
+ List<UserDatabase> allUsers = getAllUsers();
+
+ for (UserDatabase user : nullGuard(allUsers)) {
+ if (user.getUsername().equals(username)) {
+ result = user;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ * @param bpkwbpk
+ * @return
+ */
+ public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) {
+ Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database.");
+
+ // select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk
+ UserDatabase result = null;
+ List<UserDatabase> allUsers = getAllUsers();
+
+ for (UserDatabase user : nullGuard(allUsers)) {
+ if (user.getBpk().equals(bpkwbpk)) {
+ result = user;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java
new file mode 100644
index 000000000..a2b1f120e
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java
@@ -0,0 +1,137 @@
+//package at.gv.egovernment.moa.id.commons.db;
+//
+//import java.util.Date;
+//import java.util.List;
+//
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//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.AuthComponentGeneral;
+//import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes;
+//import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs;
+//import at.gv.egovernment.moa.id.commons.db.dao.config.GenericConfiguration;
+//import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
+//import at.gv.egovernment.moa.id.commons.db.dao.config.SLRequestTemplates;
+//import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
+//
+///**
+// * This class is used for writing to the key-value database.
+// */
+//@Component
+//public class NewConfigurationDBWrite {
+//
+// private static MOAIDConfiguration conf;
+//
+// @Autowired(required = true)
+// public void setConfiguration(MOAIDConfiguration conf) {
+// // https://jira.spring.io/browse/SPR-3845
+// NewConfigurationDBWrite.conf = conf;
+// }
+//
+// private static boolean saveAuthComponentGeneral(AuthComponentGeneral dbo) {
+// return conf.set(MOAIDConfigurationConstants.AUTH_COMPONENT_GENERAL_KEY, dbo);
+// }
+//
+// private static boolean saveChainingModes(ChainingModes dbo) {
+// return conf.set(MOAIDConfigurationConstants.CHAINING_MODES_KEY, dbo);
+// }
+//
+// private static boolean saveOnlineApplication(OnlineApplication dbo) {
+//
+// List<OnlineApplication> storedObjects = conf.getList(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, OnlineApplication.class);
+// storedObjects.add(dbo);
+// return conf.set(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, storedObjects);
+// }
+//
+// private static boolean saveGenericConfiguration(GenericConfiguration dbo) {
+//
+// List<GenericConfiguration> storedObjects = conf.getList(MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, GenericConfiguration.class);
+// storedObjects.add(dbo);
+// return conf.set(MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, storedObjects);
+// }
+//
+// private static boolean saveTrustedCACertificates(String dbo) {
+// return conf.set(MOAIDConfigurationConstants.TRUSTED_CERTIFICATES_KEY, dbo);
+// }
+//
+// private static boolean saveDefaultBKUs(DefaultBKUs dbo) {
+// return conf.set(MOAIDConfigurationConstants.DEFAULT_BKUS_KEY, dbo);
+// }
+//
+// private static boolean saveSLRequestTemplates(SLRequestTemplates dbo) {
+// return conf.set(MOAIDConfigurationConstants.SLREQUEST_TEMPLATES_KEY, dbo);
+// }
+//
+// private static boolean saveTimeStampItem(Date dbo) {
+// return conf.set(MOAIDConfigurationConstants.TIMESTAMP_ITEM_KEY, dbo);
+// }
+//
+// private static boolean savePvp2RefreshItem(Date dbo) {
+// return conf.set(MOAIDConfigurationConstants.PVP2REFRESH_ITEM_KEY, dbo);
+// }
+//
+// /**
+// * Saves the given list of {@link OnlineApplication} objects to database.
+// * @param oas the list
+// * @return {@code true} on success; {@code false} otherwise.
+// */
+// public static boolean saveOnlineApplications(List<OnlineApplication> oas) {
+// return conf.set(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, oas);
+// }
+//
+// /**
+// * Saves the given list of {@link GenericConfiguration} objects to database.
+// * @param gcs the list
+// * @return {@code true} on success; {@code false} otherwise.
+// */
+// public static boolean saveGenericConfigurations(List<GenericConfiguration> gcs) {
+// return conf.set(MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, gcs);
+// }
+//
+//
+// /**
+// * Saves the given object to database
+// * @param dbo the object to save
+// * @return {@code true} on success; {@code false} otherwise.
+// */
+// public static boolean save(Object dbo) {
+//
+// boolean result = false;
+//
+// if (dbo instanceof OnlineApplication) {
+//
+// result = saveOnlineApplication((OnlineApplication) dbo);
+//
+// } else if (dbo instanceof MOAIDConfiguration) {
+//
+// at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration moaconfig =
+// (at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration) dbo;
+// result = true;
+//
+// result &= saveAuthComponentGeneral(moaconfig.getAuthComponentGeneral());
+// result &= saveChainingModes(moaconfig.getChainingModes());
+// result &= saveDefaultBKUs(moaconfig.getDefaultBKUs());
+// result &= saveGenericConfigurations(moaconfig.getGenericConfiguration());
+// result &= savePvp2RefreshItem(moaconfig.getPvp2RefreshItem());
+// result &= saveSLRequestTemplates(moaconfig.getSLRequestTemplates());
+// result &= saveTrustedCACertificates(moaconfig.getTrustedCACertificates());
+// result &= saveTimeStampItem(moaconfig.getTimestampItem());
+//
+// } else if (dbo instanceof UserDatabase) {
+// // TODO implement user handling
+// }
+//
+// return result;
+// }
+//
+// /**
+// * Deletes the object associated with the given key.
+// * @param key the key
+// */
+// public static void delete(String key) {
+// conf.set(key, null);
+// }
+//
+//}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java
new file mode 100644
index 000000000..f47b0c9e2
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java
@@ -0,0 +1,216 @@
+package at.gv.egovernment.moa.id.commons.db.dao.config;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.TypedQuery;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import at.gv.egiz.components.configuration.api.AbstractConfigurationImpl;
+import at.gv.egiz.components.configuration.api.ConfigurationException;
+import at.gv.egovernment.moa.util.MiscUtil;
+
+/**
+ * Database backed implementation of the DAO interface
+ *
+ */
+@Repository
+@Transactional("transactionManager")
+public class DatabaseConfigPropertyImpl extends AbstractConfigurationImpl {
+
+ private Logger log = LoggerFactory.getLogger(getClass());
+
+ @PersistenceContext(unitName = "config")
+ private EntityManager em;
+
+ /**
+ *
+ * @return EntityManager for database access
+ */
+ protected EntityManager getPersistenceContext() {
+ return em;
+ }
+
+ @Override
+ protected List<String> getAllKeys() throws ConfigurationException {
+ if (null == em) {
+ log.error("No EntityManager set!");
+ throw new ConfigurationException("No EntityManager set!");
+ }
+ TypedQuery<String> query = em.createQuery("select key from ConfigProperty", String.class);
+ List<String> result = query.getResultList();
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.AbstractConfigurationImpl#getValue(java.lang.String)
+ */
+ @Override
+ protected String getValue(String key) throws ConfigurationException {
+ ConfigProperty property = getProperty(key);
+ if (property == null)
+ return null;
+
+ else {
+ if (MiscUtil.isEmpty(property.getValue()))
+ return new String();
+ else
+ return property.getValue();
+
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.AbstractConfigurationImpl#containsKey(java.lang.String)
+ */
+ @Override
+ protected boolean containsKey(String key) throws ConfigurationException {
+ ConfigProperty property = getProperty(key);
+ if (property == null)
+ return false;
+ else
+ return true;
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.AbstractConfigurationImpl#storeKey(java.lang.String, java.lang.String)
+ */
+ @Override
+ @Transactional("transactionManager")
+ protected void storeKey(String key, String value) throws ConfigurationException {
+ if (null == em) {
+ log.error("No EntityManager set!");
+ throw new ConfigurationException("No EntityManager set!");
+
+ }
+ ConfigProperty property = new ConfigProperty();
+ property.setKey(key);
+ property.setValue(value);
+ log.debug("Storing '{}'.", property.toString());
+// em.persist(property);
+ em.merge(property);
+
+ }
+
+ protected void deleteKey(String key) {
+ log.debug("Deleting entry with key '{}'.", key);
+ ConfigProperty el = em.find(ConfigProperty.class, key);
+ if (el != null)
+ em.remove(el);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.AbstractConfigurationImpl#findConfigurationId(java.lang.String)
+ */
+ @Override
+ public String[] findConfigurationId(String searchString)
+ throws ConfigurationException {
+ if (null == em) {
+ log.error("No EntityManager set!");
+ throw new ConfigurationException("No EntityManager set!");
+ }
+
+ TypedQuery<String> query = em.createQuery("select key from ConfigProperty dbconfig where dbconfig.key like :key", String.class);
+ query.setParameter("key", searchString.replace("*", "%"));
+ List<String> result = query.getResultList();
+ if (result == null)
+ return null;
+ else
+ return result.toArray(new String[result.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.AbstractConfigurationImpl#findByValue(java.lang.String)
+ */
+ @Override
+ public String[] findByValue(String searchString)
+ throws ConfigurationException {
+ if (null == em) {
+ log.error("No EntityManager set!");
+ throw new ConfigurationException("No EntityManager set!");
+ }
+
+ TypedQuery<String> query = em.createQuery("select key from ConfigProperty dbconfig where dbconfig.value like :value", String.class);
+ query.setParameter("value", searchString.replace("*", "%"));
+ List<String> result = query.getResultList();
+ return result.toArray(new String[result.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.AbstractConfigurationImpl#synchronize()
+ */
+ @Override
+ public void synchronize() throws ConfigurationException {
+ //INFO: no implementation required
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.AbstractConfigurationImpl#getName()
+ */
+ @Override
+ public String getName() {
+ return "DatabaseConfiguration";
+ }
+
+
+ private ConfigProperty getProperty(String key) {
+ log.debug("Looking for configuration property for key '{}'.", key);
+ ConfigProperty result = em.find(ConfigProperty.class, key);
+ if (result != null) {
+ log.debug("Found configuration property {}.", result);
+ } else {
+ log.debug("Unable to find configuration property for key '{}'.", key);
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.components.configuration.api.AbstractConfigurationImpl#deleteIds(java.lang.String)
+ */
+ @Override
+ @Transactional("transactionManager")
+ public void deleteIds(String idSearch) throws ConfigurationException {
+ String[] keyList = findConfigurationId(idSearch);
+ for (String el : keyList) {
+ deleteKey(el);
+
+ }
+ }
+
+// @Override
+// public String getPropertyValue(String key) {
+// ConfigProperty property = getProperty(key);
+// if (property == null) {
+// return null;
+// }
+// return property.getValue();
+// }
+//
+// @Override
+// public List<ConfigProperty> getProperties() {
+//
+// if (null == em) {
+// log.error("No EntityManager set!");
+// return null;
+// }
+//
+// log.debug("Retrieving all properties from database.");
+// TypedQuery<ConfigProperty> query = em.createQuery("select mc from ConfigProperty mc", ConfigProperty.class);
+// try {
+// List<ConfigProperty> propertiesList = query.getResultList();
+// return propertiesList;
+// } catch (NoResultException e) {
+// log.debug("No property found in database.");
+// return null;
+// }
+// }
+
+} \ No newline at end of file
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 e27bd6cd7..af5950c98 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
@@ -96,6 +96,10 @@ public class AuthenticatedSessionStore implements Serializable{
@Column(name = "pendingRequestID", nullable=true)
private String pendingRequestID = "";
+ @Column(name = "additionalInformation", nullable=true)
+ @Lob
+ private String additionalInformation;
+
@Column(name = "created", updatable=false, nullable=false)
@Temporal(TemporalType.TIMESTAMP)
private Date created;
@@ -113,11 +117,6 @@ public class AuthenticatedSessionStore implements Serializable{
@OneToMany(mappedBy="moasession", cascade=CascadeType.ALL, fetch=FetchType.EAGER)
private List<InterfederationSessionStore> inderfederation = null;
- @PrePersist
- protected void created() {
- this.updated = this.created = new Date();
- }
-
@PreUpdate
protected void lastUpdate() {
this.updated = new Date();
@@ -262,6 +261,20 @@ public class AuthenticatedSessionStore implements Serializable{
public void setInterfederatedSSOSession(boolean isInterfederatedSSOSession) {
this.isInterfederatedSSOSession = isInterfederatedSSOSession;
}
+
+ /**
+ * @return the additionalInformation
+ */
+ public String getAdditionalInformation() {
+ return additionalInformation;
+ }
+
+ /**
+ * @param additionalInformation the additionalInformation to set
+ */
+ public void setAdditionalInformation(String additionalInformation) {
+ this.additionalInformation = additionalInformation;
+ }
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/JsonMapper.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/JsonMapper.java
new file mode 100644
index 000000000..7940955e2
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/JsonMapper.java
@@ -0,0 +1,73 @@
+package at.gv.egovernment.moa.id.commons.utils;
+
+import java.io.IOException;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+
+/**
+ * Helper class to handle the JSON (de-)serialization.
+ *
+ */
+public class JsonMapper {
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ /**
+ * The default constructor where the default pretty printer is disabled.
+ */
+ public JsonMapper() {
+ this(false);
+ }
+
+ /**
+ * The constructor.
+ * @param prettyPrint enables or disables the default pretty printer
+ */
+ public JsonMapper(boolean prettyPrint) {
+ mapper.setVisibility(PropertyAccessor.ALL, Visibility.NONE);
+ mapper.setVisibility(PropertyAccessor.GETTER, Visibility.PUBLIC_ONLY);
+ mapper.setVisibility(PropertyAccessor.IS_GETTER, Visibility.PUBLIC_ONLY);
+ if (prettyPrint) {
+ mapper.enable(SerializationFeature.INDENT_OUTPUT);
+ }
+ }
+
+ /**
+ * Serialize an object to a JSON string.
+ * @param value the object to serialize
+ * @return a JSON string
+ * @throws JsonProcessingException thrown when an error occurs during serialization
+ */
+ public String serialize(Object value) throws JsonProcessingException {
+ return mapper.writeValueAsString(value);
+ }
+
+ /**
+ * Deserialize a JSON string.
+ *
+ * @param value the JSON string to deserialize
+ * @param clazz optional parameter that determines the type of the returned object. If not set, an {@link Object} is returned.
+ * @return the deserialized JSON string as an object of type {@code clazz} or {@link Object}
+ * @throws JsonParseException if the JSON string contains invalid content.
+ * @throws JsonMappingException if the input JSON structure does not match structure expected for result type
+ * @throws IOException if an I/O problem occurs (e.g. unexpected end-of-input)
+ */
+ public <T> Object deserialize(String value, Class<T> clazz) throws JsonParseException, JsonMappingException, IOException{
+
+ ObjectMapper mapper = new ObjectMapper();
+ if (clazz != null) {
+ JavaType javaType = TypeFactory.defaultInstance().constructType(clazz);
+ return mapper.readValue(value, javaType);
+ } else {
+ return mapper.readValue(value, Object.class);
+ }
+ }
+}
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
new file mode 100644
index 000000000..f20647fb0
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java
@@ -0,0 +1,230 @@
+/*
+ * 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.Set;
+
+import at.gv.egovernment.moa.util.MiscUtil;
+
+/**
+ * @author tlenz
+ *
+ */
+public class KeyValueUtils {
+
+ public static final String KEY_DELIMITER = ".";
+
+ /**
+ * 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) {
+ return findNextFreeListCounter((String[]) keySet.toArray(), listPrefix);
+ }
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/MOAHttpProtocolSocketFactory.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/MOAHttpProtocolSocketFactory.java
index 3b6fc34ea..2ade63c1c 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/MOAHttpProtocolSocketFactory.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/MOAHttpProtocolSocketFactory.java
@@ -37,7 +37,6 @@ import org.apache.commons.httpclient.ConnectTimeoutException;
import org.apache.commons.httpclient.params.HttpConnectionParams;
import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
-import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModeType;
import at.gv.egovernment.moa.id.commons.ex.MOAHttpProtocolSocketFactoryException;
import at.gv.egovernment.moa.id.commons.utils.ssl.SSLConfigurationException;
import at.gv.egovernment.moa.id.commons.utils.ssl.SSLUtils;
@@ -57,7 +56,7 @@ public class MOAHttpProtocolSocketFactory implements SecureProtocolSocketFactory
String certStoreRootDirParam,
String trustStoreURL,
String acceptedServerCertURL,
- ChainingModeType chainingMode,
+ String chainingMode,
boolean checkRevocation
) throws MOAHttpProtocolSocketFactoryException {
super();
@@ -68,7 +67,7 @@ public class MOAHttpProtocolSocketFactory implements SecureProtocolSocketFactory
certStoreRootDirParam,
trustStoreURL,
acceptedServerCertURL,
- chainingMode.value(),
+ chainingMode,
checkRevocation,
null,
null,
diff --git a/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml b/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 000000000..6325ada5f
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
+
+ <persistence-unit name="at.gv.egovernment.moa.id.commons.db.dao.config" transaction-type="RESOURCE_LOCAL">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <class>at.gv.egovernment.moa.id.commons.config.persistence.dal.SOME_CLASS</class>
+ </persistence-unit>
+
+ <persistence-unit name="config" transaction-type="RESOURCE_LOCAL">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <class>at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty</class>
+ <properties>
+ </properties>
+ </persistence-unit>
+
+</persistence> \ No newline at end of file
diff --git a/id/server/moa-id-commons/src/main/resources/config/bindings.xjb b/id/server/moa-id-commons/src/main/resources/bindings.xjb
index 21714849b..21714849b 100644
--- a/id/server/moa-id-commons/src/main/resources/config/bindings.xjb
+++ b/id/server/moa-id-commons/src/main/resources/bindings.xjb
diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_3.0.xsd
index d4686bd5e..d4686bd5e 100644
--- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
+++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_3.0.xsd
diff --git a/id/server/moa-id-commons/src/main/resources/configuration.beans.xml b/id/server/moa-id-commons/src/main/resources/configuration.beans.xml
new file mode 100644
index 000000000..775d02d05
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/resources/configuration.beans.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:aop="http://www.springframework.org/schema/aop"
+ xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
+
+ <context:annotation-config />
+
+ <!-- context:property-placeholder location="${location}"/-->
+
+<!-- <bean class="at.gv.egovernment.moa.id.commons.config.persistence.JPAPropertiesWithJavaConfig">
+ </bean> -->
+
+ <bean id="configPropertyDao"
+ class="at.gv.egovernment.moa.id.commons.db.dao.config.DatabaseConfigPropertyImpl"/>
+
+ <bean id="moaidconfig" class="at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfigurationImpl" />
+<!-- <property name="configPropertyDao" ref="configPropertyDao" />
+ </bean> -->
+
+
+<!-- <bean id="configRead" class="at.gv.egovernment.moa.id.commons.db.NewConfigurationDBRead"/> -->
+<!-- <bean id="configWrite" class="at.gv.egovernment.moa.id.commons.db.NewConfigurationDBWrite"/> -->
+
+<!-- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" lazy-init="true" destroy-method="close">
+ <aop:scoped-proxy/>
+ <property name="driverClassName" value="${hibernate.connection.driver_class}" />
+ <property name="url" value="${hibernate.connection.url}"/>
+ <property name="username" value="${hibernate.connection.username}" />
+ <property name="password" value="${hibernate.connection.password}" />
+ <property name="testOnBorrow" value="true" />
+ <property name="validationQuery" value="SELECT 1" />
+ </bean> -->
+
+
+<!-- <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+ <property name="showSql" value="true" />
+ <property name="generateDdl" value="${jpaVendorAdapter.generateDdl}" />
+ <property name="generateDdl">
+ <bean class="java.lang.Boolean">
+ <constructor-arg value="${jpaVendorAdapter.generateDdl}"/>
+ </bean>
+ </property>
+ <property name="databasePlatform" value="${hibernate.dialect}" />
+ </bean> -->
+
+
+ <bean name="config" id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+ <property name="dataSource" ref="dataSource" />
+ <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
+ <property name="persistenceUnitName" value="config" />
+ </bean>
+
+ <bean name="transactionManager" id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+ <property name="entityManagerFactory" ref="entityManagerFactory" />
+ </bean>
+ <tx:annotation-driven transaction-manager="transactionManager"/>
+
+</beans> \ No newline at end of file
diff --git a/id/server/moa-id-commons/src/main/resources/configuration.beans.xml_old b/id/server/moa-id-commons/src/main/resources/configuration.beans.xml_old
new file mode 100644
index 000000000..b3e7526d0
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/resources/configuration.beans.xml_old
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:aop="http://www.springframework.org/schema/aop"
+ xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
+
+ <tx:annotation-driven />
+ <context:annotation-config />
+
+ <context:property-placeholder location="${location}"/>
+
+
+ <bean id="configPropertyDao"
+ class="at.gv.egovernment.moa.id.commons.db.dao.config.DatabaseConfigPropertyImpl" />
+
+ <bean id="config" class="at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfigurationImpl">
+ <property name="configPropertyDao" ref="configPropertyDao" />
+ </bean>
+
+ <bean id="configRead" class="at.gv.egovernment.moa.id.commons.db.NewConfigurationDBRead"/>
+
+ <bean id="configWrite" class="at.gv.egovernment.moa.id.commons.db.NewConfigurationDBWrite"/>
+
+ <bean id="moaidauthconfig" class="at.gv.egovernment.moa.id.config.auth.PropertyBasedAuthConfigurationProvider"
+
+ <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" lazy-init="true" destroy-method="close">
+ <aop:scoped-proxy/>
+ <property name="driverClassName" value="${dataSource.driverClassName}" />
+ <property name="url" value="${dataSource.url}"/>
+ <property name="username" value="${dataSource.username}" />
+ <property name="password" value="${dataSource.password}" />
+ <property name="testOnBorrow" value="true" />
+ <property name="validationQuery" value="SELECT 1" />
+ </bean>
+
+
+ <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+ <property name="showSql" value="true" />
+ <property name="generateDdl" value="${jpaVendorAdapter.generateDdl}" />
+ <property name="databasePlatform" value="${jpaVendorAdapter.databasePlatform}" />
+ </bean>
+
+
+ <bean name="moaidconf" id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+ <property name="dataSource" ref="dataSource" />
+ <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
+ <property name="persistenceUnitName" value="config" />
+ </bean>
+
+ <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+ <property name="entityManagerFactory" ref="entityManagerFactory" />
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/id/server/moa-id-commons/src/main/resources/config/hibernate_moasession.cfg.xml b/id/server/moa-id-commons/src/main/resources/hibernate_moasession.cfg.xml
index e40c8b8a9..e40c8b8a9 100644
--- a/id/server/moa-id-commons/src/main/resources/config/hibernate_moasession.cfg.xml
+++ b/id/server/moa-id-commons/src/main/resources/hibernate_moasession.cfg.xml
diff --git a/id/server/moa-id-commons/src/main/resources/config/hibernate_statistic.cfg.xml b/id/server/moa-id-commons/src/main/resources/hibernate_statistic.cfg.xml
index aa77a9c67..aa77a9c67 100644
--- a/id/server/moa-id-commons/src/main/resources/config/hibernate_statistic.cfg.xml
+++ b/id/server/moa-id-commons/src/main/resources/hibernate_statistic.cfg.xml
diff --git a/id/server/moa-id-commons/src/main/resources/moaid.migration.beans.xml b/id/server/moa-id-commons/src/main/resources/moaid.migration.beans.xml
new file mode 100644
index 000000000..a2961b0f6
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/resources/moaid.migration.beans.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:aop="http://www.springframework.org/schema/aop"
+ xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
+
+
+<!-- <bean id="localPropertyBean" class="at.gv.egovernment.moa.id.config.webgui.MOAIDWebGUIConfiguration"
+ scope="singleton" factory-method="getInstance"/> -->
+
+ <context:property-placeholder location="${moa.id.webconfig}"/>
+
+ <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" lazy-init="true" destroy-method="close">
+ <aop:scoped-proxy/>
+ <property name="driverClassName" value="${hibernate.connection.driver_class}" />
+ <property name="url" value="${hibernate.connection.url}"/>
+ <property name="username" value="${hibernate.connection.username}" />
+ <property name="password" value="${hibernate.connection.password}" />
+ <property name="testOnBorrow" value="true" />
+ <property name="validationQuery" value="SELECT 1" />
+ </bean>
+
+
+ <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+ <property name="showSql" value="true" />
+ <property name="generateDdl" value="${jpaVendorAdapter.generateDdl}" />
+<!-- <property name="generateDdl">
+ <bean class="java.lang.Boolean">
+ <constructor-arg value="${jpaVendorAdapter.generateDdl}"/>
+ </bean>
+ </property> -->
+ <property name="databasePlatform" value="${hibernate.dialect}" />
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/id/server/moa-id-commons/src/main/resources/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/moaid_config_2.0.xsd
new file mode 100644
index 000000000..d4686bd5e
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/resources/moaid_config_2.0.xsd
@@ -0,0 +1,1057 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Mit XMLSpy v2013 sp1 (http://www.altova.com) von Thomas Lenz (Graz University of Technology IAIK) bearbeitet -->
+<xsd:schema xmlns="http://www.buergerkarte.at/namespaces/moaconfig#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:hj="http://hyperjaxb3.jvnet.org/ejb/schemas/customizations" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" targetNamespace="http://www.buergerkarte.at/namespaces/moaconfig#" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0.0" jaxb:extensionBindingPrefixes="xjc hj" jaxb:version="2.0">
+ <xsd:complexType name="OnlineApplication">
+ <xsd:complexContent>
+ <xsd:extension base="OnlineApplicationType">
+ <xsd:attribute name="publicURLPrefix" type="xsd:anyURI" use="required"/>
+ <xsd:attribute name="keyBoxIdentifier" type="MOAKeyBoxSelector" use="optional" default="SecureSignatureKeypair"/>
+ <xsd:attribute name="type" use="optional" default="publicService">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="businessService"/>
+ <xsd:enumeration value="publicService"/>
+ <xsd:enumeration value="storkService"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="calculateHPI" type="xsd:boolean" use="optional" default="false"/>
+ <xsd:attribute name="friendlyName" type="xsd:string" use="optional"/>
+ <xsd:attribute name="target" type="xsd:string" use="optional"/>
+ <xsd:attribute name="targetFriendlyName" type="xsd:string" use="optional"/>
+ <xsd:attribute name="storkSPTargetCountry" type="xsd:string" use="optional"/>
+ <xsd:attribute name="removeBPKFromAuthBlock" type="xsd:boolean" use="optional" default="false"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:element name="Configuration">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="LoginType" type="LoginType" default="stateful"/>
+ <xsd:element name="Binding" minOccurs="0">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="full"/>
+ <xsd:enumeration value="userName"/>
+ <xsd:enumeration value="none"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:choice>
+ <xsd:element ref="ParamAuth"/>
+ <xsd:element ref="BasicAuth"/>
+ <xsd:element ref="HeaderAuth"/>
+ </xsd:choice>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <!-- ### Identification elements ### -->
+ <xsd:complexType name="AbstractSimpleIdentificationType">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string"/>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:element name="AbstractSimpleIdentification" type="AttributeProviderPlugin">
+ <xsd:annotation>
+ <xsd:documentation>possibility to include common austrian primary
+ keys in human readable way, english translation not available
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <!-- ### DSIG imports ### -->
+ <xsd:complexType name="X509IssuerSerialType">
+ <xsd:sequence>
+ <xsd:element name="X509IssuerName" type="xsd:string"/>
+ <xsd:element name="X509SerialNumber" type="xsd:integer"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <!-- ### Imported STORK resources ### -->
+ <xsd:simpleType name="QualityAuthenticationAssuranceLevelType">
+ <xsd:restriction base="xsd:integer">
+ <xsd:minInclusive value="1"/>
+ <xsd:maxInclusive value="4"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:element name="QualityAuthenticationAssuranceLevel" type="QualityAuthenticationAssuranceLevelType"/>
+ <xsd:element name="AttributeValue" type="xsd:anyType"/>
+ <xsd:simpleType name="CountryCodeType">
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="[A-Z]{2}"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="StorkAttribute">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="mandatory" type="xsd:boolean"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:simpleType name="LoginType">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="stateless"/>
+ <xsd:enumeration value="stateful"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:element name="ParamAuth">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Parameter" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="Parameter">
+ <xsd:complexType>
+ <xsd:attribute name="Name" type="xsd:token" use="required"/>
+ <xsd:attribute name="Value" type="MOAAuthDataType" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="BasicAuth">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="UserID" type="MOAAuthDataType"/>
+ <xsd:element name="Password" type="MOAAuthDataType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="HeaderAuth">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Header" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="Header">
+ <xsd:complexType>
+ <xsd:attribute name="Name" type="xsd:token" use="required"/>
+ <xsd:attribute name="Value" type="MOAAuthDataType" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:simpleType name="MOAAuthDataType">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="MOAGivenName"/>
+ <xsd:enumeration value="MOAFamilyName"/>
+ <xsd:enumeration value="MOADateOfBirth"/>
+ <xsd:enumeration value="MOABPK"/>
+ <xsd:enumeration value="MOAWBPK"/>
+ <xsd:enumeration value="MOAPublicAuthority"/>
+ <xsd:enumeration value="MOABKZ"/>
+ <xsd:enumeration value="MOAQualifiedCertificate"/>
+ <xsd:enumeration value="MOAStammzahl"/>
+ <xsd:enumeration value="MOAIdentificationValueType"/>
+ <xsd:enumeration value="MOAIPAddress"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="MOAKeyBoxSelector">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="SecureSignatureKeypair"/>
+ <xsd:enumeration value="CertifiedKeypair"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <!--Konfiguration für Authentisierungs- und Proxy-Komponente und Online-Applikation -->
+ <xsd:element name="MOA-IDConfiguration">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="AuthComponent_General" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>enthält Parameter der
+ Authentisierungs-Komponente
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="AuthComponentType"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OnlineApplication" type="OnlineApplication" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>enthält Parameter für die OA
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="ChainingModes" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>spezifiziert den Algorithmus ("pkix" oder
+ "chaining") für die Zertifikatspfadvalidierung
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="TrustAnchor">
+ <xsd:annotation>
+ <xsd:documentation>ein vom SystemDefaultMode abweichender
+ ChiningMode kann für jeden TrustAnchor gesetzt werden
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="X509IssuerSerialType">
+ <xsd:attribute name="mode" type="ChainingModeType" use="required"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="systemDefaultMode" type="ChainingModeType" use="optional" default="pkix"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="TrustedCACertificates" type="xsd:anyURI" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>verweist auf ein Verzeichnis, das
+ vertrauenswürdige CA (Zwischen-CA, Wurzel-CA) Zertifikate
+ enthält.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="GenericConfiguration" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:attribute name="name" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="DirectoryCertStoreParameters.RootDir"/>
+ <xsd:enumeration value="AuthenticationSession.TimeOut"/>
+ <xsd:enumeration value="AuthenticationData.TimeOut"/>
+ <xsd:enumeration value="TrustManager.RevocationChecking"/>
+ <xsd:enumeration value="FrontendServlets.EnableHTTPConnection"/>
+ <xsd:enumeration value="FrontendServlets.DataURLPrefix"/>
+ <xsd:enumeration value="AuthenticationServer.KeepAssertion"/>
+ <xsd:enumeration value="AuthenticationServer.WriteAssertionToFile"/>
+ <xsd:enumeration value="AuthenticationServer.SourceID"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="value" type="xsd:string" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="DefaultBKUs">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="OnlineBKU" type="xsd:anyURI" minOccurs="0"/>
+ <xsd:element name="HandyBKU" type="xsd:anyURI"/>
+ <xsd:element name="LocalBKU" type="xsd:anyURI"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SLRequestTemplates">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="OnlineBKU" type="xsd:anyURI"/>
+ <xsd:element name="HandyBKU" type="xsd:anyURI"/>
+ <xsd:element name="LocalBKU" type="xsd:anyURI"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="timestamp" type="xsd:dateTime"/>
+ <xsd:attribute name="pvp2refresh" type="xsd:dateTime"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="AuthComponentType">
+ <xsd:sequence>
+ <xsd:element ref="GeneralConfiguration"/>
+ <xsd:element name="Protocols">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="SAML1" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="SourceID" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="isActive" type="xsd:boolean" default="false"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="PVP2" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="PublicURLPrefix" type="xsd:anyURI" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="IssuerName" type="xsd:anyURI" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="Organization">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="DisplayName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="URL" type="xsd:anyURI" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element ref="Contact" minOccurs="1" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="isActive" type="xsd:boolean" default="true"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OAuth" minOccurs="0">
+ <xsd:complexType>
+ <xsd:attribute name="isActive" type="xsd:boolean" default="true"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="LegacyAllowed">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ProtocolName" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SSO">
+ <xsd:complexType>
+ <xsd:choice>
+ <xsd:element name="target" type="xsd:string"/>
+ <xsd:element ref="IdentificationNumber" minOccurs="1"/>
+ </xsd:choice>
+ <xsd:attribute name="PublicURL" type="xsd:string"/>
+ <xsd:attribute name="FriendlyName" type="xsd:string"/>
+ <xsd:attribute name="SpecialText" type="xsd:string"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SecurityLayer">
+ <xsd:annotation>
+ <xsd:documentation>enthält Parameter für die Kommunikation mit dem
+ Security-Layer
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="TransformsInfo" type="TransformsInfoType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="MOA-SP">
+ <xsd:annotation>
+ <xsd:documentation>enthaelt Konfiguratiosnparameter für die
+ Kommunikation mit dem MOA SP Modul
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ConnectionParameter" type="ConnectionParameterClientAuthType" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>enthält Parameter für die SOAP-Verbindung von
+ der AUTH-Komponente zu MOA-SP; das Attribut URL enthält den
+ Endpunkt des Server; wird das Schema "https" verwendet müssen
+ die Kind-Elemente angegeben werden; wird das Schema "http"
+ verwendet dürfen keine Kind-Elemente angegeben werden; wird das
+ Element nicht verwendet dann wird MOA-SP über das API
+ aufgerufen
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="VerifyIdentityLink">
+ <xsd:annotation>
+ <xsd:documentation>enthält Parameter für die Überprüfung der
+ Personenbindung
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="TrustProfileID"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="VerifyAuthBlock">
+ <xsd:annotation>
+ <xsd:documentation>enthält Parameter für die Überprüfung des
+ AUTH-Blocks
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="TrustProfileID"/>
+ <xsd:element name="VerifyTransformsInfoProfileID" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="IdentityLinkSigners" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>enthält Informationen über akzeptierte Signers
+ des IdentityLinks
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="X509SubjectName" type="xsd:string" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>akzeptierte Signer des IdentityLinks werden
+ per X509SubjectName (Kodierung nach RFC 2253) identifiziert
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ForeignIdentities" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ConnectionParameter" type="ConnectionParameterClientAuthType">
+ <xsd:annotation>
+ <xsd:documentation>Verbindungsparameter zum SZR-Gateway
+ (GetIdentityLink)
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element ref="STORK" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>Verbindungsparameter zu den Country-PEPS
+ (C-PEPS)
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OnlineMandates" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="ConnectionParameter" type="ConnectionParameterClientAuthType">
+ <xsd:annotation>
+ <xsd:documentation>Verbindungsparameter zum
+ Online-Vollmachten-Service
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="TransformsInfoType">
+ <xsd:annotation>
+ <xsd:documentation>das Attribut filename verweist auf eine Datei mit
+ globalem Element TransformsInfo vom Typ sl10:TransformsInfo; diese
+ TransformsInfo werden in den CreateXMLSignatureRequest fuer die
+ Signatur des AUTH-Blocks inkludiert
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="transformation" type="xsd:base64Binary" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="filename" type="xsd:anyURI" use="required"/>
+ </xsd:complexType>
+ <xsd:complexType name="TemplatesType">
+ <xsd:sequence>
+ <xsd:element name="Template" type="TemplateType" minOccurs="0" maxOccurs="3"/>
+ <xsd:element name="AditionalAuthBlockText" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="BKUSelectionCustomization" type="BKUSelectionCustomizationType" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="BKUSelectionTemplate" type="TransformsInfoType" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="SendAssertionTemplate" type="TransformsInfoType" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="TemplateType">
+ <xsd:annotation>
+ <xsd:documentation>das Attribut URL spezifiziert die Lage des
+ Templates
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="URL" type="xsd:anyURI" use="required"/>
+ </xsd:complexType>
+ <xsd:complexType name="VerifyInfoboxesType">
+ <xsd:annotation>
+ <xsd:documentation>Verifikation zusaetzlicher Infoboxen
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="DefaultTrustProfile" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>Optionales DefaultTrustprofil für die
+ Überprüfung aller weiteren Infoboxen
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="TrustProfileID"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="SchemaLocationType">
+ <xsd:annotation>
+ <xsd:documentation>Spezifiziert die Lage von XML Schemas
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="Schema" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:attribute name="namespace" type="xsd:anyURI" use="required"/>
+ <xsd:attribute name="schemaLocation" type="xsd:anyURI" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="InterfederationGatewayType">
+ <xsd:sequence>
+ <xsd:element name="forwardIDPIdentifier" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="forwardProtocolIdentifer" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="InterfederationIDPType">
+ <xsd:sequence>
+ <xsd:element name="attributeQueryURL" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="storeSSOSession" type="xsd:boolean" default="true" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="performPassivRequest" type="xsd:boolean" default="true" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="performLocalAuthenticationOnError" type="xsd:boolean" default="true" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="inboundSSO" type="xsd:boolean" default="true"/>
+ <xsd:attribute name="outboundSSO" type="xsd:boolean" default="true"/>
+ </xsd:complexType>
+ <xsd:complexType name="OnlineApplicationType">
+ <xsd:sequence>
+ <xsd:element name="isNew" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <hj:ignored/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="isActive" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="isAdminRequired" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isInterfederationIDP" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="InterfederationIDP" type="InterfederationIDPType" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isInterfederationGateway" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="InterfederationGateway" type="InterfederationGatewayType" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="AuthComponent_OA" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>enthält Parameter über die OA, die die
+ Authentisierungs-Komponente betreffen
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="BKUURLS">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="OnlineBKU" type="xsd:anyURI" minOccurs="1"/>
+ <xsd:element name="HandyBKU" type="xsd:anyURI" minOccurs="1"/>
+ <xsd:element name="LocalBKU" type="xsd:anyURI" minOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element ref="IdentificationNumber" minOccurs="0"/>
+ <xsd:element name="Templates" type="TemplatesType" minOccurs="0"/>
+ <xsd:element name="TransformsInfo" type="TransformsInfoType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="Mandates" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Profiles" type="xsd:string"/>
+ <xsd:element name="ProfileName" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="testCredentials" minOccurs="0" maxOccurs="1">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="credentialOID" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="enableTestCredentials" type="xsd:boolean" default="false"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element ref="OA_STORK" minOccurs="0"/>
+ <xsd:element name="OA_SSO" minOccurs="0">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="UseSSO" type="xsd:boolean"/>
+ <xsd:element name="AuthDataFrame" type="xsd:boolean" default="true"/>
+ <xsd:element name="SingleLogOutURL" type="xsd:anyURI"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element ref="OA_SAML1" minOccurs="0"/>
+ <xsd:element ref="OA_PVP2" minOccurs="0"/>
+ <xsd:element ref="OA_OAUTH20" minOccurs="0"/>
+ <xsd:element ref="EncBPKInformation" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ <!--xsd:element ref="pr:AbstractSimpleIdentification" minOccurs="0"
+ maxOccurs="1"/ -->
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="EncBPKInformation">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="bPKDecryption" minOccurs="0" maxOccurs="1">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="keyInformation" type="xsd:base64Binary" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="iv" type="xsd:base64Binary" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="keyStoreFileName" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="keyAlias" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="bPKEncryption" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="publicKey" type="xsd:base64Binary" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="target" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="vkz" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="ConnectionParameterServerAuthType">
+ <xsd:sequence>
+ <xsd:element name="AcceptedServerCertificates" type="xsd:anyURI" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>URL zu einem Verzeichnis, das akzeptierte
+ Server-Zertifikate der TLS-Verbindung enthält (keine
+ CA-Zertifikate)
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="URL" type="xsd:anyURI" use="required"/>
+ </xsd:complexType>
+ <xsd:complexType name="ConnectionParameterClientAuthType">
+ <xsd:complexContent>
+ <xsd:extension base="ConnectionParameterServerAuthType">
+ <xsd:sequence>
+ <xsd:element name="ClientKeyStore" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>URL zu einem KeyStore, der den privaten
+ Schlüssel, der für die TLS-Client-Authentisierung verwendet
+ wird, enthält
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:anyURI">
+ <xsd:attribute name="password" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:element name="TrustProfileID" type="xsd:string"/>
+ <xsd:simpleType name="ChainingModeType">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="chaining"/>
+ <xsd:enumeration value="pkix"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="BKUSelectionType">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="HTMLComplete"/>
+ <xsd:enumeration value="HTMLSelect"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:element name="CompatibilityMode" default="false">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:boolean"/>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="EnableInfoboxValidator" default="true">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:boolean"/>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="AlwaysShowForm" default="false">
+ <xsd:annotation>
+ <xsd:documentation>Soll nicht nur bei leerer oder standardisierter
+ Vollmacht mit unvollständigen Daten, sondern beispielsweise zu
+ Kontrollzwecken das Eingabeformular immer angezeigt werden, wenn ein
+ Einschreiten durch berufliche Parteienvertretung geschieht so kann
+ dies mittels dieses Schalters veranlasst werden
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:boolean"/>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:complexType name="InputProcessorType">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="template" type="xsd:anyURI" use="optional">
+ <xsd:annotation>
+ <xsd:documentation>Das Attribut spezifiziert die Lage des
+ Templates, welches der InputProcessor zur Darstellung des
+ Eingabeformulars nutzen soll
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ <xsd:complexType name="PartyRepresentationType">
+ <xsd:sequence>
+ <xsd:element name="InputProcessor" type="InputProcessorType" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>Default InputProcessor. Konfiguration eines vom
+ Standardprozess abweichenden Verarbeitungsvorgangs bei der
+ beruflichen Parteienvertretung. Der Wert dieses Elements ist der
+ vollständige Klassenname des InputProzessors
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element ref="AlwaysShowForm" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>Default Wert fuer Formularanzeige. Soll nicht nur
+ bei leerer oder standardisierter Vollmacht mit unvollstaendigen
+ Daten, sondern beispielsweise zu Kontrollzwecken das
+ Eingabeformular zur vervollstaendigung der Vertretenendaten immer
+ angezeigt werden, wenn ein Einschreiten durch berufliche
+ Parteienvertretung geschieht so kann dies mittels dieses Schalters
+ veranlasst werden
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="ConnectionParameter" type="ConnectionParameterClientAuthType" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>Default Verbindungsparameter zum SZR-Gateway
+ (für den EGIZ-Demonstrator im internen Netzwerk:
+ https://129.27.142.5:8443/szr-gateway/services/MandateCreation)
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="PartyRepresentative" type="PartyRepresentativeType" minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>Falls keine speziellen beruflichen
+ ParteienvertreterInnen definiert sind (Element kommt nicht vor),
+ werden ausschließlich standardisierte Vollmachten mit einer
+ MandateID="*" akzeptiert
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="PartyRepresentativeType">
+ <xsd:sequence>
+ <xsd:element name="InputProcessor" type="InputProcessorType" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>Konfiguration eines vom Standardprozess
+ abweichenden Verarbeitungsvorgangs bei der beruflichen
+ Parteienvertretung. Der Wert dieses Elements ist der vollständige
+ Klassenname des InputProzessors
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element ref="AlwaysShowForm" minOccurs="0"/>
+ <xsd:element name="ConnectionParameter" type="ConnectionParameterClientAuthType" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>Optionale Verbindungsparameter zu speziellem
+ (SZR-)Gateway
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="oid" use="required">
+ <xsd:annotation>
+ <xsd:documentation>OID der Parteienvertretung lt. "Object Identifier
+ der öffentlichen Verwaltung" - Konvention, Empfehlung. Diese ID
+ muss mit der MandateID der übermittelten standardisierten Vollmacht
+ übereinstimmen. Eine Parteienvertretung für standardisierte
+ Vollmachten mit der MandateID "*" muss nicht definiert werden und
+ erlaubt eine allgemeine berufliche Parteienvertretung mit
+ Standardtexten. In anderen Fällen ist eine erlaubte OID mitttels
+ dieses Attributs zu definieren
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="representPhysicalParty" use="optional" default="false">
+ <xsd:annotation>
+ <xsd:documentation>Legt fest, ob berufliche Parteienvertretung für
+ natürliche Personen erlaubt ist
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:boolean"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="representCorporateParty" use="optional" default="false">
+ <xsd:annotation>
+ <xsd:documentation>Legt fest, ob berufliche Parteienvertretung für
+ juristische Personen erlaubt ist (welche z.B. ein Organwalter nicht
+ vertreten darf und dieser Wert aus diesem Grund dort false sein
+ muss)
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:boolean"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="representationText" use="optional">
+ <xsd:annotation>
+ <xsd:documentation>Beschreibender Text, der an Stelle des
+ Standardtexts bei der Signatur der Anmeldedaten im Falle einer
+ vorliegenden beruflichen Parteienvertretung zur Signatur vorgelegt
+ wird
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:complexType>
+ <xsd:complexType name="SignatureCreationParameterType">
+ <xsd:annotation>
+ <xsd:documentation>Enthaelt Informationen zu einem KeyStore bzw. Key
+ zur STORK SAML AuthnRequest Signaturerstellung
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element ref="KeyStore"/>
+ <xsd:element ref="KeyName"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="SignatureVerificationParameterType">
+ <xsd:annotation>
+ <xsd:documentation>Enthaelt Informationen zur Verfikation von
+ Signaturen einer STORK SAML Response
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element ref="TrustProfileID"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="SAMLSigningParameter">
+ <xsd:annotation>
+ <xsd:documentation>Enthält Informationen zur Erstellung und
+ Verifikation von STORK SAML Messages
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="SignatureCreationParameter" type="SignatureCreationParameterType"/>
+ <xsd:element name="SignatureVerificationParameter" type="SignatureVerificationParameterType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="KeyStore">
+ <xsd:annotation>
+ <xsd:documentation>URL zu einem KeyStore, der den privaten Schlüssel
+ zum Erstellen einer Signatur enthält
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:anyURI">
+ <xsd:attribute name="password" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="KeyName">
+ <xsd:annotation>
+ <xsd:documentation>Name zum Key eines KeyStores, der den privaten
+ Schlüssel zum Erstellen einer Signatur darstellt
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="password" type="xsd:string" use="optional"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="C-PEPS">
+ <xsd:annotation>
+ <xsd:documentation>Enthält Informationen zu einem Citizen Country
+ PEPS (C-PEPS)
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="AttributeValue" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="OA_STORK" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="countryCode" type="CountryCodeType" use="required"/>
+ <xsd:attribute name="URL" type="xsd:anyURI" use="required"/>
+ <xsd:attribute name="supportsXMLSignature" type="xsd:boolean" default="true"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="STORK">
+ <xsd:annotation>
+ <xsd:documentation>Contains STORK related information
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:choice>
+ <xsd:sequence>
+ <xsd:element ref="C-PEPS" maxOccurs="unbounded"/>
+ <xsd:element ref="SAMLSigningParameter"/>
+ </xsd:sequence>
+ <xsd:sequence>
+ <xsd:element ref="QualityAuthenticationAssuranceLevel" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:sequence>
+ <xsd:element ref="Attributes" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OA_SAML1">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="isActive" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="provideStammzahl" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="provideAUTHBlock" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="provideIdentityLink" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="provideCertificate" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="provideFullMandatorData" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="useCondition" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="conditionLength" type="xsd:integer" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="sourceID" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="provideAllErrors" type="xsd:boolean" default="true" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OA_PVP2">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="metadataURL" type="xsd:anyURI" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="certificate" type="xsd:base64Binary" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="updateRequired" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="GeneralConfiguration">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="TimeOuts">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Assertion" type="xsd:integer" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="MOASessionCreated" type="xsd:integer" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="MOASessionUpdated" type="xsd:integer" minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="AlternativeSourceID" type="xsd:string"/>
+ <xsd:element name="CertStoreDirectory" type="xsd:anyURI"/>
+ <xsd:element name="TrustManagerRevocationChecking" type="xsd:boolean" default="true"/>
+ <xsd:element name="PublicURLPreFix" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OA_OAUTH20">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="oAuthClientId" type="xsd:string"/>
+ <xsd:element name="oAuthClientSecret" type="xsd:string"/>
+ <xsd:element name="oAuthRedirectUri" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="IdentificationNumber">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Type" type="xsd:string"/>
+ <xsd:element name="Value" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="OA_STORK">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="StorkLogonEnabled" type="xsd:boolean" default="true"/>
+ <xsd:element ref="Qaa" minOccurs="0" maxOccurs="1"/>
+ <xsd:element ref="OAAttributes" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="VidpEnabled" type="xsd:boolean" default="false"/>
+ <xsd:element ref="AttributeProviders" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="requireConsent" type="xsd:boolean" default="true"/>
+ <xsd:element ref="C-PEPS" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="Contact">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="SurName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="GivenName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="Mail" type="xsd:string" minOccurs="1" maxOccurs="unbounded"/>
+ <xsd:element name="Type" minOccurs="1" maxOccurs="1">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="technical"/>
+ <xsd:enumeration value="support"/>
+ <xsd:enumeration value="administrative"/>
+ <xsd:enumeration value="billing"/>
+ <xsd:enumeration value="other"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="Company" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="Phone" type="xsd:string" minOccurs="1" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="UserDatabase">
+ <xsd:sequence>
+ <xsd:element name="bpk" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="familyname" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="givenname" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="institut" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="mail" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="phone" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="username" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="password" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="password_salt" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="userRequestTokken" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isActive" type="xsd:boolean" default="true" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="isAdmin" type="xsd:boolean" default="true" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="isUsernamePasswordAllowed" type="xsd:boolean" default="true" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isMandateUser" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isMailAddressVerified" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isAdminRequest" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isPVP2Generated" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="lastLogin" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="OnlineApplication" type="OnlineApplication" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="onlyBusinessService" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <hj:ignored/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="businessServiceType" type="xsd:string" minOccurs="0" maxOccurs="1">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <hj:ignored/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="BKUSelectionCustomizationType">
+ <xsd:sequence>
+ <xsd:element name="FontType" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="BackGroundColor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="FrontColor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="HeaderBackGroundColor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="HeaderFrontColor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="HeaderText" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="ButtonBackGroundColor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="ButtonBackGroundColorFocus" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="ButtonFontColor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="AppletRedirectTarget" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="AppletHeight" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="AppletWidth" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="MandateLoginButton" type="xsd:boolean" default="true" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="OnlyMandateLoginAllowed" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AttributeProviderPlugin">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="url" type="xsd:anyURI"/>
+ <xsd:element name="attributes" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="AttributeProviders" type="AttributeProviderPlugin"/>
+ <xsd:element name="Attributes" type="StorkAttribute"/>
+ <xsd:element name="Qaa" type="QualityAuthenticationAssuranceLevelType"/>
+ <xsd:complexType name="OAStorkAttribute">
+ <xsd:sequence>
+ <xsd:element name="mandatory" type="xsd:boolean"/>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="OAAttributes" type="OAStorkAttribute"/>
+</xsd:schema>
diff --git a/id/server/moa-id-commons/src/main/resources/config/persistence_template.xml b/id/server/moa-id-commons/src/main/resources/persistence_template.xml
index 25092ff58..d9adc4394 100644
--- a/id/server/moa-id-commons/src/main/resources/config/persistence_template.xml
+++ b/id/server/moa-id-commons/src/main/resources/persistence_template.xml
@@ -1,7 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <persistence-unit name="##generated">
+ <!-- <persistence-unit name="##generated"> -->
+
+ <persistence-unit name="config" transaction-type="RESOURCE_LOCAL">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <class>at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty</class>
+ <properties>
+ </properties>
+ </persistence-unit>
<!-- <class>at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase</class> -->
<!-- <properties>
@@ -13,5 +20,5 @@ http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistenc
<property name="checkoutTimeout" value="1"/>
<property name="testConnectionOnCheckin" value="1" />
</properties> -->
- </persistence-unit>
+ <!-- </persistence-unit> -->
</persistence>