summaryrefslogtreecommitdiff
path: root/src/saml2/mdstore.py
diff options
context:
space:
mode:
authorRoland Hedberg <roland.hedberg@adm.umu.se>2015-12-11 09:24:21 +0100
committerRoland Hedberg <roland.hedberg@adm.umu.se>2015-12-11 09:24:21 +0100
commit82d3b4da6ebd19f556d2f4d377236a05bb64cd75 (patch)
tree27604fb51f336698c9351e6c3c688677bcf031db /src/saml2/mdstore.py
parent883b89efb07acf6e28eb177f9f582aad1e33ba58 (diff)
parente6151b52c357879476a4afc973383f8a73becd2e (diff)
downloadpysaml2-82d3b4da6ebd19f556d2f4d377236a05bb64cd75.tar.gz
Merge branch 'master' of github.com:rohe/pysaml2
Diffstat (limited to 'src/saml2/mdstore.py')
-rw-r--r--src/saml2/mdstore.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/saml2/mdstore.py b/src/saml2/mdstore.py
index b4caece6..c6bb1ecb 100644
--- a/src/saml2/mdstore.py
+++ b/src/saml2/mdstore.py
@@ -1,11 +1,9 @@
from __future__ import print_function
-
import hashlib
import logging
import os
import sys
import json
-
import requests
import six
from hashlib import sha1
@@ -950,6 +948,24 @@ class MetadataStore(MetaData):
logger.error("Unknown system entity: %s", entity_id)
raise UnknownSystemEntity(entity_id)
+ def extension(self, entity_id, typ, service):
+ for key, _md in self.metadata.items():
+ try:
+ srvs = _md[entity_id][typ]
+ except KeyError:
+ return None
+
+ if not srvs:
+ return srvs
+
+ res = []
+ for srv in srvs:
+ if "extensions" in srv:
+ for elem in srv["extensions"]["extension_elements"]:
+ if elem["__class__"] == service:
+ res.append(elem)
+ return res
+
def ext_service(self, entity_id, typ, service, binding=None):
known_entity = False
for key, _md in self.metadata.items():