aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at
diff options
context:
space:
mode:
authorFlorian Reimair <florian.reimair@iaik.tugraz.at>2013-12-17 13:52:47 +0100
committerFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-01-27 16:34:14 +0100
commit999756bd381ec4d81db7db7bb59863ad549d69b0 (patch)
tree8072c8033a6cfe7f4dcf3214bbff2010dca885be /id/ConfigWebTool/src/main/java/at
parent21fb0d3c25a49f57cf79d4d11571f6f857eac780 (diff)
downloadmoa-id-spss-999756bd381ec4d81db7db7bb59863ad549d69b0.tar.gz
moa-id-spss-999756bd381ec4d81db7db7bb59863ad549d69b0.tar.bz2
moa-id-spss-999756bd381ec4d81db7db7bb59863ad549d69b0.zip
default qaa and attributes persisted and validated
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java44
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java4
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java23
3 files changed, 69 insertions, 2 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java
index 41d19d116..f270ab624 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java
@@ -3,15 +3,20 @@ package at.gv.egovernment.moa.id.configuration.data;
import java.util.ArrayList;
import java.util.List;
+import edu.emory.mathcs.backport.java.util.Arrays;
+
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.ForeignIdentities;
import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration;
+import at.gv.egovernment.moa.id.commons.db.dao.config.RequestedAttributesType;
import at.gv.egovernment.moa.id.commons.db.dao.config.STORK;
public class GeneralStorkConfig {
private List<CPEPS> cpepslist;
+ private List<String> attributes;
+ private int qaa;
public void parse(MOAIDConfiguration config) {
@@ -29,6 +34,19 @@ public class GeneralStorkConfig {
for(CPEPS current : stork.getCPEPS()) {
cpepslist.add(current);
}
+
+ RequestedAttributesType tmp = stork.getRequestedAttributes();
+ if(null != tmp) {
+ attributes = new ArrayList<String>();
+ for(String current : tmp.getAttributeValue())
+ attributes.add(current);
+ }
+
+ try {
+ qaa = stork.getQualityAuthenticationAssuranceLevel();
+ } catch(NullPointerException e) {
+ qaa = 4;
+ }
}
}
}
@@ -40,6 +58,30 @@ public class GeneralStorkConfig {
}
public void setCpepslist(List<CPEPS> list) {
- this.cpepslist = list;
+ cpepslist = list;
+ }
+
+ public RequestedAttributesType getRequestedAttributesType() {
+ RequestedAttributesType tmp = new RequestedAttributesType();
+ tmp.setAttributeValue(attributes);
+ return tmp;
+ }
+
+ public String getDefaultAttributes() {
+ return Arrays.toString(attributes.toArray()).replace("[", "").replace("]", "");
+ }
+
+ public void setDefaultAttributes(String attributes) {
+ this.attributes = new ArrayList<String>();
+ for(String current : attributes.split(","))
+ this.attributes.add(current.trim());
+ }
+
+ public int getDefaultQaa() {
+ return qaa;
+ }
+
+ public void setDefaultQaa(int qaa) {
+ this.qaa = qaa;
}
}
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 092dd5613..72da0b59f 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
@@ -397,11 +397,13 @@ public class EditGeneralConfigAction extends ActionSupport
if (oldstork != null)
oldstork = new STORK();
+ oldstork.setQualityAuthenticationAssuranceLevel(storkconfig.getDefaultQaa());
+ oldstork.setRequestedAttributes(storkconfig.getRequestedAttributesType());
oldstork.setCPEPS(storkconfig.getCpepslist());
dbforeign.setSTORK(oldstork);
}
}
-
+
if (MiscUtil.isNotEmpty(moaconfig.getMandateURL())) {
OnlineMandates dbmandate = dbauth.getOnlineMandates();
if (dbmandate == null) {
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java
index 91d5ecabd..4ee247695 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/StorkConfigValidator.java
@@ -55,6 +55,29 @@ public class StorkConfigValidator {
}
}
+ // check qaa
+ int qaa = form.getDefaultQaa();
+ if(1 > qaa && 4 < qaa) {
+ log.warn("QAA is out of range : " + qaa);
+ errors.add(LanguageHelper.getErrorString("validation.stork.qaa.outofrange",
+ new Object[] {qaa} ));
+ }
+
+ // check attributes
+ String check = form.getDefaultAttributes();
+ if (MiscUtil.isNotEmpty(check)) {
+ if (ValidationHelper.containsPotentialCSSCharacter(check, true)) {
+ log.warn("default attributes contains potentail XSS characters: " + check);
+ errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes",
+ new Object[] {ValidationHelper.getPotentialCSSCharacter(false)} ));
+ }
+ if(!check.toLowerCase().matches("^[a-z0-9, ]*$")) {
+ log.warn("default attributes do not match the requested format : " + check);
+ errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes",
+ new Object[] {check} ));
+ }
+ }
+
return errors;
}
}