@@ -706,6 +706,17 @@ def entity_extended_display_i18n(entity, default_lang=None):
706706 return name_dict , desc_dict
707707
708708
709+ def entity_attribute (entity , attribute ):
710+ values = None
711+ els = entity .findall (
712+ './/{%s}EntityAttributes/{%s}Attribute[@Name="%s"]/{%s}AttributeValue'
713+ % (NS ['mdattr' ], NS ['saml' ], attribute , NS ['saml' ])
714+ )
715+ if len (els ) > 0 :
716+ values = [el .text for el in els ]
717+ return values
718+
719+
709720def entity_categories (entity ):
710721 cats = None
711722 cats_els = entity .findall (
@@ -717,6 +728,28 @@ def entity_categories(entity):
717728 return cats
718729
719730
731+ def assurance_cetification (entity ):
732+ certs = None
733+ certs_els = entity .findall (
734+ './/{%s}EntityAttributes/{%s}Attribute[@Name="urn:oasis:names:tc:SAML:attribute:assurance-certification"]/{%s}AttributeValue'
735+ % (NS ['mdattr' ], NS ['saml' ], NS ['saml' ])
736+ )
737+ if len (certs_els ) > 0 :
738+ certs = [el .text for el in certs_els ]
739+ return certs
740+
741+
742+ def entity_category_support (entity ):
743+ cats = None
744+ cats_els = entity .findall (
745+ './/{%s}EntityAttributes/{%s}Attribute[@Name="http://macedir.org/entity-category-support"]/{%s}AttributeValue'
746+ % (NS ['mdattr' ], NS ['saml' ], NS ['saml' ])
747+ )
748+ if len (cats_els ) > 0 :
749+ cats = [el .text for el in cats_els ]
750+ return cats
751+
752+
720753def registration_authority (entity ):
721754 regauth_el = entity .find (".//{%s}RegistrationInfo" % NS ['mdrpi' ])
722755 if regauth_el is not None :
@@ -812,7 +845,9 @@ def discojson(e, sources=None, langs=None, fallback_to_favicon=False, icon_store
812845 entity_id = e .get ('entityID' )
813846 title_langs , descr_langs = entity_extended_display_i18n (e )
814847 reg_auth = registration_authority (e )
815- cats = entity_categories (e )
848+ categories = entity_attribute (e , "http://macedir.org/entity-category" )
849+ certifications = entity_attribute (e , "urn:oasis:names:tc:SAML:attribute:assurance-certification" )
850+ cat_support = entity_attribute (e , "http://macedir.org/entity-category-support" )
816851
817852 d = dict (
818853 title = title ,
@@ -826,8 +861,14 @@ def discojson(e, sources=None, langs=None, fallback_to_favicon=False, icon_store
826861 if reg_auth is not None :
827862 d ['registrationAuthority' ] = reg_auth
828863
829- if cats is not None :
830- d ['entity_categories' ] = cats
864+ if categories is not None :
865+ d ['entity_categories' ] = categories
866+
867+ if certifications is not None :
868+ d ['assurance_certifications' ] = certifications
869+
870+ if cat_support is not None :
871+ d ['entity_category_support' ] = cat_support
831872
832873 if sources is not None :
833874 d ['md_sources' ] = sources
0 commit comments