本文整理汇总了Python中saml2.config.IdPConfig.context方法的典型用法代码示例。如果您正苦于以下问题:Python IdPConfig.context方法的具体用法?Python IdPConfig.context怎么用?Python IdPConfig.context使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类saml2.config.IdPConfig
的用法示例。
在下文中一共展示了IdPConfig.context方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_idp_1
# 需要导入模块: from saml2.config import IdPConfig [as 别名]
# 或者: from saml2.config.IdPConfig import context [as 别名]
def test_idp_1():
c = IdPConfig().load(IDP1)
c.context = "idp"
print c
assert c.endpoint("single_sign_on_service")[0] == 'http://localhost:8088/'
attribute_restrictions = c.getattr("policy","idp").get_attribute_restriction("")
assert attribute_restrictions["eduPersonAffiliation"][0].match("staff")
示例2: test_idp_2
# 需要导入模块: from saml2.config import IdPConfig [as 别名]
# 或者: from saml2.config.IdPConfig import context [as 别名]
def test_idp_2():
c = IdPConfig().load(IDP2)
c.context = "idp"
print(c)
assert c.endpoint("single_logout_service", BINDING_SOAP) == []
assert c.endpoint("single_logout_service", BINDING_HTTP_REDIRECT) == ["http://localhost:8088/"]
attribute_restrictions = c.getattr("policy", "idp").get_attribute_restrictions("")
assert attribute_restrictions["edupersonaffiliation"][0].match("staff")
示例3: test_assertion_consumer_service
# 需要导入模块: from saml2.config import IdPConfig [as 别名]
# 或者: from saml2.config.IdPConfig import context [as 别名]
def test_assertion_consumer_service():
c = IdPConfig()
c.load_file(dotname("idp_conf"))
c.context = "idp"
c.metadata.load("local", full_path("InCommon-metadata.xml"))
entity_id = "https://www.zimride.com/shibboleth"
acs = c.metadata.assertion_consumer_service(entity_id)
assert len(acs) == 1
assert acs[0]["location"] == 'https://www.zimride.com/Shibboleth.sso/SAML2/POST'
示例4: test_assertion_consumer_service
# 需要导入模块: from saml2.config import IdPConfig [as 别名]
# 或者: from saml2.config.IdPConfig import context [as 别名]
def test_assertion_consumer_service():
c = IdPConfig()
c.load_file("idp_conf")
c.context = "idp"
xml_src = open("inCommon-metadata.xml").read()
# A trick so outdated data is allowed
c.metadata.import_metadata(xml_src, "-")
print c.metadata.entity.keys()
entity_id = "https://www.zimride.com/shibboleth"
acs = c.assertion_consumer_services(entity_id)
assert len(acs) == 1
assert acs[0].location == 'https://www.zimride.com/Shibboleth.sso/SAML2/POST'