aboutsummaryrefslogtreecommitdiff
path: root/id/moa-id-webgui/src/main/java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2016-10-21 10:13:42 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2016-10-21 10:13:42 +0200
commit87be1b91493b0b5f4a03f049dfa99f7ba3c6f35e (patch)
treec0d13564029955028694eb7924c7ea37b164ce92 /id/moa-id-webgui/src/main/java
parentf4bc3a6fb1c1b9b07b74e2254d6acb71985d8c39 (diff)
downloadmoa-id-spss-87be1b91493b0b5f4a03f049dfa99f7ba3c6f35e.tar.gz
moa-id-spss-87be1b91493b0b5f4a03f049dfa99f7ba3c6f35e.tar.bz2
moa-id-spss-87be1b91493b0b5f4a03f049dfa99f7ba3c6f35e.zip
update ConfigTool to support more than one ELGA mandate-service
Diffstat (limited to 'id/moa-id-webgui/src/main/java')
-rw-r--r--id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralMOAIDConfigurationTask.java151
-rw-r--r--id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesAuthenticationInformationTask.java32
-rw-r--r--id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolPVP2XTask.java8
3 files changed, 174 insertions, 17 deletions
diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralMOAIDConfigurationTask.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralMOAIDConfigurationTask.java
index 270d0866c..9b25f17e8 100644
--- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralMOAIDConfigurationTask.java
+++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralMOAIDConfigurationTask.java
@@ -34,6 +34,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.gv.egiz.components.configuration.api.Configuration;
+import at.gv.egiz.components.configuration.api.ConfigurationException;
import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants;
import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils;
import at.gv.egovernment.moa.id.commons.validation.ValidationHelper;
@@ -76,6 +77,7 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme
temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_REVOCATIONCHECKING, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL));
temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL));
temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL));
+ temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL));
temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_AUTHBLOCK_TEXT, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL));
temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_SERVICENAME, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL));
temp.add(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SSO_TARGET, MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL));
@@ -256,12 +258,29 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme
check = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL, getKeyPrefix()));
if (MiscUtil.isNotEmpty(check)) {
- if (!ValidationHelper.validateURL(check)) {
- log.info("Not valid Online-Mandate Service URL");
- errors.add(new ValidationObjectIdentifier(
- MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL,
- "Services - OVS",
- LanguageHelper.getErrorString("validation.general.mandateservice.valid")));
+ String[] misURLs = check.split(",");
+ for (String el : misURLs) {
+ if (MiscUtil.isNotEmpty(el) && !ValidationHelper.validateURL(StringUtils.chomp(el.trim()))) {
+ log.info("Not valid Online-Mandate Service URL");
+ errors.add(new ValidationObjectIdentifier(
+ MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL,
+ "Services - OVS",
+ LanguageHelper.getErrorString("validation.general.mandateservice.valid", new Object[]{el})));
+ }
+ }
+ }
+
+ check = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, getKeyPrefix()));
+ if (MiscUtil.isNotEmpty(check)) {
+ String[] misURLs = check.split(",");
+ for (String el : misURLs) {
+ if (MiscUtil.isNotEmpty(el) && !ValidationHelper.validateURL(StringUtils.chomp(el.trim()))) {
+ log.info("Not valid ELGA Mandate Service URL");
+ errors.add(new ValidationObjectIdentifier(
+ MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL,
+ "Services - ELGA",
+ LanguageHelper.getErrorString("validation.general.elga.mandateservice.valid", new Object[]{el})));
+ }
}
}
@@ -477,12 +496,15 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme
check = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL, getKeyPrefix()));
if (MiscUtil.isNotEmpty(check)) {
- if (!ValidationHelper.validateURL(check)) {
- log.info("SZRGW URL is not valid");
- errors.add(new ValidationObjectIdentifier(
- MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL,
- "Services - SZR-GW URL",
- LanguageHelper.getErrorString("validation.general.szrgw.url.valid")));
+ String[] szrGWServiceURLs = check.split(",");
+ for (String el : szrGWServiceURLs) {
+ if (MiscUtil.isNotEmpty(el) && !ValidationHelper.validateURL(StringUtils.chomp(el.trim()))) {
+ log.info("SZRGW URL is not valid");
+ errors.add(new ValidationObjectIdentifier(
+ MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL,
+ "Services - SZR-GW URL",
+ LanguageHelper.getErrorString("validation.general.szrgw.url.valid", new Object[]{el})));
+ }
}
}
@@ -618,6 +640,111 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme
}
+ //normalize CSV of ELGA mandate-service URLs
+ try {
+ String elgaServiceURLs = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, getKeyPrefix()));
+ List<String> currentElgaServiceURLs = KeyValueUtils.getListOfCSVValues(dbconfig.getStringValue(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL));
+
+ if (MiscUtil.isNotEmpty(elgaServiceURLs)) {
+ String normalizedElgaServiceURLs = KeyValueUtils.normalizeCSVValueString(elgaServiceURLs);
+ if (!normalizedElgaServiceURLs.equals(elgaServiceURLs)) {
+ newConfigValues.put(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, normalizedElgaServiceURLs);
+ log.debug("Change key: " + MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL
+ + " from value: " + input.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL)
+ + " to value: " + normalizedElgaServiceURLs);
+ }
+
+ //check if service URLs are removed
+ for (String el : KeyValueUtils.getListOfCSVValues(normalizedElgaServiceURLs)) {
+ if (currentElgaServiceURLs.contains(el))
+ currentElgaServiceURLs.remove(el);
+ }
+ }
+ //update OA configuration
+ if (!currentElgaServiceURLs.isEmpty()) {
+ String[] servicesOAs = dbconfig.findConfigurationId(
+ MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES_OA
+ + ".%."
+ + MOAIDConfigurationConstants.SERVICE_EXTERNAL_ELGA_MANDATE_SERVICE_URL);
+ for (String service : servicesOAs) {
+ String spElgaService = dbconfig.getStringValue(service);
+ if (MiscUtil.isNotEmpty(spElgaService) &&
+ currentElgaServiceURLs.contains(spElgaService))
+ keysToDelete.add(service);
+ }
+ }
+
+
+
+ //normalize CSV of MIS mandate-service URLs
+ String misServiceURLs = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL, getKeyPrefix()));
+ List<String> currentMisServiceURLs = KeyValueUtils.getListOfCSVValues(dbconfig.getStringValue(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL));
+ if (MiscUtil.isNotEmpty(misServiceURLs)) {
+ String normalizedMisServiceURLs = KeyValueUtils.normalizeCSVValueString(misServiceURLs);
+ if (!normalizedMisServiceURLs .equals(misServiceURLs)) {
+ newConfigValues.put(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL, normalizedMisServiceURLs);
+ log.debug("Change key: " + MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL
+ + " from value: " + input.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_OVS_URL)
+ + " to value: " + normalizedMisServiceURLs);
+ }
+
+ //check if service URLs are removed
+ for (String el : KeyValueUtils.getListOfCSVValues(normalizedMisServiceURLs)) {
+ if (currentMisServiceURLs.contains(el))
+ currentMisServiceURLs.remove(el);
+ }
+ }
+ //update OA configuration
+ if (!currentMisServiceURLs.isEmpty()) {
+ String[] servicesOAs = dbconfig.findConfigurationId(
+ MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES_OA
+ + ".%."
+ + MOAIDConfigurationConstants.SERVICE_EXTERNAL_MIS_SERVICE_URL);
+ for (String service : servicesOAs) {
+ String spElgaService = dbconfig.getStringValue(service);
+ if (MiscUtil.isNotEmpty(spElgaService) &&
+ currentMisServiceURLs.contains(spElgaService))
+ keysToDelete.add(service);
+ }
+ }
+
+ //normalize CSV of SZR-GW service URLs
+ String szrgwServiceURLs = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, getKeyPrefix()));
+ List<String> currentSzrgwServiceURLs = KeyValueUtils.getListOfCSVValues(dbconfig.getStringValue(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_SZRGW_URL));
+ if (MiscUtil.isNotEmpty(szrgwServiceURLs)) {
+ String normalizedSzrgwServiceURLs = KeyValueUtils.normalizeCSVValueString(szrgwServiceURLs);
+ if (!normalizedSzrgwServiceURLs .equals(szrgwServiceURLs)) {
+ newConfigValues.put(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL, normalizedSzrgwServiceURLs);
+ log.debug("Change key: " + MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL
+ + " from value: " + input.get(MOAIDConfigurationConstants.GENERAL_AUTH_SERVICES_ELGA_MANDATE_SERVICE_URL)
+ + " to value: " + normalizedSzrgwServiceURLs);
+ }
+
+ //check if service URLs are removed
+ for (String el : KeyValueUtils.getListOfCSVValues(szrgwServiceURLs)) {
+ if (currentSzrgwServiceURLs.contains(el))
+ currentSzrgwServiceURLs.remove(el);
+ }
+ }
+ //update OA configuration
+ if (!currentSzrgwServiceURLs.isEmpty()) {
+ String[] servicesOAs = dbconfig.findConfigurationId(
+ MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES_OA
+ + ".%."
+ + MOAIDConfigurationConstants.SERVICE_EXTERNAL_SZRGW_SERVICE_URL);
+ for (String service : servicesOAs) {
+ String spElgaService = dbconfig.getStringValue(service);
+ if (MiscUtil.isNotEmpty(spElgaService) &&
+ currentSzrgwServiceURLs.contains(spElgaService))
+ keysToDelete.add(service);
+ }
+ }
+
+ } catch (ConfigurationException e) {
+ log.error("Configuration is not accessable!", e);
+
+ }
+
if (newConfigValues.isEmpty())
return null;
else
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 1819c5c2b..dcbee8e1d 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
@@ -248,7 +248,37 @@ public class ServicesAuthenticationInformationTask extends AbstractTaskValidator
}
}
}
-
+
+ check = input.get(MOAIDConfigurationConstants.SERVICE_EXTERNAL_MIS_SERVICE_URL);
+ if (MiscUtil.isNotEmpty(check) &&
+ !ValidationHelper.validateURL(check)) {
+ log.info("Not valid MIS Service URL");
+ errors.add(new ValidationObjectIdentifier(
+ MOAIDConfigurationConstants.SERVICE_EXTERNAL_MIS_SERVICE_URL,
+ "Mandates - MIS",
+ LanguageHelper.getErrorString("validation.general.mandateservice.valid", new Object[]{check})));
+ }
+
+ check = input.get(MOAIDConfigurationConstants.SERVICE_EXTERNAL_ELGA_MANDATE_SERVICE_URL);
+ if (MiscUtil.isNotEmpty(check) &&
+ !ValidationHelper.validateURL(check)) {
+ log.info("Not valid ELGA Service URL");
+ errors.add(new ValidationObjectIdentifier(
+ MOAIDConfigurationConstants.SERVICE_EXTERNAL_ELGA_MANDATE_SERVICE_URL,
+ "Mandates - ELGA",
+ LanguageHelper.getErrorString("validation.general.elga.mandateservice.valid", new Object[]{check})));
+ }
+
+ check = input.get(MOAIDConfigurationConstants.SERVICE_EXTERNAL_SZRGW_SERVICE_URL);
+ if (MiscUtil.isNotEmpty(check) &&
+ !ValidationHelper.validateURL(check)) {
+ log.info("Not valid SZR-GW Service URL");
+ errors.add(new ValidationObjectIdentifier(
+ MOAIDConfigurationConstants.SERVICE_EXTERNAL_SZRGW_SERVICE_URL,
+ "SZR-Gateway - Service URL",
+ LanguageHelper.getErrorString("validation.general.szrgw.url.valid", new Object[]{check})));
+ }
+
if (!errors.isEmpty())
throw new ConfigurationTaskValidationException(errors);
diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolPVP2XTask.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolPVP2XTask.java
index d69157553..dac5ae1ee 100644
--- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolPVP2XTask.java
+++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesProtocolPVP2XTask.java
@@ -22,8 +22,6 @@
*/
package at.gv.egovernment.moa.id.config.webgui.validation.task.impl;
-import iaik.x509.X509Certificate;
-
import java.io.IOException;
import java.security.cert.CertificateException;
import java.util.ArrayList;
@@ -64,6 +62,7 @@ import at.gv.egovernment.moa.id.config.webgui.validation.utils.MetaDataVerificat
import at.gv.egovernment.moa.id.config.webgui.validation.utils.SchemaValidationFilter;
import at.gv.egovernment.moa.util.Base64Utils;
import at.gv.egovernment.moa.util.MiscUtil;
+import iaik.x509.X509Certificate;
/**
* @author tlenz
@@ -196,8 +195,9 @@ public class ServicesProtocolPVP2XTask extends AbstractTaskValidator implements
MOAIDWebGUIConfiguration.getInstance().getCertStoreDirectory(),
MOAIDWebGUIConfiguration.getInstance().getTrustStoreDirectory(),
null,
- "pkix",
- true);
+ "pkix",
+ true,
+ new String[]{"crl"});
httpClient.setCustomSSLTrustStore(
metadataURL,