summaryrefslogtreecommitdiff
path: root/src/saml2/entity_category
diff options
context:
space:
mode:
authorRoland Hedberg <roland.hedberg@adm.umu.se>2013-05-04 10:10:34 +0200
committerRoland Hedberg <roland.hedberg@adm.umu.se>2013-05-04 10:10:34 +0200
commit655a24f0d28e102c213a39ba924d8b0e14da0ed9 (patch)
treefe26a7a21eb1f2124fbacb5e7a5826da9be72ce4 /src/saml2/entity_category
parent76da2bb6bb77110cb782b31663090f28c410b8eb (diff)
downloadpysaml2-655a24f0d28e102c213a39ba924d8b0e14da0ed9.tar.gz
Added support for entity categories.
Diffstat (limited to 'src/saml2/entity_category')
-rw-r--r--src/saml2/entity_category/__init__.py14
-rw-r--r--src/saml2/entity_category/edugain.py10
-rw-r--r--src/saml2/entity_category/swamid.py20
3 files changed, 44 insertions, 0 deletions
diff --git a/src/saml2/entity_category/__init__.py b/src/saml2/entity_category/__init__.py
new file mode 100644
index 00000000..d78e3b99
--- /dev/null
+++ b/src/saml2/entity_category/__init__.py
@@ -0,0 +1,14 @@
+__author__ = 'rolandh'
+
+ENTITYATTRIBUTES = "urn:oasis:names:tc:SAML:metadata:attribute&EntityAttributes"
+
+
+def entity_categories(md):
+ res = []
+ if "extensions" in md:
+ for elem in md["extensions"]["extension_elements"]:
+ if elem["__class__"] == ENTITYATTRIBUTES:
+ for attr in elem["attribute"]:
+ res.append(attr["text"])
+
+ return res \ No newline at end of file
diff --git a/src/saml2/entity_category/edugain.py b/src/saml2/entity_category/edugain.py
new file mode 100644
index 00000000..5a094a73
--- /dev/null
+++ b/src/saml2/entity_category/edugain.py
@@ -0,0 +1,10 @@
+__author__ = 'rolandh'
+
+COC = "http://www.edugain.org/dataprotection/coc-eu-01-draft"
+
+RELEASE = {
+ "": ["eduPersonTargetedID"],
+ COC: ["eduPersonPrincipalName", "eduPersonScopedAffiliation", "email",
+ "givenName", "surname", "displayName", "schacHomeOrganization"]
+}
+
diff --git a/src/saml2/entity_category/swamid.py b/src/saml2/entity_category/swamid.py
new file mode 100644
index 00000000..899086f7
--- /dev/null
+++ b/src/saml2/entity_category/swamid.py
@@ -0,0 +1,20 @@
+__author__ = 'rolandh'
+
+
+NAME = ["givenName", "surname", "initials", "displayName"]
+STATIC_ORG_INFO = ["c", "o", "ou"]
+OTHER = ["eduPersonPrincipalName", "eduPersonScopedAffiliation", "email"]
+
+RESEARCH_AND_EDUCATION = "http://www.swamid.se/category/research-and-education"
+SFS_1993_1153 = "http://www.swamid.se/category/sfs-1993-1153"
+
+EU = "http://www.swamid.se/category/eu-adequate-protection"
+NREN = "http://www.swamid.se/category/nren-service"
+HEI = "http://www.swamid.se/category/hei-service"
+
+RELEASE = {
+ "": ["eduPersonTargetedID"],
+ SFS_1993_1153: ["norEduPersonNIN"],
+ RESEARCH_AND_EDUCATION: NAME + STATIC_ORG_INFO + OTHER,
+}
+