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/egovernment/moa/id/commons/MOAIDConstants.java1
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java165
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java4
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java12
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java110
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/MOASessionDBUtils.java10
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java9
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java35
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/TestCredentials.java40
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyAuthBlock.java21
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyIdentityLink.java18
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/TargetValidator.java5
-rw-r--r--id/server/moa-id-commons/src/main/resources/moaid.migration.beans.xml2
13 files changed, 333 insertions, 99 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java
index b97813681..a04b8f454 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java
@@ -97,7 +97,6 @@ public class MOAIDConstants {
static {
List<String> storkAttrProvider = new ArrayList<String>();
storkAttrProvider.add("StorkAttributeRequestProvider");
- storkAttrProvider.add("EHvdAttributeProvider_deprecated");
storkAttrProvider.add("EHvdAttributeProvider");
storkAttrProvider.add("SignedDocAttributeRequestProvider");
storkAttrProvider.add("MandateAttributeRequestProvider");
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 05de581d2..e819805ad 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
@@ -270,7 +270,11 @@ public class ConfigurationMigrationUtils {
}
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_OIDs, oids);
- }
+ }
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_USETESTIDLTRUSTSTORE, String.valueOf(oaauth.getTestCredentials().isUseTestIDLTrustStore()));
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_USETESTAUTHBLOCKTRUSTSTORE, String.valueOf(oaauth.getTestCredentials().isUseTestAuthBlockTrustStore()));
+
}
//convert foreign bPK
@@ -354,10 +358,16 @@ public class ConfigurationMigrationUtils {
if (config.isRequireConsent() != null)
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_REQUIRECONSENT,
config.isRequireConsent().toString());
- else
+ else {
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_REQUIRECONSENT,
Boolean.FALSE.toString());
+ result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_VIDP);
+
+ }
+ if (config.isVidpEnabled() != null && config.isVidpEnabled())
+ result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_VIDP);
+
List<AttributeProviderPlugin> attributeProviderPlugins = config.getAttributeProviders();
if (attributeProviderPlugins != null) {
for(int i=0; i<attributeProviderPlugins.size(); i++) {
@@ -728,6 +738,7 @@ public class ConfigurationMigrationUtils {
}
dbOA.setIsActive(Boolean.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_ISACTIVE)));
+ dbOA.setIsAdminRequired(false);
dbOA.setPublicURLPrefix(oa.get(MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER));
dbOA.setFriendlyName(oa.get(MOAIDConfigurationConstants.SERVICE_FRIENDLYNAME));
@@ -856,10 +867,12 @@ public class ConfigurationMigrationUtils {
}
authoa.setMandates(mandates);
- if (Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_ENABLED))) {
- TestCredentials testing = authoa.getTestCredentials();
- testing = new TestCredentials();
- authoa.setTestCredentials(testing);
+ TestCredentials testing = authoa.getTestCredentials();
+ if (Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_ENABLED))) {
+ if (testing == null) {
+ 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) {
@@ -868,15 +881,29 @@ public class ConfigurationMigrationUtils {
testing.setCredentialOID(testCredentialOIDs);
}
- } else {
- TestCredentials testing = authoa.getTestCredentials();
+ } else {
if (testing != null) {
testing.setEnableTestCredentials(false);
}
}
-
+
+ if (testing == null) {
+ testing = new TestCredentials();
+ authoa.setTestCredentials(testing);
+ }
+
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_USETESTIDLTRUSTSTORE)))
+ testing.setUseTestIDLTrustStore(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_USETESTIDLTRUSTSTORE)));
+ else
+ testing.setUseTestIDLTrustStore(false);
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_USETESTAUTHBLOCKTRUSTSTORE)))
+ testing.setUseTestAuthBlockTrustStore(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_USETESTAUTHBLOCKTRUSTSTORE)));
+ else
+ testing.setUseTestAuthBlockTrustStore(false);
+
+
EncBPKInformation bPKEncDec = authoa.getEncBPKInformation();
if (bPKEncDec == null) {
bPKEncDec = new EncBPKInformation();
@@ -1188,6 +1215,9 @@ public class ConfigurationMigrationUtils {
if (authblock != null) {
result.put(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_AUTHBLOCK_PROD,
authblock.getTrustProfileID());
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_AUTHBLOCK_TEST,
+ authblock.getTestTrustProfileID());
+
List<String> list = authblock.getVerifyTransformsInfoProfileID();
if (list.size() == 1)
@@ -1203,6 +1233,8 @@ public class ConfigurationMigrationUtils {
if (idl != null) {
result.put(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_IDL_PROD,
idl.getTrustProfileID());
+ result.put(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_IDL_TEST,
+ idl.getTestTrustProfileID());
}
}
@@ -1363,41 +1395,46 @@ public class ConfigurationMigrationUtils {
// 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()));
+ if( !(stork.getCPEPS().get(i).getURL() == null ||
+ MiscUtil.isEmpty(stork.getCPEPS().get(i).getCountryCode()) ||
+ stork.getCPEPS().get(i).getURL().endsWith("http://")) ) {
+ 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) {
+ if(null != tmp && tmp.size() > 0) {
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
+ if (MiscUtil.isNotEmpty(tmp.get(i).getName())) {
result.put(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST
+ "." + String.valueOf(i) + "."
- + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY,
- Boolean.FALSE.toString());
+ + 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());
+ }
}
}
@@ -1648,35 +1685,43 @@ public class ConfigurationMigrationUtils {
String index = KeyValueUtils.getFirstChildAfterPrefix(key, MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST);
if (!attrMap.containsKey(index)) {
StorkAttribute attr = new StorkAttribute();
- attr.setName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST
+ String attrName = 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);
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME);
+ if (MiscUtil.isNotEmpty(attrName)) {
+ attr.setName(attrName);
+ 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);
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
+
+ String countryCode = moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST
+ "." + index + "."
- + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL));
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY);
- attr.setSupportsXMLSignature(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST
+ String pepsURL = moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST
+ "." + index + "."
- + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG)));
+ + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL);
- attr.setHjid(Long.valueOf(index));
+ if (MiscUtil.isNotEmpty(countryCode) && MiscUtil.isNotEmpty(pepsURL) &&
+ !pepsURL.endsWith("http://")) {
+ attr.setCountryCode(countryCode);
+ attr.setURL(pepsURL);
+ 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);
+ }
}
}
@@ -1721,12 +1766,14 @@ public class ConfigurationMigrationUtils {
dbmoasp.setVerifyIdentityLink(moaidl);
}
moaidl.setTrustProfileID(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_IDL_PROD));
+ moaidl.setTestTrustProfileID(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_IDL_TEST));
VerifyAuthBlock moaauth = dbmoasp.getVerifyAuthBlock();
if (moaauth == null) {
moaauth = new VerifyAuthBlock();
dbmoasp.setVerifyAuthBlock(moaauth);
}
moaauth.setTrustProfileID(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_AUTHBLOCK_PROD));
+ moaauth.setTestTrustProfileID(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_AUTHBLOCK_TEST));
if (moaauth.getVerifyTransformsInfoProfileID() == null) {
moaauth.setVerifyTransformsInfoProfileID(new ArrayList<String>());
@@ -1741,11 +1788,17 @@ public class ConfigurationMigrationUtils {
}
// try {
- List<TransformsInfoType> trans = new ArrayList<TransformsInfoType>();
- TransformsInfoType elem = new TransformsInfoType();
- elem.setTransformation(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64).getBytes());
- elem.setFilename(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_NAME));
- trans.add(elem);
+ List<TransformsInfoType> trans = new ArrayList<TransformsInfoType>();
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64))) {
+ TransformsInfoType elem = new TransformsInfoType();
+ elem.setTransformation(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64).getBytes());
+ elem.setFilename(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_NAME));
+ trans.add(elem);
+
+ } else {
+ Logger.info("No AuthBlock-Transformation found.");
+
+ }
seclayertrans.setTransformsInfo(trans);
// } catch (IOException e) {
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 07c3151a2..c338c65ba 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
@@ -107,7 +107,9 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants {
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";
-
+ public static final String SERVICE_AUTH_TESTCREDENTIALS_USETESTIDLTRUSTSTORE = SERVICE_AUTH_TESTCREDENTIALS + "useTestIDLTrustStore";
+ public static final String SERVICE_AUTH_TESTCREDENTIALS_USETESTAUTHBLOCKTRUSTSTORE = SERVICE_AUTH_TESTCREDENTIALS + "useTestAuthBlockTrustStore";
+
private static final String SERVICE_AUTH_MANDATES = AUTH + "." + MANDATES;
public static final String SERVICE_AUTH_MANDATES_OVS = SERVICE_AUTH_MANDATES + ".ovs";
public static final String SERVICE_AUTH_MANDATES_OVS_USE = SERVICE_AUTH_MANDATES_OVS + ".use";
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 223f29a0b..4bd459f23 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
@@ -61,4 +61,16 @@ public interface MOAIDConfiguration extends Configuration {
* @throws ConfigurationException in case of an configuration access error
*/
public Map<String, String> getOnlineApplication(String publicURLPrefix) throws ConfigurationException;
+
+
+ /**
+ * Load an OnlineApplication configuration and remove the OA key prefix
+ * This is a backup version if direct UniqueID selection does not work
+ *
+ * @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> getOnlineApplicationBackupVersion(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
index 297c63d7d..b9b5ad611 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
@@ -1,5 +1,7 @@
package at.gv.egovernment.moa.id.commons.config.persistence;
+import java.sql.SQLSyntaxErrorException;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -131,13 +133,88 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
String keyId = MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES
+ ".%."
+ MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER;
-
+
+ List<ConfigProperty> oaSearchResult = null;
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();
+ oaSearchResult = oaSearchQuery.getResultList();
+
+ return postProcessLoadOnlineApplication(em, oaSearchResult);
+
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration#getOnlineApplicationBackupVersion(java.lang.String)
+ */
+ @Override
+ public Map<String, String> getOnlineApplicationBackupVersion(
+ String publicURLPrefix) throws ConfigurationException {
+ Logger.debug("Use backup implementation to query configuration database");
+
+ 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;
- if (oaSearchResult.size() == 0) {
+ List<ConfigProperty> oaSearchResult = new ArrayList<ConfigProperty>();
+
+ TypedQuery<ConfigProperty> oaSearchQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", ConfigProperty.class);
+ oaSearchQuery.setParameter("key", keyId);
+ List<ConfigProperty> intermResult = oaSearchQuery.getResultList();
+ if (intermResult != null) {
+ for (ConfigProperty el : intermResult) {
+ if (publicURLPrefix.startsWith(el.getValue()))
+ oaSearchResult.add(el);
+
+ }
+ }
+
+ return postProcessLoadOnlineApplication(em, oaSearchResult);
+
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Online-Application load operation post-processing
+ *
+ * @param em EntityManager for Database access
+ * @param oaSearchResult Search result of first OA selection operation
+ * @return Map of post-processed OA configuration key/value pairs
+ */
+ private Map<String, String> postProcessLoadOnlineApplication(EntityManager em, List<ConfigProperty> oaSearchResult) {
+ if (oaSearchResult == null || oaSearchResult.size() == 0) {
Logger.debug("No entries found.");
return null; }
@@ -170,31 +247,6 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
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/MOASessionDBUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/MOASessionDBUtils.java
index 76215528d..49e0634cb 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/MOASessionDBUtils.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/MOASessionDBUtils.java
@@ -163,8 +163,9 @@ public final class MOASessionDBUtils {
} catch(HibernateException e) {
Logger.warn("Error during MOASession database saveOrUpdate. Rollback.", e);
- tx.rollback();
- throw new MOADatabaseException(e);
+ if (tx != null)
+ tx.rollback();
+ throw new MOADatabaseException(e);
}
}
@@ -183,8 +184,9 @@ public final class MOASessionDBUtils {
} catch(HibernateException e) {
Logger.warn("Error during MOASession database delete. Rollback.", e);
- tx.rollback();
- return false;
+ if (tx != null)
+ 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
index 4a90d1bce..c049eebc4 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
@@ -41,9 +41,12 @@ public class NewConfigurationDBRead {
}
- public Map<String, String> getOnlineApplicationKeyValueWithId(String id) {
+ public Map<String, String> getOnlineApplicationKeyValueWithId(String id, boolean backupVersion) {
try {
- return conf.getOnlineApplication(id);
+ if (backupVersion)
+ return conf.getOnlineApplicationBackupVersion(id);
+ else
+ return conf.getOnlineApplication(id);
} catch (ConfigurationException e) {
Logger.warn("OnlineApplication with Id: " + id + " not found.", e);
@@ -78,6 +81,8 @@ public class NewConfigurationDBRead {
OnlineApplication jaxBOA = ConfigurationMigrationUtils.convertKeyValueToHyberJaxBOnlineApplication(oaKeyValuePairs);
String hjID = KeyValueUtils.getFirstChildAfterPrefix(oaKeyId, KeyValueUtils.getParentKey(oaKeyId));
+ //TODO: work-around for old configTool and new key/value configuration
+ //see BasicOAAction.java line 493
if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_GATEWAY))
jaxBOA.setHjid(Long.valueOf(hjID) + 1000000);
else if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_IIDP))
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
index f59e39ac6..aad830d65 100644
--- 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
@@ -1,6 +1,10 @@
package at.gv.egovernment.moa.id.commons.db.dao.config;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map.Entry;
+import java.util.regex.Pattern;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@@ -137,10 +141,33 @@ public class DatabaseConfigPropertyImpl extends AbstractConfigurationImpl {
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()]);
+ TypedQuery<ConfigProperty> query = em.createQuery("select * from ConfigProperty dbconfig", ConfigProperty.class);
+ List<ConfigProperty> all = query.getResultList();
+
+ searchString = searchString.replace(".", "\\.");
+ String regex = searchString.replace("*", ".*");
+ regex = regex.replace("%", "\\w*");
+ log.debug("Searching with regex: {}", regex);
+ Pattern pattern = Pattern.compile(regex);
+
+ List<String> keyList = new ArrayList<String>();
+ Iterator<ConfigProperty> keyIt;
+ if (all != null) {
+ keyIt = all.iterator();
+ while(keyIt.hasNext()) {
+ ConfigProperty entry = keyIt.next();
+ String value = entry.getValue();
+ String key = entry.getKey();
+
+ if(pattern.matcher(value).matches()) {
+ keyList.add(key);
+ }
+ }
+ }
+
+ String[] result = new String[keyList.size()];
+ return keyList.toArray(result);
+
}
/* (non-Javadoc)
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/TestCredentials.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/TestCredentials.java
index e3bd00912..2e80cb0d5 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/TestCredentials.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/TestCredentials.java
@@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.sun.tools.xjc.runtime.ZeroOneBooleanAdapter;
@@ -82,6 +83,13 @@ public class TestCredentials
protected Long hjid;
protected transient List<TestCredentialsCredentialOIDItem> credentialOIDItems;
+ @XmlTransient
+ protected boolean useTestIDLTrustStore;
+
+ @XmlTransient
+ protected boolean useTestAuthBlockTrustStore;
+
+
/**
* Gets the value of the credentialOID property.
*
@@ -203,7 +211,37 @@ public class TestCredentials
}
}
- public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
+
+
+ /**
+ * @return the useTestIDLTrustStore
+ */
+ public boolean isUseTestIDLTrustStore() {
+ return useTestIDLTrustStore;
+ }
+
+ /**
+ * @param useTestIDLTrustStore the useTestIDLTrustStore to set
+ */
+ public void setUseTestIDLTrustStore(boolean useTestIDLTrustStore) {
+ this.useTestIDLTrustStore = useTestIDLTrustStore;
+ }
+
+ /**
+ * @return the useTestAuthBlockTrustStore
+ */
+ public boolean isUseTestAuthBlockTrustStore() {
+ return useTestAuthBlockTrustStore;
+ }
+
+ /**
+ * @param useTestAuthBlockTrustStore the useTestAuthBlockTrustStore to set
+ */
+ public void setUseTestAuthBlockTrustStore(boolean useTestAuthBlockTrustStore) {
+ this.useTestAuthBlockTrustStore = useTestAuthBlockTrustStore;
+ }
+
+ public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof TestCredentials)) {
return false;
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyAuthBlock.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyAuthBlock.java
index ecfb6b701..155863b03 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyAuthBlock.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyAuthBlock.java
@@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.jvnet.hyperjaxb3.item.ItemUtils;
import org.jvnet.jaxb2_commons.lang.Equals;
@@ -80,6 +81,10 @@ public class VerifyAuthBlock
protected Long hjid;
protected transient List<VerifyAuthBlockVerifyTransformsInfoProfileIDItem> verifyTransformsInfoProfileIDItems;
+ @XmlTransient
+ protected String TestTrustProfileID;
+
+
/**
* Gets the value of the trustProfileID property.
*
@@ -106,7 +111,23 @@ public class VerifyAuthBlock
this.trustProfileID = value;
}
+
+
/**
+ * @return the testTrustProfileID
+ */
+ public String getTestTrustProfileID() {
+ return TestTrustProfileID;
+ }
+
+ /**
+ * @param testTrustProfileID the testTrustProfileID to set
+ */
+ public void setTestTrustProfileID(String testTrustProfileID) {
+ TestTrustProfileID = testTrustProfileID;
+ }
+
+ /**
* Gets the value of the verifyTransformsInfoProfileID property.
*
* <p>
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyIdentityLink.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyIdentityLink.java
index 5b54bf5f2..ac7ad96cc 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyIdentityLink.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyIdentityLink.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
@@ -68,6 +69,9 @@ public class VerifyIdentityLink
@XmlAttribute(name = "Hjid")
protected Long hjid;
+ @XmlTransient
+ protected String TestTrustProfileID;
+
/**
* Gets the value of the trustProfileID property.
*
@@ -110,6 +114,20 @@ public class VerifyIdentityLink
}
/**
+ * @return the testTrustProfileID
+ */
+ public String getTestTrustProfileID() {
+ return TestTrustProfileID;
+ }
+
+ /**
+ * @param testTrustProfileID the testTrustProfileID to set
+ */
+ public void setTestTrustProfileID(String testTrustProfileID) {
+ TestTrustProfileID = testTrustProfileID;
+ }
+
+ /**
* Sets the value of the hjid property.
*
* @param value
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/TargetValidator.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/TargetValidator.java
index f2f7afcf8..aeccfe608 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/TargetValidator.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/TargetValidator.java
@@ -88,6 +88,9 @@ public class TargetValidator {
}
public static String getTargetFriendlyName(String target) {
+ if (MiscUtil.isEmpty(target))
+ return null;
+
String name = targetList.get(target.toUpperCase());
if (MiscUtil.isNotEmpty(name))
@@ -97,6 +100,8 @@ public class TargetValidator {
}
public static boolean isValidTarget(String target) {
+ if (MiscUtil.isEmpty(target))
+ return false;
return targetList.containsKey(target.toUpperCase());
}
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
index 3bd122254..c758e230e 100644
--- 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
@@ -31,7 +31,7 @@
<property name="testOnBorrow" value="${dbcp.testOnBorrow}" />
<property name="testOnReturn" value="${dbcp.testOnReturn}" />
<property name="testWhileIdle" value="${dbcp.testWhileIdle}" />
- <property name="validationQuery" value="SELECT 1" />
+ <property name="validationQuery" value="${dbcp.validationQuery}" />
</bean>