Projet

Général

Profil

« Précédent | Suivant » 

Révision 07b53fb3

Ajouté par Thomas Noël il y a plus de 9 ans

add get_federations in pfconfigxml.py

Voir les différences:

usr/local/univnautes/sp/sp/pfconfigxml.py
157 157
                },
158 158
            }
159 159

  
160
def get_federations():
161
    """
162
    <federation>
163
        <enable/>
164
        <codename>renater_test</codename>
165
        <refid>fed_53d1161955a26</refid>
166
        <descr><![CDATA[Renater TEST Federation]]></descr>
167
        <url>https://federation.renater.fr/test/renater-test-metadata.xml</url>
168
        <certref>53d115fac567b</certref>
169
    </federation>
170
    """
171
    xml_federations = root().find('univnautes/federations')
172
    if xml_federations is None:
173
        return []
174
    xml_federations = xml_federations.findall('federation')
175
    federations = []
176
    for xml_federation in xml_federations:
177
        if xml_federation.find('enable') is None:
178
            continue
179
        codename = xml_federation.find('codename')
180
        if codename is not None:
181
            codename = codename.text
182
        url = xml_federation.find('url')
183
        if url is not None:
184
            url = url.text
185
        descr = xml_federation.find('descr')
186
        if descr is not None:
187
            descr = descr.text
188
        certref = xml_federation.find('certref')
189
        if certref is not None:
190
            signcert = get_cert(certref.text).get('crt')
191
        else:
192
            signcert = None
193
        federations.append({
194
            'codename': codename,
195
            'url': url,
196
            'signcert': signcert,
197
            'descr': descr,
198
            })
199
    return federations
200

  

Formats disponibles : Unified diff