aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2014-05-16 13:20:32 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2014-05-16 13:20:32 +0200
commit5bc23bcbeb8b82eec3eabce0c582db8fb4a3c64a (patch)
tree2a4ed1f53cd2c4d6bde685fb85a062b035b12dbc /id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java
parent6163edf5f148262122d0049a6945b127f60bad32 (diff)
parent5b1d68f71a77b80bd39a9c231090a9c63a892811 (diff)
downloadmoa-id-spss-5bc23bcbeb8b82eec3eabce0c582db8fb4a3c64a.tar.gz
moa-id-spss-5bc23bcbeb8b82eec3eabce0c582db8fb4a3c64a.tar.bz2
moa-id-spss-5bc23bcbeb8b82eec3eabce0c582db8fb4a3c64a.zip
Merge remote-tracking branch 'remotes/origin/vidp_2.1_bs' into moa-2.1-Snapshot
Conflicts: id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java
index 8616b0430..edba7b754 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java
@@ -2,6 +2,7 @@ package at.gv.egovernment.moa.id.protocols.stork2;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
+import at.gv.egovernment.moa.id.commons.db.dao.config.AttributeProviderPlugin;
import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
import at.gv.egovernment.moa.id.data.IAuthData;
import at.gv.egovernment.moa.id.util.HTTPUtils;
@@ -18,6 +19,8 @@ import org.apache.velocity.app.VelocityEngine;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
/**
* Provides mandate attribute from MIS
@@ -66,6 +69,28 @@ public class MandateAttributeRequestProvider implements AttributeProvider {
throw new ExternalAttributeRequestRequiredException(this);
}
+ @Override
+ public IPersonalAttributeList acquire(List<PersonalAttribute> attributes, String spCountryCode, IAuthData moasession) throws UnsupportedAttributeException, ExternalAttributeRequestRequiredException, MOAIDException {
+ Logger.info("Acquiring " + attributes.size() + " attributes, by: " + getAttrProviderName());
+ this.spCountryCode = spCountryCode;
+ requestedAttributes = new PersonalAttributeList(attributes.size());
+
+ for (PersonalAttribute personalAttribute : attributes) {
+ // break if we cannot handle the requested attribute
+ if (!this.attributes.contains(personalAttribute.getName())) {
+ Logger.info("Attribute " + personalAttribute.getName() + " not supported by the provider: " + getAttrProviderName());
+ throw new UnsupportedAttributeException();
+ }
+ requestedAttributes.add(personalAttribute);
+ }
+
+ Logger.info("Thrown external request by: " + getAttrProviderName());
+ throw new ExternalAttributeRequestRequiredException(this);
+ }
+
+
+
+
public void performRedirect(String url, HttpServletRequest req, HttpServletResponse resp, OAAuthParameter oaParam) throws MOAIDException {
String spSector = "Business";
@@ -88,6 +113,9 @@ public class MandateAttributeRequestProvider implements AttributeProvider {
attributeRequest.setCitizenCountryCode("AT");
+
+
+
Logger.info("STORK AttrRequest successfully assembled.");
STORKSAMLEngine samlEngine = STORKSAMLEngine.getInstance("VIDP");
@@ -125,5 +153,15 @@ public class MandateAttributeRequestProvider implements AttributeProvider {
return null; //
}
+ @Override
+ public List<String> getSupportedAttributeNames() throws MOAIDException {
+ ArrayList<String> supportedAttributeNames = new ArrayList<String>();
+ for (String attributeName : this.attributes.split(",")) {
+ supportedAttributeNames.add(attributeName);
+ }
+ return supportedAttributeNames;
+ }
+
+
}