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


Python RegistrationResponse.to_json方法代码示例

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


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

示例1: read_registration

# 需要导入模块: from oic.oic.message import RegistrationResponse [as 别名]
# 或者: from oic.oic.message.RegistrationResponse import to_json [as 别名]
    def read_registration(self, authn, request, **kwargs):
        """
        Read all information this server has on a client.
        Authorization is done by using the access token that was return as
        part of the client registration result.

        :param authn: The Authorization HTTP header
        :param request: The query part of the URL
        :param kwargs: Any other arguments
        :return:
        """

        logger.debug("authn: %s, request: %s" % (authn, request))

        # verify the access token, has to be key into the client information
        # database.
        assert authn.startswith("Bearer ")
        token = authn[len("Bearer "):]

        client_id = self.cdb[token]

        # extra check
        _info = urlparse.parse_qs(request)
        assert _info["client_id"][0] == client_id

        logger.debug("Client '%s' reads client info" % client_id)
        args = dict([(k, v) for k, v in self.cdb[client_id].items()
                     if k in RegistrationResponse.c_param])

        self.comb_redirect_uris(args)
        response = RegistrationResponse(**args)

        return Response(response.to_json(), content="application/json",
                        headers=[("Cache-Control", "no-store")])
开发者ID:wayward710,项目名称:pyoidc,代码行数:36,代码来源:provider.py

示例2: _fixup_registration_response

# 需要导入模块: from oic.oic.message import RegistrationResponse [as 别名]
# 或者: from oic.oic.message.RegistrationResponse import to_json [as 别名]
    def _fixup_registration_response(self, http_resp):
        # remove client_secret since no token endpoint is published
        response = RegistrationResponse().deserialize(http_resp.message, "json")
        del response["client_secret"]
        # specify supported id token signing alg
        response["id_token_signed_response_alg"] = self.sign_alg

        http_resp.message = response.to_json()
        return http_resp
开发者ID:borgand,项目名称:SATOSA,代码行数:11,代码来源:oidc.py

示例3: setup_client_registration_endpoint

# 需要导入模块: from oic.oic.message import RegistrationResponse [as 别名]
# 或者: from oic.oic.message.RegistrationResponse import to_json [as 别名]
 def setup_client_registration_endpoint(self):
     client_info = TestConfiguration.get_instance().rp_config.CLIENTS[PROVIDER]["client_info"]
     request = RegistrationRequest().deserialize(json.dumps(client_info), "json")
     _cinfo = self.provider.do_client_registration(request, CLIENT_ID)
     args = dict([(k, v) for k, v in _cinfo.items()
                  if k in RegistrationResponse.c_param])
     args['client_id'] = CLIENT_ID
     self.provider.comb_uri(args)
     registration_response = RegistrationResponse(**args)
     responses.add(
         responses.POST,
         self.op_base + "registration",
         body=registration_response.to_json(),
         status=200,
         content_type='application/json')
开发者ID:borgand,项目名称:SATOSA,代码行数:17,代码来源:FakeOp.py

示例4: KeyBundle

# 需要导入模块: from oic.oic.message import RegistrationResponse [as 别名]
# 或者: from oic.oic.message.RegistrationResponse import to_json [as 别名]
        if client_secret:
            _kc = KeyBundle([{"kty": "oct", "key": client_secret,
                              "use": "ver"},
                             {"kty": "oct", "key": client_secret,
                              "use": "sig"}])
            try:
                _keyjar[client_id].append(_kc)
            except KeyError:
                _keyjar[client_id] = [_kc]

        self.cdb[client_id] = _cinfo
        _log_info("Client info: %s" % _cinfo)

        logger.debug("registration_response: %s" % response.to_dict())

        return Response(response.to_json(), content="application/json",
                        headers=[("Cache-Control", "no-store")])

    def registration_endpoint(self, request, authn=None, **kwargs):
        return self.l_registration_endpoint(request, authn, **kwargs)

    def read_registration(self, authn, request, **kwargs):
        """
        Read all information this server has on a client.
        Authorization is done by using the access token that was return as
        part of the client registration result.

        :param authn: The Authorization HTTP header
        :param request: The query part of the URL
        :param kwargs: Any other arguments
        :return:
开发者ID:wayward710,项目名称:pyoidc,代码行数:33,代码来源:provider.py


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