Ejemplo n.º 1
0
def test_do_sp_sso_descriptor_2():
    SP["service"]["sp"]["discovery_response"] = "http://example.com/sp/ds"
    
    conf = SPConfig().load(SP, metadata_construction=True)
    spsso = metadata.do_spsso_descriptor(conf)

    assert isinstance(spsso, md.SPSSODescriptor)
    print spsso.keyswv()
    assert _eq(spsso.keyswv(), ['authn_requests_signed',
                                'attribute_consuming_service',
                                'single_logout_service',
                                'protocol_support_enumeration',
                                'assertion_consumer_service',
                                'want_assertions_signed',
                                'extensions'])

    exts = spsso.extensions.extension_elements
    assert len(exts) == 1
    print exts
    idpd = saml2.extension_element_to_element(exts[0],
                                              idpdisc.ELEMENT_FROM_STRING,
                                              namespace=idpdisc.NAMESPACE)
    print idpd
    assert idpd.location == "http://example.com/sp/ds"
    assert idpd.index == "0"
    assert idpd.binding == "urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol"
Ejemplo n.º 2
0
def test_do_sp_sso_descriptor():
    conf = SPConfig().load(SP, metadata_construction=True)
    spsso = metadata.do_spsso_descriptor(conf)
    
    assert isinstance(spsso, md.SPSSODescriptor)
    assert _eq(spsso.keyswv(), ['authn_requests_signed', 
                                'attribute_consuming_service', 
                                'single_logout_service', 
                                'protocol_support_enumeration', 
                                'assertion_consumer_service', 
                                'want_assertions_signed'])
                                
    assert spsso.authn_requests_signed == "false"
    assert spsso.want_assertions_signed == "true"
    assert len (spsso.attribute_consuming_service) == 1
    acs = spsso.attribute_consuming_service[0]
    print acs.keyswv()
    assert _eq(acs.keyswv(), ['requested_attribute', 'service_name',
                                 'service_description', 'index'])
    assert acs.service_name[0].text == SP["name"]
    assert acs.service_description[0].text == SP["description"]
    assert len(acs.requested_attribute) == 4
    assert acs.requested_attribute[0].friendly_name == "sn"
    assert acs.requested_attribute[0].name == 'urn:oid:2.5.4.4'
    assert acs.requested_attribute[0].name_format == NAME_FORMAT_URI
    assert acs.requested_attribute[0].is_required == "true"