aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2014-03-14 12:52:35 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2014-03-14 12:52:35 +0100
commit191bd90971b488bff16a5e08d0c1b2306da5876f (patch)
treea70dd32de00ec28118d2499a74e2802c9022dd9c
parent6c9e452d5ab984c1ef221c4a2e746454aa41e014 (diff)
downloadmoa-id-spss-191bd90971b488bff16a5e08d0c1b2306da5876f.tar.gz
moa-id-spss-191bd90971b488bff16a5e08d0c1b2306da5876f.tar.bz2
moa-id-spss-191bd90971b488bff16a5e08d0c1b2306da5876f.zip
bugfix possible NullPointerException in STORK config
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java8
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java19
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java36
3 files changed, 42 insertions, 21 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java
index d6ede8fbf..a052f403b 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java
@@ -55,6 +55,7 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType;
import at.gv.egovernment.moa.id.commons.db.dao.config.TrustAnchor;
import at.gv.egovernment.moa.id.commons.db.dao.config.VerifyAuthBlock;
import at.gv.egovernment.moa.id.commons.db.dao.config.VerifyIdentityLink;
+import at.gv.egovernment.moa.id.config.legacy.ConfigurationBuilder;
import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.data.pvp2.ContactForm;
import at.gv.egovernment.moa.util.MiscUtil;
@@ -305,7 +306,12 @@ public class GeneralMOAIDConfig {
if (modes != null) {
ChainingModeType defaultmode = modes.getSystemDefaultMode();
if (defaultmode != null) {
- defaultchainigmode = defaultmode.value();
+
+ if (ConfigurationBuilder.CM_CHAINING.equals(defaultmode.value()))
+ defaultchainigmode = ChainingModeType.CHAIN.value();
+
+ else
+ defaultchainigmode = defaultmode.value();
}
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 5df12a7a5..75e07a1a0 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
@@ -41,6 +41,7 @@ import org.apache.struts2.interceptor.ServletResponseAware;
import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead;
import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils;
import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral;
+import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS;
import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModeType;
import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes;
import at.gv.egovernment.moa.id.commons.db.dao.config.ConnectionParameterClientAuthType;
@@ -62,6 +63,7 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.SLRequestTemplates;
import at.gv.egovernment.moa.id.commons.db.dao.config.SSO;
import at.gv.egovernment.moa.id.commons.db.dao.config.STORK;
import at.gv.egovernment.moa.id.commons.db.dao.config.SecurityLayer;
+import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute;
import at.gv.egovernment.moa.id.commons.db.dao.config.TimeOuts;
import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType;
import at.gv.egovernment.moa.id.commons.db.dao.config.TrustAnchor;
@@ -483,12 +485,23 @@ public class EditGeneralConfigAction extends ActionSupport
ForeignIdentities oldforeign = oldauth.getForeignIdentities();
if (oldforeign != null) {
STORK oldstork = oldforeign.getSTORK();
- if (oldstork != null)
+ if (oldstork == null)
oldstork = new STORK();
oldstork.setQualityAuthenticationAssuranceLevel(storkconfig.getDefaultQaa());
- oldstork.setAttributes(storkconfig.getAttributes());
- oldstork.setCPEPS(storkconfig.getCpepslist());
+
+ if (storkconfig.getAttributes() != null)
+ oldstork.setAttributes(storkconfig.getAttributes());
+
+ else
+ oldstork.setAttributes((List<StorkAttribute>) (new ArrayList<StorkAttribute>()));
+
+ if (storkconfig.getCpepslist() != null)
+ oldstork.setCPEPS(storkconfig.getCpepslist());
+
+ else
+ oldstork.setCPEPS((List<CPEPS>) (new ArrayList<CPEPS>()));
+
dbforeign.setSTORK(oldstork);
}
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java
index ff481b825..b3a4cca78 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java
@@ -58,30 +58,32 @@ public class STORKConfig {
this.basedirectory = basedirectory;
this.props = props;
- //create CPEPS map
- List<at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS> cpeps = stork.getCPEPS();
-
cpepsMap = new HashMap<String, CPEPS>();
+ attr = new ArrayList<StorkAttribute>();
+
+ if (stork != null) {
+ //create CPEPS map
+ List<at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS> cpeps = stork.getCPEPS();
+
+ if (cpeps != null) {
+ for(at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS cpep : cpeps) {
- if (cpeps != null) {
- for(at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS cpep : cpeps) {
-
- try {
- CPEPS moacpep = new CPEPS(cpep.getCountryCode(), new URL(cpep.getURL()));
+ try {
+ CPEPS moacpep = new CPEPS(cpep.getCountryCode(), new URL(cpep.getURL()));
- cpepsMap.put(cpep.getCountryCode(), moacpep);
+ cpepsMap.put(cpep.getCountryCode(), moacpep);
- } catch (MalformedURLException e) {
- Logger.warn("Error in MOA-ID Configuration. CPEP entry for country "
- + cpep.getCountryCode() + " has an invalid URL and is ignored.");
+ } catch (MalformedURLException e) {
+ Logger.warn("Error in MOA-ID Configuration. CPEP entry for country "
+ + cpep.getCountryCode() + " has an invalid URL and is ignored.");
+ }
}
}
- }
- attr = new ArrayList<StorkAttribute>();
- if (stork.getAttributes() != null) {
- for(StorkAttribute current : stork.getAttributes()) {
- attr.add(current);
+ if (stork.getAttributes() != null) {
+ for(StorkAttribute current : stork.getAttributes()) {
+ attr.add(current);
+ }
}
}