Projet

Général

Profil

« Précédent | Suivant » 

Révision 384aa755

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

pfconfigxml: add get_whitelists()

Voir les différences:

usr/local/univnautes/sp/sp/pfconfigxml.py
187 187
            descr = descr.text
188 188
        certref = xml_federation.find('certref')
189 189
        if certref is not None:
190
            signcert = get_cert(certref.text).get('crt')
190
            signcert = (get_cert(certref.text) or {}).get('crt')
191 191
        else:
192 192
            signcert = None
193 193
        federations.append({
......
198 198
            })
199 199
    return federations
200 200

  
201
def get_whitelists():
202
    """
203
    <whitelist>
204
        <refid>whitelist_53d12b4ba06c2</refid>
205
        <codename>eduspot</codename>
206
        <descr><![CDATA[Whitelist eduspot]]></descr>
207
        <url>https://www.cru.fr/eduspot/whitelist-eduspot.txt</url>
208
        <caref>53d1166cc8bae</caref>
209
    </whitelist>
210
    """
211
    xml_whitelists = root().find('univnautes/whitelists')
212
    if xml_whitelists is None:
213
        return []
214
    xml_whitelists = xml_whitelists.findall('whitelist')
215
    whitelists = []
216
    for xml_whitelist in xml_whitelists:
217
        refid = xml_whitelist.find('refid')
218
        if refid is not None:
219
            refid = refid.text
220
        codename = xml_whitelist.find('codename')
221
        if codename is not None:
222
            codename = codename.text
223
        descr = xml_whitelist.find('descr')
224
        if descr is not None:
225
            descr = descr.text
226
        url = xml_whitelist.find('url')
227
        if url is not None:
228
            url = url.text
229
        caref = xml_whitelist.find('caref')
230
        if caref is not None:
231
            cacert = (get_ca(caref.text) or {}).get('crt')
232
        else:
233
            cacert = None
234
        whitelists.append({
235
            'id': refid,
236
            'codename': codename,
237
            'url': url,
238
            'cacert': cacert,
239
            'descr': descr,
240
            })
241
    return whitelists
242

  

Formats disponibles : Unified diff