예제 #1
0
def entity_attribute_dict(entity):
    d = {}
    for ea in entity.iter("{%s}EntityAttributes" % NS['mdattr']):
        a = ea.find(".//{%s}Attribute" % NS['saml'])
        if a is not None:
            an = a.get('Name', None)
            if a is not None:
                values = [
                    v.text.strip()
                    for v in a.iter("{%s}AttributeValue" % NS['saml'])
                ]
                d[an] = values

    d[ATTRS['role']] = []

    try:
        dlist = []
        for dn in _domains(entity):
            for sub in subdomains(dn):
                dlist.append(sub)

        d[ATTRS['domain']] = dlist
    except ValueError:
        pass

    if is_idp(entity):
        d[ATTRS['role']].append('idp')
    if is_sp(entity):
        d[ATTRS['role']].append('sp')

    return d
예제 #2
0
파일: store.py 프로젝트: trscavo/pyFF
def entity_attribute_dict(entity):
    d = {}
    for ea in entity.iter("{%s}EntityAttributes" % NS['mdattr']):
        a = ea.find(".//{%s}Attribute" % NS['saml'])
        if a is not None:
            an = a.get('Name', None)
            if a is not None:
                values = [v.text.strip() for v in a.iter("{%s}AttributeValue" % NS['saml'])]
                d[an] = values

    d[ATTRS['role']] = []

    try:
        dlist = []
        for dn in _domains(entity):
            for sub in subdomains(dn):
                dlist.append(sub)

        d[ATTRS['domain']] = dlist
    except ValueError:
        pass

    if is_idp(entity):
        d[ATTRS['role']].append('idp')
    if is_sp(entity):
        d[ATTRS['role']].append('sp')

    return d
예제 #3
0
파일: samlmd.py 프로젝트: clarin-eric/pyFF
def sub_domains(e):
    lst = []
    domains = entity_domains(e)
    for d in domains:
        for sub in subdomains(d):
            if sub not in lst:
                lst.append(sub)
    return lst
예제 #4
0
파일: store.py 프로젝트: identinetics/pyFF
def _all_domains_and_subdomains(entity):
    dlist = []
    try:
        for dn in _domains(entity):
            for sub in subdomains(dn):
                dlist.append(sub)
    except ValueError:
        pass
    return dlist
예제 #5
0
파일: store.py 프로젝트: lhoekenga/pyFF
def _all_domains_and_subdomains(entity):
    dlist = []
    try:
        for dn in _domains(entity):
            for sub in subdomains(dn):
                dlist.append(sub)
    except ValueError:
        pass
    return dlist
예제 #6
0
파일: store.py 프로젝트: br00k/pyFF
def entity_attribute_dict(entity):
    d = {}
    for ea in entity.iter("{%s}EntityAttributes" % NS['mdattr']):
        a = ea.find(".//{%s}Attribute" % NS['saml'])
        if a is not None:
            an = a.get('Name', None)
            if a is not None:
                values = [v.text.strip() for v in a.iter("{%s}AttributeValue" % NS['saml'])]
                d[an] = values

    role_a = ATTRS['role']
    d[role_a] = []

    try:
        dlist = []
        for dn in _domains(entity):
            for sub in subdomains(dn):
                dlist.append(sub)

        d[ATTRS['domain']] = dlist
    except ValueError:
        pass

    if is_idp(entity):
        d[role_a].append('idp')
        eca = ATTRS['entity-category']
        d.setdefault(eca, [])
        ec = d[eca]
        if 'http://refeds.org/category/hide-from-discovery' not in ec:
            d[eca].append('http://pyff.io/category/discoverable')
    if is_sp(entity):
        d[role_a].append('sp')
    if is_aa(entity):
        d[role_a].append('aa')

    return d