• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python saml2_tophat.create_class_from_xml_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中saml2_tophat.create_class_from_xml_string函数的典型用法代码示例。如果您正苦于以下问题:Python create_class_from_xml_string函数的具体用法?Python create_class_from_xml_string怎么用?Python create_class_from_xml_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了create_class_from_xml_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_create_class_from_xml_string_nameid

def test_create_class_from_xml_string_nameid():
    kl = create_class_from_xml_string(NameID, ITEMS[NameID][0])
    assert kl != None
    assert kl.format == "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
    assert kl.sp_provided_id == "sp provided id"
    assert kl.text.strip() == "[email protected]"
    assert _eq(kl.keyswv(), ['sp_provided_id', 'format', 'text'])
    assert class_name(kl) == "urn:oasis:names:tc:SAML:2.0:assertion:NameID"
    assert _eq(kl.keys(), ['sp_provided_id', 'sp_name_qualifier',
                           'name_qualifier', 'format', 'text'])

    kl = create_class_from_xml_string(NameID, ITEMS[NameID][1])
    assert kl != None
    assert kl.format == "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
    assert kl.sp_name_qualifier == "https://foo.example.com/sp"
    assert kl.text.strip() == "_1632879f09d08ea5ede2dc667cbed7e429ebc4335c"
    assert _eq(kl.keyswv(), ['sp_name_qualifier', 'format', 'text'])
    assert class_name(kl) == "urn:oasis:names:tc:SAML:2.0:assertion:NameID"

    kl = create_class_from_xml_string(NameID, ITEMS[NameID][2])
    assert kl != None
    assert kl.format == "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
    assert kl.name_qualifier == "http://authentic.example.com/saml/metadata"
    assert kl.sp_name_qualifier == "http://auth.example.com/saml/metadata"
    assert kl.text.strip() == "test"
    assert _eq(kl.keyswv(), ['sp_name_qualifier', 'format', 'name_qualifier',
                             'text'])
    assert class_name(kl) == "urn:oasis:names:tc:SAML:2.0:assertion:NameID"
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:28,代码来源:test_03_saml2.py


示例2: test_create_class_from_xml_string_xxe

def test_create_class_from_xml_string_xxe():
    xml = """<?xml version="1.0"?>
    <!DOCTYPE lolz [
    <!ENTITY lol "lol">
    <!ELEMENT lolz (#PCDATA)>
    <!ENTITY lol1 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;">
    ]>
    <lolz>&lol1;</lolz>
    """
    with raises(EntitiesForbidden) as err:
        create_class_from_xml_string(NameID, xml)
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:11,代码来源:test_03_saml2.py


示例3: test_subject_confirmation_with_extension

def test_subject_confirmation_with_extension():
    kl = create_class_from_xml_string(SubjectConfirmation,
                                      SUBJECT_CONFIRMATION_WITH_MEMBER_EXTENSION)
    assert kl != None
    print(kl.__dict__)
    assert kl.extension_attributes == {}
    assert kl.method == "urn:oasis:names:tc:SAML:2.0:cm:bearer"
    name_id = kl.name_id
    assert _eq(name_id.keyswv(), ['format', 'name_qualifier', 'text'])
    assert name_id.format == "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
    assert name_id.name_qualifier == "http://authentic.example.com/saml/metadata"
    assert name_id.text.strip() == "[email protected]"
    subject_confirmation_data = kl.subject_confirmation_data
    assert _eq(subject_confirmation_data.keyswv(), ['not_on_or_after',
                                                    'recipient',
                                                    'in_response_to'])
    assert subject_confirmation_data.recipient == \
           "http://auth.example.com/saml/proxySingleSignOnRedirect"
    assert subject_confirmation_data.not_on_or_after == "2010-02-17T17:02:38Z"
    assert subject_confirmation_data.in_response_to == \
           "_59B3A01B03334032C31E434C63F89E3E"
    assert len(kl.extension_elements) == 1
    ee = kl.extension_elements[0]
    assert ee.tag == "Trustlevel"
    assert ee.namespace == "urn:mace:example.com:saml:assertion"
    assert ee.text.strip() == "Excellent"
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:26,代码来源:test_03_saml2.py


