aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java165
1 files changed, 109 insertions, 56 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 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) {