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


Python UsernamePasswordMako.verify方法代码示例

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


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

示例1: test_verify_unauthorized

# 需要导入模块: from oic.utils.authn.user import UsernamePasswordMako [as 别名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import verify [as 别名]
    def test_verify_unauthorized(self, srv):
        form = create_return_form_env("user", "secret", "QUERY")

        authn = UsernamePasswordMako(srv, "login.mako", tl, PASSWD,
                                     "authorization_endpoint")
        response, state = authn.verify(parse_qs(form))
        assert isinstance(response, Unauthorized)
开发者ID:Magosgruss,项目名称:pyoidc,代码行数:9,代码来源:test_user.py

示例2: test_authenticated_as

# 需要导入模块: from oic.utils.authn.user import UsernamePasswordMako [as 别名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import verify [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

示例3: test_verify

# 需要导入模块: from oic.utils.authn.user import UsernamePasswordMako [as 别名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import verify [as 别名]
    def test_verify(self, srv):
        form = create_return_form_env("user", "hemligt", "query=foo")

        authn = UsernamePasswordMako(srv, "login.mako", tl, PASSWD,
                                     "authorization_endpoint")
        response, success = authn.verify(parse_qs(form))
        assert query_string_compare(response.message.split("?")[1],
                                    "query=foo&upm_answer=true")

        headers = dict(response.headers)
        assert headers["Set-Cookie"].startswith('xyzxyz=')
开发者ID:Omosofe,项目名称:pyoidc,代码行数:13,代码来源:test_user.py

示例4: test_6

# 需要导入模块: from oic.utils.authn.user import UsernamePasswordMako [as 别名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import verify [as 别名]
def test_6():
    form = create_return_form_env("user", "secret", "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))
    assert isinstance(response, Unauthorized)
开发者ID:ghedin,项目名称:pyoidc,代码行数:14,代码来源:test_authn.py

示例5: test_not_authenticated

# 需要导入模块: from oic.utils.authn.user import UsernamePasswordMako [as 别名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import verify [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

示例6: test_3

# 需要导入模块: from oic.utils.authn.user import UsernamePasswordMako [as 别名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import verify [as 别名]
def test_3():
    form = create_return_form_env("user", "hemligt", "query=foo")
    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))
    assert response.message == "authorization_endpoint?query=foo&upm_answer=true"
    print len(response.headers) == 2
    flag = 0
    for param, val in response.headers:
        if param == "Set-Cookie":
            assert val.startswith('xyzxyz=')
            flag = 1
    assert flag == 1
开发者ID:ghedin,项目名称:pyoidc,代码行数:21,代码来源:test_authn.py

示例7: test_verify

# 需要导入模块: from oic.utils.authn.user import UsernamePasswordMako [as 别名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import verify [as 别名]
    def test_verify(self, srv):
        form = create_return_form_env("user", "hemligt", "query=foo")

        authn = UsernamePasswordMako(srv, "login.mako", tl, PASSWD,
                                     "authorization_endpoint")
        with LogCapture(level=logging.DEBUG) as logcap:
            response, success = authn.verify(compact(parse_qs(form)))
        assert query_string_compare(response.message.split("?")[1],
                                    "query=foo&upm_answer=true")

        headers = dict(response.headers)
        assert headers["Set-Cookie"].startswith('xyzxyz=')
        expected = {u'query': u'query=foo', u'login': u'user',
                    u'password': '<REDACTED>'}
        # We have to use eval() here to avoid intermittent
        # failures from dict ordering
        assert eval(logcap.records[0].msg[7:-1]) == expected
        expected = {u'query': u'query=foo', u'login': u'user',
                    u'password': '<REDACTED>'}
        assert eval(logcap.records[1].msg[5:]) == expected
        assert logcap.records[2].msg == 'Password verification succeeded.'
        expected = {u'query': [u'foo'], 'upm_answer': 'true'}
        assert eval(logcap.records[3].msg[8:]) == expected
开发者ID:Magosgruss,项目名称:pyoidc,代码行数:25,代码来源:test_user.py

示例8: test_5

# 需要导入模块: from oic.utils.authn.user import UsernamePasswordMako [as 别名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import verify [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


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