示例4: test_to_fro_string_1

def test_to_fro_string_1():
    kl = create_class_from_xml_string(SubjectConfirmation,
                                      SUBJECT_CONFIRMATION_WITH_MEMBER_EXTENSION)
    txt = kl.to_string()
    cpy = create_class_from_xml_string(SubjectConfirmation, txt)

    print(kl.__dict__)
    print(cpy.__dict__)

    assert kl.text.strip() == cpy.text.strip()
    assert _eq(kl.keyswv(), cpy.keyswv())
    assert len(kl.extension_elements) == len(cpy.extension_elements)
    klee = kl.extension_elements[0]
    cpyee = cpy.extension_elements[0]
    assert klee.text.strip() == cpyee.text.strip()
    assert klee.tag == cpyee.tag
    assert klee.namespace == cpyee.namespace
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:17,代码来源:test_03_saml2.py


示例5: test_create_class_from_xml_string_subject_locality

def test_create_class_from_xml_string_subject_locality():
    kl = create_class_from_xml_string(SubjectLocality, ITEMS[SubjectLocality])
    assert kl != None
    assert _eq(kl.keyswv(), ['address', "dns_name"])
    assert kl.address == "127.0.0.1"
    assert kl.dns_name == "localhost"
    assert class_name(
        kl) == "urn:oasis:names:tc:SAML:2.0:assertion:SubjectLocality"
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:8,代码来源:test_03_saml2.py


示例6: test_create_class_from_xml_string_subject_confirmation_data

def test_create_class_from_xml_string_subject_confirmation_data():
    kl = create_class_from_xml_string(SubjectConfirmationData,
                                      ITEMS[SubjectConfirmationData])
    assert kl != None
    assert _eq(kl.keyswv(), ['in_response_to', 'not_on_or_after',
                             'not_before', 'recipient'])
    assert kl.in_response_to == "_1683146e27983964fbe7bf8f08961108d166a652e5"
    assert kl.not_on_or_after == "2010-02-18T13:52:13.959Z"
    assert kl.not_before == "2010-01-16T12:00:00Z"
    assert kl.recipient == "http://192.168.0.10/saml/sp"
    assert class_name(kl) == \
           "urn:oasis:names:tc:SAML:2.0:assertion:SubjectConfirmationData"
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:12,代码来源:test_03_saml2.py


示例7: test_nameid_with_extension

def test_nameid_with_extension():
    kl = create_class_from_xml_string(NameID, NAMEID_WITH_ATTRIBUTE_EXTENSION)
    assert kl != None
    print(kl.__dict__)
    assert kl.format == "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
    assert kl.sp_provided_id == "sp provided id"
    assert kl.text.strip() == "[email protected]"
    assert _eq(kl.keyswv(), ['sp_provided_id', 'format',
                             'extension_attributes', 'text'])
    assert class_name(kl) == "urn:oasis:names:tc:SAML:2.0:assertion:NameID"
    assert _eq(kl.keys(), ['sp_provided_id', 'sp_name_qualifier',
                           'name_qualifier', 'format', 'text'])
    assert kl.extension_attributes == {
        '{urn:mace:example.com:saml:assertion}Foo': 'BAR'}
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:14,代码来源:test_03_saml2.py


示例8: test_attribute_element_to_extension_element

def test_attribute_element_to_extension_element():
    attr = create_class_from_xml_string(Attribute, saml2_data.TEST_ATTRIBUTE)
    ee = saml2_tophat.element_to_extension_element(attr)
    print(ee.__dict__)
    assert ee.tag == "Attribute"
    assert ee.namespace == 'urn:oasis:names:tc:SAML:2.0:assertion'
    assert _eq(ee.attributes.keys(), ['FriendlyName', 'Name', 'NameFormat'])
    assert ee.attributes["FriendlyName"] == 'test attribute'
    assert ee.attributes["Name"] == "testAttribute"
    assert ee.attributes["NameFormat"] == \
           'urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified'
    assert len(ee.children) == 2
    for child in ee.children:
        # children are also extension element instances
        assert child.namespace == 'urn:oasis:names:tc:SAML:2.0:assertion'
        assert child.tag == "AttributeValue"
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:16,代码来源:test_03_saml2.py


