aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-01-07 17:25:38 +0100
committerFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-01-27 16:34:14 +0100
commitfb6e40832df5182ae1ebd7555583caed174e8776 (patch)
treeeb0affabf0f6a1768d614f0949c73ad735405fdd
parent6ef9296d79741b455530f70262003fefd51ee85c (diff)
downloadmoa-id-spss-fb6e40832df5182ae1ebd7555583caed174e8776.tar.gz
moa-id-spss-fb6e40832df5182ae1ebd7555583caed174e8776.tar.bz2
moa-id-spss-fb6e40832df5182ae1ebd7555583caed174e8776.zip
oa attr configuration revisited
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java61
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java56
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java2
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java17
-rw-r--r--id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp15
-rw-r--r--id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd11
6 files changed, 117 insertions, 45 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java
new file mode 100644
index 000000000..1590918c6
--- /dev/null
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/AttributeHelper.java
@@ -0,0 +1,61 @@
+package at.gv.egovernment.moa.id.configuration.data.oa;
+
+import at.gv.egovernment.moa.id.commons.db.dao.config.OAStorkAttribute;
+import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute;
+
+public class AttributeHelper {
+ private boolean isUsed = false;
+ private String name;
+ private boolean mandatory;
+ private boolean readonly;
+
+ public AttributeHelper() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public AttributeHelper(OAStorkAttribute attribute) {
+ isUsed = true;
+ name = attribute.getAttribute().getName();
+ mandatory = attribute.isMandatory();
+ readonly = attribute.getAttribute().isMandatory();
+ }
+
+ public AttributeHelper(StorkAttribute attribute) {
+ name = attribute.getName();
+ mandatory = false;
+ readonly = attribute.isMandatory();
+ isUsed = readonly;
+ }
+
+ public boolean isUsed() {
+ return isUsed;
+ }
+
+ public void setUsed(boolean used) {
+ isUsed = used;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String newname) {
+ name = newname;
+ }
+
+ public boolean isMandatory() {
+ return mandatory;
+ }
+
+ public void setMandatory(boolean value) {
+ mandatory = value;
+ }
+
+ public boolean isReadOnly() {
+ return readonly;
+ }
+
+ public void setReadOnly(boolean value) {
+ // we do not allow setting the readonly field
+ }
+} \ No newline at end of file
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java
index f6fc4416f..42501b4d1 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java
@@ -1,20 +1,21 @@
package at.gv.egovernment.moa.id.configuration.data.oa;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead;
import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA;
import at.gv.egovernment.moa.id.commons.db.dao.config.OASTORK;
+import at.gv.egovernment.moa.id.commons.db.dao.config.OAStorkAttribute;
import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
-import at.gv.egovernment.moa.id.commons.db.dao.config.RequestedAttributesType;
+import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute;
public class OASTORKConfig {
private boolean isStorkLogonEnabled = false;
private int qaa;
- private List<String> attributes;
+
+ private List<AttributeHelper> attributes;
public OASTORKConfig() {
@@ -40,13 +41,20 @@ public class OASTORKConfig {
setQaa(ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getQualityAuthenticationAssuranceLevel());
}
- RequestedAttributesType tmp = config.getAttributes();
- if(null == tmp)
- // if there is no configuration available for the OA, get the default attributes
- tmp = ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getRequestedAttributes();
- attributes = new ArrayList<String>();
- for(String current : tmp.getAttributeValue())
- attributes.add(current);
+ // prepare attribute helper list
+ attributes = new ArrayList<AttributeHelper>();
+ for(StorkAttribute current : ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getRequestedAttributes()) {
+ AttributeHelper tmp = null;
+
+ for(OAStorkAttribute sepp : config.getAttributes())
+ if(sepp.getAttribute().equals(current))
+ tmp = new AttributeHelper(sepp);
+
+ if(null == tmp)
+ tmp = new AttributeHelper(current);
+
+ attributes.add(tmp);
+ }
}
}
}
@@ -67,19 +75,27 @@ public class OASTORKConfig {
this.qaa = qaa;
}
- public RequestedAttributesType getRequestedAttributesType() {
- RequestedAttributesType tmp = new RequestedAttributesType();
- tmp.setAttributeValue(attributes);
- return tmp;
+ public List<OAStorkAttribute> getAttributes() {
+ List<OAStorkAttribute> result = new ArrayList<OAStorkAttribute>();
+ for(AttributeHelper current : getHelperAttributes()) {
+ if(current.isUsed()) {
+ OAStorkAttribute tmp = new OAStorkAttribute();
+ for(StorkAttribute currentAttribute : ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getRequestedAttributes())
+ if(currentAttribute.getName().equals(current.getName()))
+ tmp.setAttribute(currentAttribute);
+ tmp.setMandatory(current.isMandatory());
+ result.add(tmp);
+ }
+ }
+
+ return result;
}
- public String getAttributes() {
- return Arrays.toString(attributes.toArray()).replace("[", "").replace("]", "");
+ public List<AttributeHelper> getHelperAttributes() {
+ return attributes;
}
- public void setAttributes(String attributes) {
- this.attributes = new ArrayList<String>();
- for(String current : attributes.split(","))
- this.attributes.add(current.trim());
+ public void setHelperAttributes(List<AttributeHelper> attributes) {
+ this.attributes = attributes;
}
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
index 466feba23..59d5f7302 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
@@ -968,7 +968,7 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
// transfer the incoming data to the database model
stork.setStorkLogonEnabled(storkOA.isStorkLogonEnabled());
stork.setQaa(storkOA.getQaa());
- stork.setAttributes(storkOA.getRequestedAttributesType());
+ stork.setAttributes(storkOA.getAttributes());
try {
if (newentry) {
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java
index 31cf7bcee..71b3857c3 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java
@@ -7,8 +7,6 @@ import org.apache.log4j.Logger;
import at.gv.egovernment.moa.id.configuration.data.oa.OASTORKConfig;
import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
-import at.gv.egovernment.moa.id.configuration.validation.ValidationHelper;
-import at.gv.egovernment.moa.util.MiscUtil;
public class OASTORKConfigValidation {
@@ -26,21 +24,6 @@ public class OASTORKConfigValidation {
new Object[] {qaa} ));
}
- // check attributes
- String check = oageneral.getAttributes();
- if (MiscUtil.isNotEmpty(check)) {
- if (ValidationHelper.containsPotentialCSSCharacter(check, true)) {
- log.warn("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, ]*$")) {
- log.warn("attributes do not match the requested format : " + check);
- errors.add(LanguageHelper.getErrorString("validation.stork.requestedattributes",
- new Object[] {check} ));
- }
- }
-
return errors;
}
}
diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
index d12a47b9e..57728845c 100644
--- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
+++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
@@ -313,16 +313,21 @@
onclick="oaStork();"
id="OAuseSTORKLogon" />
<div id="stork_block">
- <s:textfield name="storkOA.attributes"
- value="%{storkOA.attributes}"
- labelposition="left"
- key="webpages.moaconfig.stork.requestedattributes"
- cssClass="textfield_long"/>
<s:select list="#{1:'1', 2:'2', 3:'3', 4:'4'}"
value="#{storkOA.qaa}"
name="storkOA.qaa"
key="webpages.moaconfig.stork.qaa"
labelposition="left" />
+ <h4>Attributes</h4>
+ <table>
+ <tr><th>verwendet</th><th>Attributname</th><th>mandatory</th></tr>
+ <s:iterator value="storkOA.helperAttributes" status="stat">
+ <tr><td><s:checkbox name="storkOA.helperAttributes[%{#stat.index}].used" value="%{used}" /><s:hidden name="storkOA.helperAttributes[%{#stat.index}].name" value="%{name}" /></td>
+ <td><s:property value="%{name}" /></td>
+ <td><s:checkbox name="storkOA.helperAttributes[%{#stat.index}].mandatory" value="%{mandatory}" /></td>
+ <td><input type="button" value="<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.attributes.remove", request) %>" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/></td></tr>
+ </s:iterator>
+ </table>
</div>
</div>
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 b1834fc96..6972b031c 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="QualityAuthenticationAssuranceLevelType">
+ <xsd:element name="AbstractSimpleIdentification" type="StorkAttribute">
<xsd:annotation>
<xsd:documentation>possibility to include common austrian primary
keys in human readable way, english translation not available
@@ -923,8 +923,8 @@
<xsd:sequence>
<xsd:element name="StorkLogonEnabled"
type="xsd:boolean" />
- <xsd:element ref="Attributes" maxOccurs="unbounded" minOccurs="1"></xsd:element>
<xsd:element ref="Qaa" maxOccurs="1" minOccurs="0"></xsd:element>
+ <xsd:element name="Attributes" type="OAStorkAttribute" maxOccurs="unbounded" minOccurs="1"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
@@ -993,4 +993,11 @@
<xsd:element name="Attributes" type="StorkAttribute"></xsd:element>
<xsd:element name="Qaa" type="QualityAuthenticationAssuranceLevelType"></xsd:element>
+
+ <xsd:complexType name="OAStorkAttribute">
+ <xsd:sequence>
+ <xsd:element name="attribute" type="StorkAttribute"></xsd:element>
+ <xsd:element name="mandatory" type="xsd:boolean"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
</xsd:schema>