aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java20
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProvider.java11
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoNoRedirectAttributeProvider.java10
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoRedirectAttributeProvider.java10
4 files changed, 32 insertions, 19 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 810b4ae7a..2e9072f0d 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,16 +55,16 @@ 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;
+ IPersonalAttributeList newAttributes = null;
for (AttributeProvider current : attributeProviders)
try {
- newAttribute = current.parse(httpReq);
+ newAttributes = current.parse(httpReq);
} catch (UnsupportedAttributeException e1) {
// the current provider cannot find anything familiar within the
// provided httpreq. Try the next one.
}
- if (null == newAttribute) {
+ if (null == newAttributes) {
// we do not have a provider which is capable of fetching something
// from the received httpreq.
// TODO should we continue with the next attribute?
@@ -83,7 +83,8 @@ public class AttributeCollector implements IAction {
}
// - insert the embedded attribute(s) into the container
- container.getResponse().getPersonalAttributeList().add(newAttribute);
+ for(PersonalAttribute current : newAttributes)
+ container.getResponse().getPersonalAttributeList().add(current);
// see if we need some more attributes
return processRequest(container, httpResp);
@@ -101,22 +102,23 @@ public class AttributeCollector implements IAction {
// check if there are attributes we need to fetch
IPersonalAttributeList requestAttributeList = container.getRequest().getPersonalAttributeList();
IPersonalAttributeList responseAttributeList = container.getResponse().getPersonalAttributeList();
- List<String> missingAttributes = new ArrayList<String>();
+ List<PersonalAttribute> missingAttributes = new ArrayList<PersonalAttribute>();
for(PersonalAttribute current : requestAttributeList)
if(!responseAttributeList.containsKey(current))
- missingAttributes.add(current.getName());
+ missingAttributes.add(current);
try {
// for each attribute still missing
- for(String currentAttribute : missingAttributes) {
+ for(PersonalAttribute currentAttribute : missingAttributes) {
// - check if we can find a suitable AttributeProvider Plugin
for(AttributeProvider currentProvider : attributeProviders) {
try {
// - hand over control to the suitable plugin
- PersonalAttribute aquiredAttribute = currentProvider.acquire(currentAttribute);
+ IPersonalAttributeList aquiredAttributes = currentProvider.acquire(currentAttribute);
// - add the aquired attribute to the container
- container.getResponse().getPersonalAttributeList().add(aquiredAttribute);
+ for(PersonalAttribute current : aquiredAttributes)
+ container.getResponse().getPersonalAttributeList().add(current);
} catch(UnsupportedAttributeException e) {
// ok, try the next attributeprovider
}
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 5ca3bd7e1..e1f5620a8 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
@@ -1,10 +1,13 @@
package at.gv.egovernment.moa.id.protocols.stork2;
+import java.util.List;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
+import eu.stork.peps.auth.commons.IPersonalAttributeList;
import eu.stork.peps.auth.commons.PersonalAttribute;
/**
@@ -18,12 +21,12 @@ public interface AttributeProvider {
* for redirecting the user to an external service. Use {@link AttributeProvider#parse(HttpServletRequest)} to parse
* the response.
*
- * @param attributeName the attribute name
+ * @param attributes the list of attributes to be acquired
* @return the personal attribute
* @throws UnsupportedAttributeException the unsupported attribute exception
* @throws ExternalAttributeRequestRequiredException an attribute request to an external service has to be done
*/
- public PersonalAttribute acquire(String attributeName) throws UnsupportedAttributeException, ExternalAttributeRequestRequiredException;
+ public IPersonalAttributeList acquire(PersonalAttribute attributes) throws UnsupportedAttributeException, ExternalAttributeRequestRequiredException;
/**
* Perform redirect.
@@ -37,10 +40,10 @@ public interface AttributeProvider {
* Parses the response we got from the external attribute provider.
*
* @param httpReq the http req
- * @return the personal attribute
+ * @return a list of attributes
* @throws UnsupportedAttributeException if the provider cannot find anything familiar in the provided httpReq
* @throws MOAIDException if something went wrong
*/
- public PersonalAttribute parse(HttpServletRequest httpReq) throws UnsupportedAttributeException, MOAIDException;
+ public IPersonalAttributeList parse(HttpServletRequest httpReq) throws UnsupportedAttributeException, MOAIDException;
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoNoRedirectAttributeProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoNoRedirectAttributeProvider.java
index 51663ed38..a38cfed96 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoNoRedirectAttributeProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoNoRedirectAttributeProvider.java
@@ -5,7 +5,9 @@ import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import eu.stork.peps.auth.commons.IPersonalAttributeList;
import eu.stork.peps.auth.commons.PersonalAttribute;
+import eu.stork.peps.auth.commons.PersonalAttributeList;
/**
* Just a simple demoprovider who can fetch any attribute you ask him.
@@ -16,16 +18,18 @@ public class DemoNoRedirectAttributeProvider implements AttributeProvider {
* @see at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider#acquire(java.lang.String)
*/
@Override
- public PersonalAttribute acquire(String attributeName)
+ public IPersonalAttributeList acquire(PersonalAttribute attributeName)
throws UnsupportedAttributeException {
- return new PersonalAttribute("sepp", true, new ArrayList<String>(), "");
+ PersonalAttributeList requestedAttributes = new PersonalAttributeList(1);
+ requestedAttributes.add(new PersonalAttribute("sepp", true, new ArrayList<String>(), ""));
+ return requestedAttributes;
}
/* (non-Javadoc)
* @see at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider#parse(javax.servlet.http.HttpServletRequest)
*/
@Override
- public PersonalAttribute parse(HttpServletRequest httpReq) {
+ public IPersonalAttributeList parse(HttpServletRequest httpReq) {
// TODO Auto-generated method stub
return null;
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoRedirectAttributeProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoRedirectAttributeProvider.java
index fad049763..a9e2cf358 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoRedirectAttributeProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoRedirectAttributeProvider.java
@@ -5,7 +5,9 @@ import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import eu.stork.peps.auth.commons.IPersonalAttributeList;
import eu.stork.peps.auth.commons.PersonalAttribute;
+import eu.stork.peps.auth.commons.PersonalAttributeList;
/**
* Just a simple demoprovider who can fetch any attribute you ask him.
@@ -16,7 +18,7 @@ public class DemoRedirectAttributeProvider implements AttributeProvider {
* @see at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider#acquire(java.lang.String)
*/
@Override
- public PersonalAttribute acquire(String attributeName)
+ public IPersonalAttributeList acquire(PersonalAttribute attributeName)
throws UnsupportedAttributeException, ExternalAttributeRequestRequiredException {
throw new ExternalAttributeRequestRequiredException(this);
}
@@ -25,8 +27,10 @@ public class DemoRedirectAttributeProvider implements AttributeProvider {
* @see at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider#parse(javax.servlet.http.HttpServletRequest)
*/
@Override
- public PersonalAttribute parse(HttpServletRequest httpReq) {
- return new PersonalAttribute("sepp", true, new ArrayList<String>(), "");
+ public IPersonalAttributeList parse(HttpServletRequest httpReq) {
+ PersonalAttributeList requestedAttributes = new PersonalAttributeList(1);
+ requestedAttributes.add(new PersonalAttribute("sepp", true, new ArrayList<String>(), ""));
+ return requestedAttributes;
}
/* (non-Javadoc)