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


Python AuthorizationRequest.keys方法代码示例

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


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

示例1: test_multiple_response_types_urlencoded

# 需要导入模块: from oic.oauth2.message import AuthorizationRequest [as 别名]
# 或者: from oic.oauth2.message.AuthorizationRequest import keys [as 别名]
    def test_multiple_response_types_urlencoded(self):
        ar = AuthorizationRequest(response_type=["code", "token"],
                                  client_id="foobar")

        ue = ar.to_urlencoded()
        ue_splits = ue.split('&')
        expected_ue_splits = "response_type=code+token&client_id=foobar".split(
            '&')
        assert _eq(ue_splits, expected_ue_splits)

        are = AuthorizationRequest().deserialize(ue, "urlencoded")
        assert _eq(are.keys(), ["response_type", "client_id"])
        assert _eq(are["response_type"], ["code", "token"])
开发者ID:Omosofe,项目名称:pyoidc,代码行数:15,代码来源:test_oauth2_message.py

示例2: test_multiple_response_types_json

# 需要导入模块: from oic.oauth2.message import AuthorizationRequest [as 别名]
# 或者: from oic.oauth2.message.AuthorizationRequest import keys [as 别名]
    def test_multiple_response_types_json(self):
        ar = AuthorizationRequest(response_type=["code", "token"],
                                  client_id="foobar")
        ue = ar.to_json()
        ue_obj = json.loads(ue)
        expected_ue_obj = {
            "response_type": "code token",
            "client_id": "foobar"
        }
        assert ue_obj == expected_ue_obj

        are = AuthorizationRequest().deserialize(ue, "json")
        assert _eq(are.keys(), ["response_type", "client_id"])
        assert _eq(are["response_type"], ["code", "token"])
开发者ID:Omosofe,项目名称:pyoidc,代码行数:16,代码来源:test_oauth2_message.py

示例3: _authn

# 需要导入模块: from oic.oauth2.message import AuthorizationRequest [as 别名]
# 或者: from oic.oauth2.message.AuthorizationRequest import keys [as 别名]
        # To authenticate or Not
        if identity is None:  # No!
            if "prompt" in areq and "none" in areq["prompt"]:
                # Need to authenticate but not allowed
                return self._redirect_authz_error("login_required",
                                                  redirect_uri)
            else:
                # Do authentication
                return _authn(**authn_args)
        else:
            user = identity["uid"]
            aevent = AuthnEvent(user, authn_info=acr)

        # If I get this far the person is already authenticated
        logger.debug("- authenticated -")
        logger.debug("AREQ keys: %s" % areq.keys())

        try:
            oidc_req = areq["request"]
        except KeyError:
            oidc_req = None

        skey = self.sdb.create_authz_session(aevent, areq, oidreq=oidc_req)

        # Now about the authorization step.
        try:
            permissions = self.authz.permissions(cookie)
            if not permissions:
                return self.authz(user, skey)
        except (ToOld, TamperAllert):
            return self.authz(user, areq, skey)
开发者ID:takehikokodama,项目名称:pyoidc,代码行数:33,代码来源:provider.py


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