aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/at')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java198
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java2
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java3
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java2
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java9
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java15
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java751
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java119
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java18
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java32
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java2
11 files changed, 513 insertions, 638 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java
index 4ff18e938..5233aa5d8 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java
@@ -134,6 +134,17 @@ public class ConfigurationMigrationUtils {
result.put(MOAIDConfigurationConstants.SERVICE_BUSINESSSERVICE, Boolean.FALSE.toString());
+ //revisionsLog
+ if (oa.getIsRevisionsLogActive() == null)
+ result.put(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_ENABLED, Boolean.FALSE.toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_ENABLED, oa.getIsRevisionsLogActive().toString());
+
+ if (MiscUtil.isNotEmpty(oa.getEventCodes())) {
+ result.put(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_EVENTCODES, oa.getEventCodes());
+ }
+
+
//convert target
String target_full = oa.getTarget();
if (MiscUtil.isNotEmpty(target_full)) {
@@ -267,7 +278,9 @@ public class ConfigurationMigrationUtils {
EncBPKInformation bPKEncDec = oaauth.getEncBPKInformation();
if (bPKEncDec != null) {
BPKDecryption bPKDec = bPKEncDec.getBPKDecryption();
- if (bPKDec != null) {
+ if (bPKDec != null
+ && MiscUtil.isNotEmpty(bPKDec.getKeyInformation())
+ && MiscUtil.isNotEmpty(bPKDec.getIv())) {
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB, Base64Utils.encode(bPKDec.getKeyInformation()));
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV, Base64Utils.encode(bPKDec.getIv()));
@@ -297,7 +310,7 @@ public class ConfigurationMigrationUtils {
//convert interfederation configuration
InterfederationIDPType moaIDP = oa.getInterfederationIDP();
- if (moaIDP != null) {
+ if (moaIDP != null && oa.isIsInterfederationIDP() != null && oa.isIsInterfederationIDP()) {
result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_IIDP);
result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_ATTRIBUTQUERY_URL,
moaIDP.getAttributeQueryURL());
@@ -316,7 +329,7 @@ public class ConfigurationMigrationUtils {
//convert STORK <-> PVP2X gateway configuration
InterfederationGatewayType gateway = oa.getInterfederationGateway();
- if (gateway != null) {
+ if (gateway != null && oa.isIsInterfederationGateway() != null && oa.isIsInterfederationGateway()) {
result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_GATEWAY);
result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_FORWARD_IDPIDENTIFIER,
gateway.getForwardIDPIdentifier());
@@ -408,7 +421,7 @@ public class ConfigurationMigrationUtils {
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
+ "." + String.valueOf(listCounter) + "."
+ MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_ENABLED,
- Boolean.TRUE.toString());
+ Boolean.FALSE.toString());
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
+ "." + String.valueOf(listCounter) + "."
@@ -471,7 +484,7 @@ public class ConfigurationMigrationUtils {
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ "." + String.valueOf(listCounter) + "."
+ MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_REQUESTED,
- Boolean.TRUE.toString());
+ Boolean.FALSE.toString());
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ "." + String.valueOf(listCounter) + "."
@@ -707,6 +720,12 @@ public class ConfigurationMigrationUtils {
dbOA.setPublicURLPrefix(oa.get(MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER));
dbOA.setFriendlyName(oa.get(MOAIDConfigurationConstants.SERVICE_FRIENDLYNAME));
+ if (oa.containsKey(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_ENABLED)) {
+ dbOA.setIsRevisionsLogActive(Boolean.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_ENABLED)));
+ dbOA.setEventCodes(oa.get(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_EVENTCODES));
+
+ }
+
if (Boolean.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_BUSINESSSERVICE))) {
dbOA.setType(MOA_CONFIG_BUSINESSSERVICE);
@@ -714,13 +733,16 @@ public class ConfigurationMigrationUtils {
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)));
- }
+ if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE) != null &&
+ oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE) != null) {
+ 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);
@@ -735,16 +757,17 @@ public class ConfigurationMigrationUtils {
} else {
String target = oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET);
+ if (MiscUtil.isNotEmpty(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);
- 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);
+ String targetname = TargetValidator.getTargetFriendlyName(target);
+ if (MiscUtil.isNotEmpty(targetname))
+ dbOA.setTargetFriendlyName(targetname);
+ }
}
}
@@ -794,7 +817,8 @@ public class ConfigurationMigrationUtils {
//store keyBox Identifier
- dbOA.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_KEYBOXIDENTIFIER)));
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_KEYBOXIDENTIFIER)))
+ dbOA.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_KEYBOXIDENTIFIER)));
Mandates mandates = new Mandates();
if (Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_OVS_USE))) {
@@ -858,14 +882,17 @@ public class ConfigurationMigrationUtils {
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));
+ if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV) != null &&
+ oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB) != null) {
+ 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);
-
- }
+ } catch (IOException e) {
+ Logger.error("Configuration encryption FAILED.", e);
+
+ }
+ }
OASSO sso = authoa.getOASSO();
if (sso == null) {
@@ -885,10 +912,11 @@ public class ConfigurationMigrationUtils {
}
// 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))
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_MINQAALEVEL)))
+ stork.setQaa(Integer.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_MINQAALEVEL)));
+
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES))
+ && oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_VIDP))
stork.setVidpEnabled(true);
stork.setRequireConsent(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_REQUIRECONSENT)));
@@ -971,13 +999,14 @@ public class ConfigurationMigrationUtils {
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);
+// try {
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE)))
+ pvp2.setCertificate(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE).getBytes());
- }
+// } catch (IOException e) {
+// Logger.warn("Uploaded Certificate can not be parsed", e);
+//
+// }
pvp2.setMetadataURL(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_URL));
@@ -998,26 +1027,28 @@ public class ConfigurationMigrationUtils {
//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));
+// try {
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA)))
+ el1.setTransformation(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA).getBytes());
el1.setFilename(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW));
templates.setBKUSelectionTemplate(el1);
- } catch (IOException e) {
- Logger.warn("Converting BKU selection template FAILED.", e);
- }
+// } 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));
+// try {
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA)))
+ el1.setTransformation(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA).getBytes());
el1.setFilename(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW));
templates.setSendAssertionTemplate(el1);
- } catch (IOException e) {
- Logger.warn("Converting Send Assertion template FAILED.", e);
- }
+// } catch (IOException e) {
+// Logger.warn("Converting Send Assertion template FAILED.", e);
+// }
}
BKUSelectionCustomizationType bkuselectioncustom = templates.getBKUSelectionCustomization();
@@ -1050,8 +1081,8 @@ public class ConfigurationMigrationUtils {
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))
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES))
+ && oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_IIDP))
dbOA.setIsInterfederationIDP(true);
InterfederationIDPType moaIDP = dbOA.getInterfederationIDP();
@@ -1067,8 +1098,8 @@ public class ConfigurationMigrationUtils {
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))
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES))
+ && oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_GATEWAY))
dbOA.setIsInterfederationGateway(true);
InterfederationGatewayType gateway = dbOA.getInterfederationGateway();
if (gateway == null) {
@@ -1599,31 +1630,38 @@ public class ConfigurationMigrationUtils {
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);
+ if (!attrMap.containsKey(index)) {
+ 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)));
+ attr.setHjid(Long.valueOf(index));
+ 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);
+ if (!cpepsMap.containsKey(index)) {
+ 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)));
+
+ attr.setHjid(Long.valueOf(index));
+
+ cpepsMap.put(index, attr);
+ }
}
}
@@ -1686,17 +1724,17 @@ public class ConfigurationMigrationUtils {
dbauth.setSecurityLayer(seclayertrans);
}
- try {
+// 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.setTransformation(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64).getBytes());
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);
- }
+// } catch (IOException e) {
+// Logger.warn("Converting AuthBlock transformation FAILED.", e);
+// }
SLRequestTemplates slrequesttempl = dbconfig.getSLRequestTemplates();
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
index a9d8d92da..4130b2c5d 100644
--- 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
@@ -83,7 +83,7 @@ public class ConfigurationUtil {
* is thrown if problem occurred while serializing one of the
* database values
*/
- private Properties moaIdConfigToJsonProperties(MOAIDConfiguration config) throws JsonProcessingException {
+ public static Properties moaIdConfigToJsonProperties(MOAIDConfiguration config) throws JsonProcessingException {
Properties result = new Properties();
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java
index c798a525e..07c3151a2 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java
@@ -14,6 +14,7 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants {
public static final String METADATA_LIST = "__LI";
public static final String WEBGUI_EMPTY_ELEMENT = "null";
+ public static final String WEBGUI_EMPTY_ELEMENT_EMPTY = "empty";
//Basic key namespaces
public static final String PREFIX_MOAID = "moa.id";
@@ -84,9 +85,11 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants {
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_BKUSELECTION_DELETE = SERVICE_AUTH_TEMPLATES + ".bkuselection.delete";
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";
+ public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_DELETE = SERVICE_AUTH_TEMPLATES + ".sendAssertion.delete";
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";
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
index f2753c3d0..b5bc9d874 100644
--- 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
@@ -72,7 +72,7 @@ public class MOAIDConfCLI {
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_IN + " <inputfile> -"
+ CLIConstants.CLI_PARAM_OUT + " <outputfile> | -" + CLIConstants.CLI_PARAM_OUTDB + " <dbconfig> [-"
+ CLIConstants.CLI_PARAM_HELP + "]");
pOut.println();
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
index fbb1597f3..223f29a0b 100644
--- 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
@@ -19,6 +19,15 @@ public interface MOAIDConfiguration extends Configuration {
* @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, boolean removePrefix) throws ConfigurationException;
+
+ /**
+ * Get all key/value pairs with a prefix
+ *
+ * @param preFix: A key prefix
+ * @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;
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
index 20e2ba598..297c63d7d 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
@@ -49,9 +49,11 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
}
/* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration#getPropertySubset(java.lang.String)
+ * @see at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration#getPropertySubset(java.lang.String, boolean)
*/
- public Map<String, String> getPropertySubset(String preFix) throws ConfigurationException{
+ @Override
+ public Map<String, String> getPropertySubset(String preFix,
+ boolean removePrefix) throws ConfigurationException {
EntityManager em = this.getPersistenceContext();
if (null == em) {
Logger.error("No EntityManager set!");
@@ -72,8 +74,15 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
//build key/value configuration map from database entries
Map<String, String> result = getKeyValueFromDatabaseDAO(
- configResult.iterator(), preFix, true);
+ configResult.iterator(), preFix, removePrefix);
return result;
+ }
+
+ /* (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{
+ return getPropertySubset(preFix, true);
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
index 41c7008e9..4a90d1bce 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java
@@ -1,450 +1,301 @@
-//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;
-// }
-//
-//}
+package at.gv.egovernment.moa.id.commons.db;
+
+import java.util.ArrayList;
+import java.util.Collections;
+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.ConfigurationMigrationUtils;
+import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants;
+import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration;
+import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication;
+
+import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
+import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils;
+import at.gv.egovernment.moa.logging.Logger;
+
+/**
+ *
+ *
+ */
+public class NewConfigurationDBRead {
+
+ private MOAIDConfiguration conf;
+
+ @Autowired(required = true)
+ public void setConfiguration(MOAIDConfiguration conf) {
+ // https://jira.spring.io/browse/SPR-3845
+ this.conf = conf;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T extends Iterable<?>> T nullGuard(T item) {
+ if (item == null) {
+ return (T) Collections.emptyList();
+ } else {
+ return item;
+ }
+
+ }
+
+ public 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 List<OnlineApplication> getAllOnlineApplications() {
+ Logger.trace("Get All OnlineApplications from database.");
+
+ List<OnlineApplication> result = new ArrayList<OnlineApplication>();
+ try {
+ String[] allUniqueOAIDs = conf.findConfigurationId(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES + ".*." + MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER);
+ if (allUniqueOAIDs != null) {
+ for (String uniqueOAID : allUniqueOAIDs) {
+ String oaKeyId = KeyValueUtils.getParentKey(uniqueOAID);
+
+ Logger.debug("Search service with KeyPrefix:" + oaKeyId);
+ Map<String, String> oaKeyValuePairs = conf.getPropertySubset(oaKeyId, true);
+
+ String serviceType = KeyValueUtils.getFirstChildAfterPrefix(oaKeyId, MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES);
+ Logger.debug("Identify Service as: " + serviceType);
+
+ if (oaKeyValuePairs != null) {
+ Logger.debug("Transform Key/Value to JaxB configuration ...");
+ oaKeyValuePairs.put(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES, serviceType);
+ OnlineApplication jaxBOA = ConfigurationMigrationUtils.convertKeyValueToHyberJaxBOnlineApplication(oaKeyValuePairs);
+
+ String hjID = KeyValueUtils.getFirstChildAfterPrefix(oaKeyId, KeyValueUtils.getParentKey(oaKeyId));
+ if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_GATEWAY))
+ jaxBOA.setHjid(Long.valueOf(hjID) + 1000000);
+ else if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_IIDP))
+ jaxBOA.setHjid(Long.valueOf(hjID) + 2000000);
+ else if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_VIDP))
+ jaxBOA.setHjid(Long.valueOf(hjID) + 3000000);
+ else
+ jaxBOA.setHjid(Long.valueOf(hjID));
+
+ Logger.debug("Transformation finished with JaxB hjID: " + hjID);
+ result.add(jaxBOA);
+
+ } else
+ Logger.info("No Service configuration with KeyPrefix: " + oaKeyId);
+ }
+ }
+ if (!result.isEmpty())
+ return result;
+
+ } catch (ConfigurationException e) {
+ Logger.error("Access configuration FAILED.", e);
+
+ }
+
+ return null;
+
+ }
+
+ /**
+ *
+ * @return
+ */
+ public 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 at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration getMOAIDConfiguration() {
+ Logger.trace("Load MOAID Configuration from database.");
+ Map<String, String> generalConfig;
+ try {
+ generalConfig = conf.getPropertySubset(MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL, false);
+ if (generalConfig != null) {
+ Logger.debug("Key/Value configuration found -> Start mapping process ...");
+
+ at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration result =
+ ConfigurationMigrationUtils.convertKeyValueToHyberJaxBMOAIDConfiguration(generalConfig);
+ Logger.debug("Configuration mapping process finished.");
+
+ return result;
+
+ }
+
+ } catch (ConfigurationException e) {
+ Logger.error("Configuration access FAILED!", e);
+ }
+
+ Logger.info("No general MOA-ID configuration found!");
+ return null;
+
+ }
+
+ /**
+ *
+ * @return
+ */
+ public 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 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 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 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(0, 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 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 (oa.getFriendlyName().contains(id)) {
+ result.add(oa);
+ }
+ }
+
+ 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/NewConfigurationDBWrite.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java
index a2b1f120e..ccc7f33f1 100644
--- 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
@@ -8,13 +8,14 @@
//
//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.deprecated.AuthComponentGeneral;
+//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.ChainingModes;
+//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.DefaultBKUs;
+//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.GenericConfiguration;
+//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication;
+//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.SLRequestTemplates;
//import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
+//import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
//
///**
// * This class is used for writing to the key-value database.
@@ -30,108 +31,22 @@
// 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.
+// * @param user
// */
-// 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;
+// public void saveOrUpdate(UserDatabase user) throws MOADatabaseException{
+// // TODO Auto-generated method stub
+//
// }
//
// /**
-// * Deletes the object associated with the given key.
-// * @param key the key
+// * @param dbuser
// */
-// public static void delete(String key) {
-// conf.set(key, null);
+// public void delete(UserDatabase dbuser) {
+// // TODO Auto-generated method stub
+//
// }
//
//}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java
index 4807a81b3..696d7ac6d 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java
@@ -190,7 +190,25 @@ public class MOAIDConfiguration
@XmlAttribute(name = "Hjid")
protected Long hjid;
+ protected String eventCodes = null;
+
+
+
/**
+ * @return the eventCodes
+ */
+ public String getEventCodes() {
+ return eventCodes;
+ }
+
+ /**
+ * @param eventCodes the eventCodes to set
+ */
+ public void setEventCodes(String eventCodes) {
+ this.eventCodes = eventCodes;
+ }
+
+ /**
* Gets the value of the authComponentGeneral property.
*
* @return
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java
index 1beb8868e..79cdcacf5 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java
@@ -100,7 +100,39 @@ public class OnlineApplication
@XmlSchemaType(name = "boolean")
protected Boolean removeBPKFromAuthBlock;
+ protected Boolean isRevisionsLogActive = false;
+ protected String eventCodes = null;
+
+
/**
+ * @return the isRevisionsLogActive
+ */
+ public Boolean getIsRevisionsLogActive() {
+ return isRevisionsLogActive;
+ }
+
+ /**
+ * @param isRevisionsLogActive the isRevisionsLogActive to set
+ */
+ public void setIsRevisionsLogActive(Boolean isRevisionsLogActive) {
+ this.isRevisionsLogActive = isRevisionsLogActive;
+ }
+
+ /**
+ * @return the eventCodes
+ */
+ public String getEventCodes() {
+ return eventCodes;
+ }
+
+ /**
+ * @param eventCodes the eventCodes to set
+ */
+ public void setEventCodes(String eventCodes) {
+ this.eventCodes = eventCodes;
+ }
+
+ /**
* Gets the value of the publicURLPrefix property.
*
* @return
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java
index 13d680b78..01ae2a354 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java
@@ -143,7 +143,7 @@ public class ValidationHelper {
long oaID = Long.valueOf(oaIDObj);
- if (oaID > 0 && oaID < Long.MAX_VALUE)
+ if (oaID >= 0 && oaID < Long.MAX_VALUE)
return true;
} catch (Throwable t) {