diff options
5 files changed, 27 insertions, 29 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 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<CPEPS> cpepslist; - private List<String> attributes; + private List<StorkAttribute> 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<CPEPS>(); for(CPEPS current : stork.getCPEPS()) { cpepslist.add(current); } - RequestedAttributesType tmp = stork.getRequestedAttributes(); + List<StorkAttribute> tmp = stork.getRequestedAttributes(); if(null != tmp) { - attributes = new ArrayList<String>(); - for(String current : tmp.getAttributeValue()) + attributes = new ArrayList<StorkAttribute>(); + 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<String> getAttributes() { + public List<StorkAttribute> getAttributes() { return attributes; } - public void setAttributes(List<String> attributes) { + public void setAttributes(List<StorkAttribute> 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 @@ <input type="button" value="<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.newpeps", request) %>" onclick='newPeps();' /> <h4><%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.heading", request) %></h4> <table> - <tr><th>Attribute Name</th></tr> - <s:iterator value="storkconfig.attributes" var="attr" status="stat"> - <tr><td><s:textfield name="storkconfig.attributes[%{#stat.index}]"/></td> + <tr><th>Attribute Name</th><th>Mandatory</th></tr> + <s:iterator value="storkconfig.attributes" status="stat"> + <tr><td><s:textfield name="storkconfig.attributes[%{#stat.index}].name" value="%{name}"/></td> + <td><s:checkbox name="storkconfig.attributes[%{#stat.index}].mandatory" value="%{mandatory}" /></td> <td><input type="button" value="Delete" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/></td></tr> </s:iterator> </table> diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd index 9700b0a4f..b1834fc96 100644 --- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd +++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd @@ -49,7 +49,7 @@ <xsd:extension base="xsd:string"/> </xsd:simpleContent> </xsd:complexType> - <xsd:element name="AbstractSimpleIdentification" type="AbstractSimpleIdentificationType"> + <xsd:element name="AbstractSimpleIdentification" type="QualityAuthenticationAssuranceLevelType"> <xsd:annotation> <xsd:documentation>possibility to include common austrian primary keys in human readable way, english translation not available @@ -79,12 +79,13 @@ <xsd:pattern value="[A-Z]{2}"/> </xsd:restriction> </xsd:simpleType> - <xsd:complexType name="RequestedAttributesType"> + <xsd:complexType name="StorkAttribute"> <xsd:sequence> - <xsd:element name="AttributeValue" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="name" type="xsd:string"></xsd:element> + <xsd:element name="mandatory" type="xsd:boolean"></xsd:element> </xsd:sequence> </xsd:complexType> - <xsd:element name="RequestedAttributes" type="RequestedAttributesType"/> + <xsd:element name="RequestedAttributes" type="StorkAttribute"/> <xsd:simpleType name="LoginType"> <xsd:restriction base="xsd:token"> <xsd:enumeration value="stateless"/> @@ -853,7 +854,7 @@ </xsd:sequence> <xsd:sequence> <xsd:element ref="QualityAuthenticationAssuranceLevel" minOccurs="0"/> - <xsd:element ref="RequestedAttributes"/> + <xsd:element ref="RequestedAttributes" maxOccurs="unbounded" minOccurs="1"/> </xsd:sequence> </xsd:choice> </xsd:complexType> @@ -922,10 +923,10 @@ <xsd:sequence> <xsd:element name="StorkLogonEnabled" type="xsd:boolean" /> - <xsd:element ref="Attributes"></xsd:element> + <xsd:element ref="Attributes" maxOccurs="unbounded" minOccurs="1"></xsd:element> <xsd:element ref="Qaa" maxOccurs="1" minOccurs="0"></xsd:element> </xsd:sequence> - </xsd:complexType> + </xsd:complexType> </xsd:element> <xsd:element name="Contact"> <xsd:complexType> @@ -989,7 +990,7 @@ </xsd:sequence> </xsd:complexType> - <xsd:element name="Attributes" type="RequestedAttributesType"></xsd:element> + <xsd:element name="Attributes" type="StorkAttribute"></xsd:element> <xsd:element name="Qaa" type="QualityAuthenticationAssuranceLevelType"></xsd:element> </xsd:schema> |