示例9: test_create_class_from_xml_string_subject_confirmation

def test_create_class_from_xml_string_subject_confirmation():
    kl = create_class_from_xml_string(SubjectConfirmation,
                                      ITEMS[SubjectConfirmation])
    assert kl != None
    assert _eq(kl.keyswv(), ['method', 'name_id',
                             'subject_confirmation_data'])
    assert kl.method == "urn:oasis:names:tc:SAML:2.0:cm:bearer"
    name_id = kl.name_id
    assert _eq(name_id.keyswv(), ['format', 'name_qualifier', 'text'])
    assert name_id.format == "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
    assert name_id.name_qualifier == "http://authentic.example.com/saml/metadata"
    assert name_id.text.strip() == "[email protected]"
    subject_confirmation_data = kl.subject_confirmation_data
    assert _eq(subject_confirmation_data.keyswv(), ['not_on_or_after',
                                                    'recipient',
                                                    'in_response_to'])
    assert subject_confirmation_data.recipient == \
           "http://auth.example.com/saml/proxySingleSignOnRedirect"
    assert subject_confirmation_data.not_on_or_after == "2010-02-17T17:02:38Z"
    assert subject_confirmation_data.in_response_to == \
           "_59B3A01B03334032C31E434C63F89E3E"
    assert class_name(kl) == \
           "urn:oasis:names:tc:SAML:2.0:assertion:SubjectConfirmation"
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:23,代码来源:test_03_saml2.py


示例10: encoded_string__from_string

def encoded_string__from_string(xml_string):
    return saml2_tophat.create_class_from_xml_string(EncodedString_, xml_string)
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:2,代码来源:wssec.py


示例11: faultcode_enum__from_string

def faultcode_enum__from_string(xml_string):
    return saml2_tophat.create_class_from_xml_string(FaultcodeEnum_, xml_string)
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:2,代码来源:wssec.py


示例12: transformation_parameters_from_string

def transformation_parameters_from_string(xml_string):
    return saml2_tophat.create_class_from_xml_string(TransformationParameters, xml_string)
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:2,代码来源:wssec.py


示例13: security_token_reference_from_string

def security_token_reference_from_string(xml_string):
    return saml2_tophat.create_class_from_xml_string(SecurityTokenReference, xml_string)
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:2,代码来源:wssec.py


示例14: key_identifier_from_string

def key_identifier_from_string(xml_string):
    return saml2_tophat.create_class_from_xml_string(KeyIdentifier, xml_string)
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:2,代码来源:wssec.py


示例15: reference_from_string

def reference_from_string(xml_string):
    return saml2_tophat.create_class_from_xml_string(Reference, xml_string)
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:2,代码来源:wssec.py


示例16: username_token_from_string

def username_token_from_string(xml_string):
    return saml2_tophat.create_class_from_xml_string(UsernameToken, xml_string)
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:2,代码来源:wssec.py


示例17: binary_security_token_from_string

def binary_security_token_from_string(xml_string):
    return saml2_tophat.create_class_from_xml_string(BinarySecurityToken, xml_string)
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:2,代码来源:wssec.py


示例18: relationship_type__from_string

def relationship_type__from_string(xml_string):
    return saml2_tophat.create_class_from_xml_string(RelationshipType_, xml_string)
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:2,代码来源:wsaddr.py


示例19: embedded_from_string

def embedded_from_string(xml_string):
    return saml2_tophat.create_class_from_xml_string(Embedded, xml_string)
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:2,代码来源:wssec.py


示例20: attributed_uri_type__from_string

def attributed_uri_type__from_string(xml_string):
    return saml2_tophat.create_class_from_xml_string(AttributedURIType_, xml_string)
开发者ID:tophatmonocle,项目名称:pysaml2,代码行数:2,代码来源:wsaddr.py



注:本文中的saml2_tophat.create_class_from_xml_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sample.ObjectType类代码示例发布时间:2022-05-27
下一篇:
Python validate.validate_on_or_after函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap