aboutsummaryrefslogtreecommitdiff
path: root/id
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2016-05-30 13:11:16 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2016-09-15 08:16:12 +0200
commit5d11ae1d5062c6770d4af9c573e0e1cdcb86cef2 (patch)
tree0be4666c3df0b60fe9c4adf516910915669d3ebe /id
parent85bcdb660aca73e87a3173350b66bcdef558d287 (diff)
downloadmoa-id-spss-5d11ae1d5062c6770d4af9c573e0e1cdcb86cef2.tar.gz
moa-id-spss-5d11ae1d5062c6770d4af9c573e0e1cdcb86cef2.tar.bz2
moa-id-spss-5d11ae1d5062c6770d4af9c573e0e1cdcb86cef2.zip
fix problem with MOA-ID-configuration GUI and SecurityLayer Templates in legacy mode
Diffstat (limited to 'id')
-rw-r--r--id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java26
-rw-r--r--id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesAuthenticationInformationTask.java19
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java9
3 files changed, 47 insertions, 7 deletions
diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java
index 42ef0e1e6..2bb33a9d7 100644
--- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java
+++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java
@@ -22,19 +22,19 @@
*/
package at.gv.egovernment.moa.id.config.webgui.validation;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.ServiceLoader;
import java.util.Map.Entry;
+import java.util.ServiceLoader;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import at.gv.egiz.components.configuration.api.Configuration;
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.utils.KeyValueUtils;
@@ -243,10 +243,11 @@ public class MOAIDConfigurationValidator {
groupEl.getKey(),
MOAIDConfigurationConstants.PREFIX_MOAID));
- //add or update key/value pairs from users with module or task specific information
+ //add or update key/value pairs from users with module or task specific information
+ List<String> taskDelete = new ArrayList<String>();
Map<String, String> toBeAdded = module.postProcessing(
KeyValueUtils.removePrefixFromKeys(groupEl.getValue(), groupEl.getKey()),
- deleted,
+ taskDelete,
dbconfig);
if (toBeAdded != null) {
toBeAdded = KeyValueUtils.makeKeysAbsolut(toBeAdded, groupEl.getKey(), MOAIDConfigurationConstants.PREFIX_MOAID);
@@ -261,6 +262,23 @@ public class MOAIDConfigurationValidator {
}
}
+ //make delete elements absolute
+ if (!taskDelete.isEmpty()) {
+ Iterator<String> delInterator = taskDelete.iterator();
+ while (delInterator.hasNext()) {
+ String delKey = delInterator.next();
+ if (!delKey.startsWith(MOAIDConfigurationConstants.PREFIX_MOAID)) {
+ deleted.add(groupEl.getKey() + KeyValueUtils.KEY_DELIMITER + delKey );
+
+ } else {
+ deleted.add(delKey);
+
+ }
+
+ }
+
+ }
+
}
private void keyValueClassification(Iterator<Entry<String, String>> config, Map<String, Map<String,String>> result) {
diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesAuthenticationInformationTask.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesAuthenticationInformationTask.java
index 8e8feefe0..1819c5c2b 100644
--- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesAuthenticationInformationTask.java
+++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesAuthenticationInformationTask.java
@@ -89,6 +89,25 @@ public class ServicesAuthenticationInformationTask extends AbstractTaskValidator
}
+ String isLegacyModeActive = input.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_LEGACY);
+ if (MiscUtil.isNotEmpty(isLegacyModeActive) && Boolean.parseBoolean(isLegacyModeActive)) {
+ if (!input.containsKey(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_FIRST_VALUE))
+ keysToDelete.add(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_FIRST_VALUE);
+
+ if (!input.containsKey(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_SECOND_VALUE))
+ keysToDelete.add(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_SECOND_VALUE);
+
+ if (!input.containsKey(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_THIRD_VALUE))
+ keysToDelete.add(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_THIRD_VALUE);
+
+ } else {
+ keysToDelete.add(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_FIRST_VALUE);
+ keysToDelete.add(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_SECOND_VALUE);
+ keysToDelete.add(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_THIRD_VALUE);
+
+ }
+
+
if (newConfigValues.isEmpty())
return null;
else
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 fb2ef456c..a221d30e4 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
@@ -239,17 +239,20 @@ public class ConfigurationMigrationUtils {
if (templates != null) {
List<TemplateType> templatetype = templates.getTemplate();
if (templatetype != null) {
- if (templatetype.size() > 0) {
+ if (templatetype.size() > 0 &&
+ MiscUtil.isNotEmpty(templatetype.get(0).getURL())) {
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_FIRST_VALUE, templatetype.get(0).getURL());
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_LEGACY, Boolean.TRUE.toString());
} else
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_LEGACY, Boolean.FALSE.toString());
- if (templatetype.size() > 1)
+ if (templatetype.size() > 1 &&
+ MiscUtil.isNotEmpty(templatetype.get(1).getURL()))
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_SECOND_VALUE, templatetype.get(1).getURL());
- if (templatetype.size() > 2)
+ if (templatetype.size() > 2 &&
+ MiscUtil.isNotEmpty(templatetype.get(2).getURL()))
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_TEMPLATE_THIRD_VALUE, templatetype.get(2).getURL());
}