diff --git a/src/saml2/mdstore.py b/src/saml2/mdstore.py index e4a4785..621752b 100644 --- a/src/saml2/mdstore.py +++ b/src/saml2/mdstore.py @@ -269,7 +269,7 @@ class MetaData(object): """ Return any entity that matches the specification - :param typ: + :param typ: Type of entity :param service: :param binding: :return: @@ -282,6 +282,37 @@ class MetaData(object): return res + def any2(self, typ, service, binding=None): + """ + + :param type: + :param service: + :param binding: + :return: + """ + res = {} + for entid, item in self.items(): + hit = False + try: + descr = item['{}sso_descriptor'.format(typ)] + except KeyError: + continue + else: + for desc in descr: + try: + srvs = desc[service] + except KeyError: + continue + else: + for srv in srvs: + if srv['binding'] == binding: + res[entid] = item + hit = True + break + if hit: + break + return res + def bindings(self, entity_id, typ, service): """ Get me all the bindings that are registered for a service entity