aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/utils
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-06-25 09:48:33 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-06-25 09:48:33 +0200
commit8656e29837ec80ff8dc0bd0db826d7545b315d40 (patch)
treec1de8980535c493bf800dd78f425cd3d9452cbf6 /id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/utils
parent7e76287e8a443140d15483d2ce475f259e8215a9 (diff)
downloadmoa-id-spss-8656e29837ec80ff8dc0bd0db826d7545b315d40.tar.gz
moa-id-spss-8656e29837ec80ff8dc0bd0db826d7545b315d40.tar.bz2
moa-id-spss-8656e29837ec80ff8dc0bd0db826d7545b315d40.zip
Mandate support with PVP2
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/utils')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/utils/CheckMandateAttributes.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/utils/CheckMandateAttributes.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/utils/CheckMandateAttributes.java
new file mode 100644
index 000000000..66d0b1d46
--- /dev/null
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/utils/CheckMandateAttributes.java
@@ -0,0 +1,47 @@
+package at.gv.egovernment.moa.id.protocols.pvp2x.utils;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.opensaml.saml2.metadata.AttributeConsumingService;
+import org.opensaml.saml2.metadata.RequestedAttribute;
+
+import at.gv.egovernment.moa.id.protocols.pvp2x.PVPConstants;
+
+public class CheckMandateAttributes implements PVPConstants {
+ private static List<String> minMandateAttributes;
+
+ static {
+ minMandateAttributes = new ArrayList<String>();
+ minMandateAttributes.add(MANDATE_TYPE_NAME);
+
+ minMandateAttributes.add(MANDATE_LEG_PER_FULL_NAME_NAME);
+ minMandateAttributes.add(MANDATE_LEG_PER_SOURCE_PIN_NAME);
+ minMandateAttributes.add(MANDATE_LEG_PER_SOURCE_PIN_TYPE_NAME);
+
+ minMandateAttributes.add(MANDATE_NAT_PER_BIRTHDATE_NAME);
+ minMandateAttributes.add(MANDATE_NAT_PER_GIVEN_NAME_NAME);
+ minMandateAttributes.add(MANDATE_NAT_PER_BPK_NAME);
+ minMandateAttributes.add(MANDATE_NAT_PER_FAMILY_NAME_NAME);
+
+ minMandateAttributes.add(MANDATE_PROF_REP_OID_NAME);
+ minMandateAttributes.add(MANDATE_PROF_REP_DESC_NAME);
+ minMandateAttributes.add(MANDATE_REFERENCE_VALUE_NAME);
+ }
+
+ public static boolean canHandleMandate(AttributeConsumingService attributeConsumer) {
+ List<String> attrList = new ArrayList<String>(minMandateAttributes);
+ Iterator<RequestedAttribute> attrIt = attributeConsumer.getRequestAttributes().iterator();
+
+ while(attrIt.hasNext()) {
+ RequestedAttribute reqAttr = attrIt.next();
+
+ if(attrList.contains(reqAttr.getName())) {
+ attrList.remove(reqAttr.getName());
+ }
+ }
+
+ return attrList.isEmpty();
+ }
+}