diff --git a/src/saml2/config.py b/src/saml2/config.py index 30bd1dc..402bb29 100644 --- a/src/saml2/config.py +++ b/src/saml2/config.py @@ -350,6 +350,12 @@ class SPConfig(Config): else: return self.metadata.idps() + def vo_conf(self, vo_name): + try: + return self.virtual_organization[vo_name] + except KeyError: + return None + class IdPConfig(Config): def_context = "idp" diff --git a/src/saml2/virtual_org.py b/src/saml2/virtual_org.py index fe7d936..b025343 100644 --- a/src/saml2/virtual_org.py +++ b/src/saml2/virtual_org.py @@ -14,7 +14,7 @@ class VirtualOrg(object): def _affiliation_members(self): """ Get the member of the Virtual Organization from the metadata, - more specifically a AffiliationDescriptor. + more specifically from AffiliationDescriptor. """ return self.config.metadata.vo_members(self.vorg_name) @@ -25,7 +25,7 @@ class VirtualOrg(object): try: return self.vorg_conf["member"] - except KeyError: + except (KeyError, TypeError): return [] def members_to_ask(self, subject_id): @@ -49,7 +49,10 @@ class VirtualOrg(object): (ava, _) = self.sp.users.get_identity(subject_id) ident = self.vorg_conf["common_identifier"] - return ava[ident][0] + try: + return ava[ident][0] + except KeyError: + return None def do_aggregation(self, subject_id, log=None): if log: