當前位置: 首頁>>代碼示例>>Python>>正文


Python UsernamePasswordMako.authenticated_as方法代碼示例

本文整理匯總了Python中oic.utils.authn.user.UsernamePasswordMako.authenticated_as方法的典型用法代碼示例。如果您正苦於以下問題:Python UsernamePasswordMako.authenticated_as方法的具體用法?Python UsernamePasswordMako.authenticated_as怎麽用?Python UsernamePasswordMako.authenticated_as使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在oic.utils.authn.user.UsernamePasswordMako的用法示例。


在下文中一共展示了UsernamePasswordMako.authenticated_as方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_authenticated_as

# 需要導入模塊: from oic.utils.authn.user import UsernamePasswordMako [as 別名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import authenticated_as [as 別名]
    def test_authenticated_as(self, srv):
        form = create_return_form_env("user", "hemligt", "QUERY")

        authn = UsernamePasswordMako(srv, "login.mako", tl, PASSWD,
                                     "authorization_endpoint")
        response, success = authn.verify(compact(parse_qs(form)))

        headers = dict(response.headers)
        user, timestamp = authn.authenticated_as(headers["Set-Cookie"])
        assert user == {"uid": "user"}
開發者ID:Magosgruss,項目名稱:pyoidc,代碼行數:12,代碼來源:test_user.py

示例2: test_not_authenticated

# 需要導入模塊: from oic.utils.authn.user import UsernamePasswordMako [as 別名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import authenticated_as [as 別名]
    def test_not_authenticated(self, srv):
        form = create_return_form_env("user", "hemligt", "QUERY")

        authn = UsernamePasswordMako(srv, "login.mako", tl, PASSWD,
                                     "authorization_endpoint")
        response, state = authn.verify(compact(parse_qs(form)))

        headers = dict(response.headers)
        kaka = headers["Set-Cookie"]

        kaka = kaka.replace("1", "x")
        assert authn.authenticated_as(kaka) == (None, 0)
開發者ID:Magosgruss,項目名稱:pyoidc,代碼行數:14,代碼來源:test_user.py

示例3: test_5

# 需要導入模塊: from oic.utils.authn.user import UsernamePasswordMako [as 別名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import authenticated_as [as 別名]
def test_5():
    form = create_return_form_env("user", "hemligt", "QUERY")
    srv = SRV()
    srv.symkey = rndstr(16)
    srv.seed = rndstr()
    srv.iv = os.urandom(16)
    srv.cookie_name = "xyzxyz"

    authn = UsernamePasswordMako(srv, "login.mako", tl, PASSWD,
                                 "authorization_endpoint")
    response = authn.verify(parse_qs(form))

    kaka = ""
    for param, val in response.headers:
        if param == "Set-Cookie":
            kaka = val
            break

    kaka = kaka.replace("1", "x")
    try:
        _ = authn.authenticated_as(kaka)
        assert False
    except Exception:
        assert True
開發者ID:ghedin,項目名稱:pyoidc,代碼行數:26,代碼來源:test_authn.py

示例4: test_1

# 需要導入模塊: from oic.utils.authn.user import UsernamePasswordMako [as 別名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import authenticated_as [as 別名]
def test_1():
    authn = UsernamePasswordMako(None, "login.mako", tl, PASSWD,
                                 "authorization_endpoint")
    assert authn.authenticated_as() is None
開發者ID:ghedin,項目名稱:pyoidc,代碼行數:6,代碼來源:test_authn.py

示例5: test_authenticated_as_no_cookie

# 需要導入模塊: from oic.utils.authn.user import UsernamePasswordMako [as 別名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import authenticated_as [as 別名]
 def test_authenticated_as_no_cookie(self):
     authn = UsernamePasswordMako(None, "login.mako", tl, PASSWD,
                                  "authorization_endpoint")
     res = authn.authenticated_as()
     assert res == (None, 0)
開發者ID:Magosgruss,項目名稱:pyoidc,代碼行數:7,代碼來源:test_user.py


注:本文中的oic.utils.authn.user.UsernamePasswordMako.authenticated_as方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。