aboutsummaryrefslogtreecommitdiff
path: root/id
diff options
context:
space:
mode:
authorFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-03-05 10:22:46 +0100
committerFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-03-05 10:26:50 +0100
commit1ba3c2042e0c4da08af39db6172ff1206dfece36 (patch)
treea7154271210fafc12cc1187eeca842f69db8b05e /id
parentf57dbf19485e1da5f9a60d65b0c4cc8ce6e4cd9c (diff)
downloadmoa-id-spss-1ba3c2042e0c4da08af39db6172ff1206dfece36.tar.gz
moa-id-spss-1ba3c2042e0c4da08af39db6172ff1206dfece36.tar.bz2
moa-id-spss-1ba3c2042e0c4da08af39db6172ff1206dfece36.zip
ap plugins can be configured to listen to certain attributes
Diffstat (limited to 'id')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java4
-rw-r--r--id/ConfigWebTool/src/main/resources/applicationResources.properties1
-rw-r--r--id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp5
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java8
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java11
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java13
-rw-r--r--id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd5
7 files changed, 34 insertions, 13 deletions
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 25e0d751c..067e85aa6 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
@@ -58,6 +58,10 @@ public class OASTORKConfigValidation {
log.info("AttributeProviderPlugin Name is empty.");
errors.add(LanguageHelper.getErrorString("validation.stork.ap.name.valid"));
}
+ if (MiscUtil.isEmpty(current.getAttributes()) || !current.getAttributes().matches("[a-zA-Z]+(, ?[a-zA-Z]+)*")) {
+ log.info("AttributeProviderPlugin attributes are empty or do not match csv format.");
+ errors.add(LanguageHelper.getErrorString("validation.stork.ap.attributes.valid"));
+ }
}
return errors;
diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties
index a033205ed..34bf4a8e5 100644
--- a/id/ConfigWebTool/src/main/resources/applicationResources.properties
+++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties
@@ -419,6 +419,7 @@ validation.stork.qaa.outofrange=G\u00FCltige QAA Werte sind 1, 2, 3, und 4
validation.stork.attributes.empty=Es muss mindestens ein Attribut definiert sein
validation.stork.ap.url.valid=Ung\u00FCltige AttributProvider Url
validation.stork.ap.name.valid=Ung\u00FCltiger AttributProvider Name
+validation.stork.ap.attributes.valid=Ung\u00FCltige Attributconfiguration f\u00FCr ein Attribut Provider Plugin. Feld darf nicht leer sein und ist als csv anzugeben.
validation.pvp2.metadataurl.empty=Keine Metadaten URL angegeben.
validation.pvp2.metadataurl.valid=Die Metadaten URL wei\u00DFt kein g\u00FCltiges URL Format auf.
diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
index 76c347445..5ee1188ae 100644
--- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
+++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
@@ -516,10 +516,11 @@
id="OAuseVidp" /></p>
<h5><%=LanguageHelper.getGUIString("webpages.oaconfig.vidp.ap.list", request) %></h5>
<table id="stork_aplist">
- <tr><th>AP Plugin</th><th>URL</th>
+ <tr><th>AP Plugin</th><th>URL</th><th>Attribute (CSV)</th></tr>
<s:iterator value="storkOA.attributeProviderPlugins" status="stat">
<tr><td><s:select name="storkOA.attributeProviderPlugins[%{#stat.index}].name" value="%{name}" list="%{storkOA.availableAttributeProviderPlugins}"/></td>
- <td><s:textfield name="storkOA.attributeProviderPlugins[%{#stat.index}].url" value="%{url}" cssClass="textfield"/></td>
+ <td><s:textfield name="storkOA.attributeProviderPlugins[%{#stat.index}].url" value="%{url}" cssClass="textfield_mail"/></td>
+ <td><s:textfield name="storkOA.attributeProviderPlugins[%{#stat.index}].attributes" value="%{attributes}" cssClass="textfield_mail"/></td>
<td><input type="button" value="<%=LanguageHelper.getGUIString("webpages.oaconfig.vidp.ap.remove", request) %>" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/></td></tr>
</s:iterator>
</table>
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java
index 23edf69f9..de079c960 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java
@@ -31,11 +31,11 @@ public class AttributeProviderFactory {
* the simpleName for the providers class
* @return the attribute provider
*/
- public static AttributeProvider create(String shortname, String url) {
+ public static AttributeProvider create(String shortname, String url, String attributes) {
if (shortname.equals("StorkAttributeRequestProvider")) {
- return new StorkAttributeRequestProvider(url);
+ return new StorkAttributeRequestProvider(url, attributes);
} else if(shortname.equals("EHvdAttributeProvider")) {
- return new EHvdAttributeProviderPlugin(url);
+ return new EHvdAttributeProviderPlugin(url, attributes);
} else {
return null;
}
@@ -52,7 +52,7 @@ public class AttributeProviderFactory {
List<AttributeProvider> result = new ArrayList<AttributeProvider>();
for(AttributeProviderPlugin current : configuredAPs)
- result.add(create(current.getName(), current.getUrl()));
+ result.add(create(current.getName(), current.getUrl(), current.getAttributes()));
return result;
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java
index f97d8c804..a36855d33 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java
@@ -44,26 +44,31 @@ public class EHvdAttributeProviderPlugin implements AttributeProvider {
/** The destination. */
private Object destination;
+
+ /** The attributes. */
+ private String attributes;
/**
* Instantiates a new e hvd attribute provider plugin.
*
* @param url the service url
+ * @param attributes
*/
- public EHvdAttributeProviderPlugin(String url) {
+ public EHvdAttributeProviderPlugin(String url, String supportedAttributes) {
destination = url;
+ attributes = supportedAttributes;
}
/* (non-Javadoc)
* @see at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider#acquire(eu.stork.peps.auth.commons.PersonalAttribute)
*/
@Override
- public IPersonalAttributeList acquire(PersonalAttribute attributes, AuthenticationSession moasession)
+ public IPersonalAttributeList acquire(PersonalAttribute attribute, AuthenticationSession moasession)
throws UnsupportedAttributeException,
ExternalAttributeRequestRequiredException, MOAIDException {
// break when we cannot handle the requested attribute
- if(!attributes.getName().equals("isHealthCareProfessional"))
+ if(!attributes.contains(attribute.getName()))
throw new UnsupportedAttributeException();
try {
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java
index 797695a00..d8becaaf7 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java
@@ -34,14 +34,19 @@ public class StorkAttributeRequestProvider implements AttributeProvider {
/** The destination. */
private String destination;
-
+
+ /** The attributes. */
+ private String attributes;
+
/**
* Instantiates a new stork attribute request provider.
*
* @param apUrl the AP location
+ * @param supportedAttributes the supported attributes as csv
*/
- public StorkAttributeRequestProvider(String apUrl) {
+ public StorkAttributeRequestProvider(String apUrl, String supportedAttributes) {
destination = apUrl;
+ attributes = supportedAttributes;
}
/* (non-Javadoc)
@@ -49,6 +54,10 @@ public class StorkAttributeRequestProvider implements AttributeProvider {
*/
public IPersonalAttributeList acquire(PersonalAttribute attribute, AuthenticationSession moasession)
throws UnsupportedAttributeException, ExternalAttributeRequestRequiredException {
+
+ if (!attributes.contains(attribute.getName()))
+ throw new UnsupportedAttributeException();
+
requestedAttributes = new PersonalAttributeList(1);
requestedAttributes.add(attribute);
throw new ExternalAttributeRequestRequiredException(this);
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 d20ec1c68..845e4fe1f 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
@@ -957,8 +957,9 @@
<xsd:sequence>
<xsd:element name="name" type="xsd:string"></xsd:element>
<xsd:element name="url" type="xsd:anyURI"></xsd:element>
- </xsd:sequence>
- </xsd:complexType>
+ <xsd:element name="attributes" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
<xsd:element name="AttributeProviders" type="AttributeProviderPlugin"></xsd:element>
<xsd:element name="Attributes" type="StorkAttribute"/>