From 3da3836bcd77a23ca00df2bdb088e63b47cc6499 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 7 Jan 2014 15:07:32 +0100 Subject: mandatory field in global config --- .../id/configuration/data/GeneralStorkConfig.java | 23 +++++++++------------- .../struts/action/EditGeneralConfigAction.java | 2 +- .../validation/moaconfig/StorkConfigValidator.java | 7 ++++--- .../src/main/webapp/jsp/editMOAConfig.jsp | 7 ++++--- 4 files changed, 18 insertions(+), 21 deletions(-) (limited to 'id/ConfigWebTool/src') 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 695caa3fd..854334bed 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 @@ -7,13 +7,13 @@ 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; +import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; public class GeneralStorkConfig { private List cpepslist; - private List attributes; + private List attributes; private int qaa; public void parse(MOAIDConfiguration config) { @@ -27,16 +27,17 @@ public class GeneralStorkConfig { if (foreign != null) { STORK stork = foreign.getSTORK(); if (stork != null) { - // deep clone to foreclose lazyloading session timeouts + // deep clone all the things + // to foreclose lazyloading session timeouts cpepslist = new ArrayList(); for(CPEPS current : stork.getCPEPS()) { cpepslist.add(current); } - RequestedAttributesType tmp = stork.getRequestedAttributes(); + List tmp = stork.getRequestedAttributes(); if(null != tmp) { - attributes = new ArrayList(); - for(String current : tmp.getAttributeValue()) + attributes = new ArrayList(); + for(StorkAttribute current : tmp) attributes.add(current); } @@ -59,17 +60,11 @@ public class GeneralStorkConfig { cpepslist = list; } - public RequestedAttributesType getRequestedAttributesType() { - RequestedAttributesType tmp = new RequestedAttributesType(); - tmp.setAttributeValue(attributes); - return tmp; - } - - public List getAttributes() { + public List getAttributes() { return attributes; } - public void setAttributes(List attributes) { + public void setAttributes(List attributes) { this.attributes = attributes; } 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 72da0b59f..1de440506 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 @@ -398,7 +398,7 @@ public class EditGeneralConfigAction extends ActionSupport oldstork = new STORK(); oldstork.setQualityAuthenticationAssuranceLevel(storkconfig.getDefaultQaa()); - oldstork.setRequestedAttributes(storkconfig.getRequestedAttributesType()); + oldstork.setRequestedAttributes(storkconfig.getAttributes()); oldstork.setCPEPS(storkconfig.getCpepslist()); dbforeign.setSTORK(oldstork); } 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 cc5d0f2c4..318b3b3e7 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 @@ -5,6 +5,7 @@ import java.util.List; import org.apache.log4j.Logger; import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS; +import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute; import at.gv.egovernment.moa.id.configuration.data.GeneralStorkConfig; import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; import at.gv.egovernment.moa.id.configuration.validation.ValidationHelper; @@ -65,13 +66,13 @@ public class StorkConfigValidator { // check attributes if (MiscUtil.isNotEmpty(form.getAttributes())) { - for(String check : form.getAttributes()) { - if (ValidationHelper.containsPotentialCSSCharacter(check, true)) { + for(StorkAttribute check : form.getAttributes()) { + if (ValidationHelper.containsPotentialCSSCharacter(check.getName(), true)) { log.warn("default attributes contains potentail XSS characters: " + check); errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes", new Object[] {ValidationHelper.getPotentialCSSCharacter(true)} )); } - if(!check.toLowerCase().matches("^[a-z0-9]*$")) { + if(!check.getName().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} )); diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp index aff2028ac..078e5f681 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp @@ -245,9 +245,10 @@ " onclick='newPeps();' />

<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.heading", request) %>

- - - + + + +
Attribute Name
Attribute NameMandatory
-- cgit v1.2.3