當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。