aboutsummaryrefslogtreecommitdiff
path: root/id
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2016-01-18 17:34:23 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2016-01-18 17:34:23 +0100
commit871e8fefefdd935bc99db467d43f4ec61dba251d (patch)
tree04f6c37e1d38067ba83e2620941bb391918bebe3 /id
parent5de5a970cacf9cfe5e55f9581902b00f4378b577 (diff)
downloadmoa-id-spss-871e8fefefdd935bc99db467d43f4ec61dba251d.tar.gz
moa-id-spss-871e8fefefdd935bc99db467d43f4ec61dba251d.tar.bz2
moa-id-spss-871e8fefefdd935bc99db467d43f4ec61dba251d.zip
add virtual IDP enabled flag to configuration
Diffstat (limited to 'id')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java6
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java19
-rw-r--r--id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/GeneralMOAIDConfigurationTask.java24
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java13
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java1
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/GeneralConfiguration.java23
6 files changed, 76 insertions, 10 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
index b4a0f9a77..3871fe6e1 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
@@ -267,7 +267,11 @@ public class EditGeneralConfigAction extends BasicAction {
StringUtils.chomp(pubURLPrefix.trim()));
}
-
+
+ dbauthgeneral.setVirtualPublicURLPrefixEnabled(
+ moaconfig.isVirtualPublicURLPrefixEnabled());
+
+
// if (MiscUtil.isNotEmpty(moaconfig.getAlternativeSourceID()))
// dbauthgeneral.setAlternativeSourceID(moaconfig.getAlternativeSourceID());
// else {
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java
index b640e8621..dac25ad60 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java
@@ -68,12 +68,23 @@ public class MOAConfigValidator {
check = form.getPublicURLPrefix();
if (MiscUtil.isNotEmpty(check)) {
String[] publicURLPreFix = check.split(",");
- for (String el : publicURLPreFix) {
+ if (form.isVirtualPublicURLPrefixEnabled()) {
+ for (String el : publicURLPreFix) {
+ if (!ValidationHelper.validateURL(
+ StringUtils.chomp(el.trim()))) {
+ log.info("Public URL Prefix " + el + " is not valid");
+ errors.add(LanguageHelper.getErrorString("validation.general.publicURLprefix.valid", new Object[]{el}, request));
+ }
+ }
+
+ } else {
if (!ValidationHelper.validateURL(
- StringUtils.chomp(el.trim()))) {
- log.info("Public URL Prefix " + el + " is not valid");
- errors.add(LanguageHelper.getErrorString("validation.general.publicURLprefix.valid", new Object[]{el}, request));
+ StringUtils.chomp(publicURLPreFix[0].trim()))) {
+ log.info("Public URL Prefix " + publicURLPreFix[0] + " is not valid");
+ errors.add(LanguageHelper.getErrorString("validation.general.publicURLprefix.valid", new Object[]{publicURLPreFix[0]}, request));
+
}
+
}
} else {
log.info("PublicURL Prefix is empty.");
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 891295777..1c3e0fe13 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
@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -114,17 +115,32 @@ public class GeneralMOAIDConfigurationTask extends AbstractTaskValidator impleme
}
check = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX, getKeyPrefix()));
+ String isVirtualIDPEnabled = input.get(KeyValueUtils.removePrefixFromKey(MOAIDConfigurationConstants.GENERAL_ISVIRTUALIDPSENABLED, getKeyPrefix()));
if (MiscUtil.isNotEmpty(check)) {
String[] preFixList = check.split(",");
- for (String el : preFixList) {
- if (!ValidationHelper.validateURL(el.trim())) {
- log.info("Public URL Prefix is not valid");
+ if (isVirtualIDPEnabled != null && Boolean.valueOf(isVirtualIDPEnabled)) {
+ for (String el : preFixList) {
+ if (!ValidationHelper.validateURL(el.trim())) {
+ log.info("Public URL Prefix is not valid");
+ errors.add(new ValidationObjectIdentifier(
+ MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX,
+ "Public URL Prefix",
+ LanguageHelper.getErrorString("validation.general.publicURLprefix.valid", new Object[]{el})));
+ }
+ }
+ } else {
+ if (!ValidationHelper.validateURL(
+ StringUtils.chomp(preFixList[0].trim()))) {
+ log.info("Public URL Prefix " + preFixList[0] + " is not valid");
errors.add(new ValidationObjectIdentifier(
MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX,
"Public URL Prefix",
- LanguageHelper.getErrorString("validation.general.publicURLprefix.valid", new Object[]{el})));
+ LanguageHelper.getErrorString("validation.general.publicURLprefix.valid", new Object[]{preFixList[0]})));
+
}
+
}
+
} else {
log.info("PublicURL Prefix is empty.");
errors.add(new ValidationObjectIdentifier(
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 e819805ad..63d8f463c 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
@@ -1188,6 +1188,9 @@ public class ConfigurationMigrationUtils {
result.put(MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX,
authgen.getPublicURLPreFix());
+ result.put(MOAIDConfigurationConstants.GENERAL_ISVIRTUALIDPSENABLED,
+ String.valueOf(authgen.isVirtualPublicURLPrefixEnabled()));
+
TimeOuts timeouts = authgen.getTimeOuts();
if (timeouts != null) {
@@ -1480,6 +1483,16 @@ public class ConfigurationMigrationUtils {
dbauthgeneral.setPublicURLPreFix(moaconfig.get(MOAIDConfigurationConstants.GENERAL_PUBLICURLPREFIX));
+ if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_ISVIRTUALIDPSENABLED))) {
+ dbauthgeneral.setVirtualPublicURLPrefixEnabled(
+ Boolean.valueOf(
+ moaconfig.get(MOAIDConfigurationConstants.GENERAL_ISVIRTUALIDPSENABLED)));
+
+ } else {
+ dbauthgeneral.setVirtualPublicURLPrefixEnabled(false);
+
+ }
+
if (MiscUtil.isNotEmpty(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_CERTSTORE_URL)))
dbauthgeneral.setCertStoreDirectory(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_CERTSTORE_URL));
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 c338c65ba..7d9fc452a 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
@@ -186,6 +186,7 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants {
//Namespaces for general MOA-ID config
public static final String GENERAL_PUBLICURLPREFIX = PREFIX_MOAID_GENERAL + ".publicURLPrefix";
+ public static final String GENERAL_ISVIRTUALIDPSENABLED = PREFIX_MOAID_GENERAL + ".isVirtualIDPsEnabled";
private static final String GENERAL_DEFAULTS = PREFIX_MOAID_GENERAL + ".defaults";
private static final String GENERAL_DEFAULTS_BKU = GENERAL_DEFAULTS + "." + BKU;
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/GeneralConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/GeneralConfiguration.java
index 883245da8..d3e454e51 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/GeneralConfiguration.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/GeneralConfiguration.java
@@ -27,6 +27,7 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
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;
@@ -107,6 +108,9 @@ public class GeneralConfiguration
@XmlAttribute(name = "Hjid")
protected Long hjid;
+ @XmlTransient
+ protected boolean virtualPublicURLPrefixEnabled = false;
+
/**
* Gets the value of the timeOuts property.
*
@@ -322,7 +326,24 @@ public class GeneralConfiguration
return true;
}
- public boolean equals(Object object) {
+
+
+ /**
+ * @return the virtualPublicURLPrefixEnabled
+ */
+ public boolean isVirtualPublicURLPrefixEnabled() {
+ return virtualPublicURLPrefixEnabled;
+ }
+
+ /**
+ * @param virtualPublicURLPrefixEnabled the virtualPublicURLPrefixEnabled to set
+ */
+ public void setVirtualPublicURLPrefixEnabled(
+ boolean virtualPublicURLPrefixEnabled) {
+ this.virtualPublicURLPrefixEnabled = virtualPublicURLPrefixEnabled;
+ }
+
+ public boolean equals(Object object) {
final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE;
return equals(null, null, object, strategy);
}