当前位置: 首页>>代码示例>>Python>>正文


Python AuthnBroker.pick方法代码示例

本文整理汇总了Python中saml2.authn_context.AuthnBroker.pick方法的典型用法代码示例。如果您正苦于以下问题:Python AuthnBroker.pick方法的具体用法?Python AuthnBroker.pick怎么用?Python AuthnBroker.pick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在saml2.authn_context.AuthnBroker的用法示例。


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

示例1: test_authn_2

# 需要导入模块: from saml2.authn_context import AuthnBroker [as 别名]
# 或者: from saml2.authn_context.AuthnBroker import pick [as 别名]
def test_authn_2():
    authn = AuthnBroker()
    target = "https://example.org/login"
    authn.add(AUTHNCTXT, target, 10, "https://example.org")

    result = authn.pick(REQAUTHNCTXT)
    assert len(result) == 1
    method, reference = result[0]
    assert target == method
开发者ID:Amli,项目名称:pysaml2,代码行数:11,代码来源:test_77_authn_context.py

示例2: test_authn_1

# 需要导入模块: from saml2.authn_context import AuthnBroker [as 别名]
# 或者: from saml2.authn_context.AuthnBroker import pick [as 别名]
def test_authn_1():
    ac = authn_context_class_ref(PASSWORDPROTECTEDTRANSPORT)
    rac = requested_authn_context(PASSWORDPROTECTEDTRANSPORT)
    authn = AuthnBroker()
    target = "https://example.org/login"
    authn.add(ac, target, 1, "http://www.example.com")

    result = authn.pick(rac)
    assert len(result) == 1
    method, reference = result[0]
    assert target == method
开发者ID:Amli,项目名称:pysaml2,代码行数:13,代码来源:test_77_authn_context.py

示例3: test_authn_3

# 需要导入模块: from saml2.authn_context import AuthnBroker [as 别名]
# 或者: from saml2.authn_context.AuthnBroker import pick [as 别名]
def test_authn_3():
    authn = AuthnBroker()
    level = 0
    for ref in [AL1, AL2, AL3, AL4]:
        level += 4
        ac = authn_context_class_ref(ref)

        authn.add(ac, REF2METHOD[ref], level,
                  "https://www.example.com/%s" % "al%d" % level)

    rac = requested_authn_context(AL1, "minimum")

    info = authn.pick(rac)
    assert len(info) == 4
    method, ref = info[0]
    assert REF2METHOD[AL1] == method

    rac = requested_authn_context(AL2, "minimum")

    info = authn.pick(rac)
    assert len(info) == 3
    method, ref = info[0]
    assert REF2METHOD[AL2] == method

    rac = requested_authn_context(AL3, "minimum")

    info = authn.pick(rac)
    assert len(info) == 2
    method, ref = info[0]
    assert REF2METHOD[AL3] == method

    rac = requested_authn_context(AL4, "minimum")

    info = authn.pick(rac)
    assert len(info) == 1
    method, ref = info[0]
    assert REF2METHOD[AL4] == method

    rac = requested_authn_context(AL1, "exact")

    info = authn.pick(rac)
    assert len(info) == 1
    method, ref = info[0]
    assert REF2METHOD[AL1] == method

    rac = requested_authn_context(AL1, "better")

    info = authn.pick(rac)
    assert len(info) == 3
开发者ID:Ratler,项目名称:pysaml2,代码行数:51,代码来源:test_77_authn_context.py


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