aboutsummaryrefslogtreecommitdiff
path: root/id
diff options
context:
space:
mode:
Diffstat (limited to 'id')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java19
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProvider.java3
2 files changed, 21 insertions, 1 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java
index b333fb4fe..91b09795f 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java
@@ -55,6 +55,23 @@ public class AttributeCollector implements IAction {
// - no, how did we get here?
// yes, we got a recent requested attribute
// - find the attribute provider plugin that can handle the response
+ PersonalAttribute newAttribute = null;
+ for (AttributeProvider current : attributeProviders)
+ try {
+ newAttribute = current.parse(httpReq);
+ } catch (UnsupportedAttributeException e1) {
+ // the current provider cannot find anything familiar within the
+ // provided httpreq. Try the next one.
+ }
+
+ if (null == newAttribute) {
+ // we do not have a provider which is capable of fetching something
+ // from the received httpreq.
+ // TODO should we continue with the next attribute?
+ Logger.error("No attribute could be retrieved from the response the attribute provider gave us.");
+ throw new MOAIDException("stork.11", null);
+ }
+
// - fetch the container
String artifactId = (String) httpReq.getAttribute(ARTIFACT_ID);
DataContainer container;
@@ -64,7 +81,9 @@ public class AttributeCollector implements IAction {
Logger.error("Error fetching incomplete Stork response from temporary storage. Most likely a timeout occured.", e);
throw new MOAIDException("stork.11", null);
}
+
// - insert the embedded attribute(s) into the container
+ container.getResponse().getPersonalAttributeList().add(newAttribute);
// see if we need some more attributes
return processRequest(container);
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProvider.java
index 2c024e822..c554485ee 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProvider.java
@@ -34,7 +34,8 @@ public interface AttributeProvider {
*
* @param httpReq the http req
* @return the personal attribute
+ * @throws UnsupportedAttributeException if the provider cannot find anything familiar in the provided httpReq
*/
- public PersonalAttribute parse(HttpServletRequest httpReq);
+ public PersonalAttribute parse(HttpServletRequest httpReq) throws UnsupportedAttributeException;
}