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


Python AuthorizationResponse.parameters方法代碼示例

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


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

示例1: authz_part2

# 需要導入模塊: from oic.oauth2.message import AuthorizationResponse [as 別名]
# 或者: from oic.oauth2.message.AuthorizationResponse import parameters [as 別名]
    def authz_part2(self, user, areq, skey, permission=None, authn=None,
                    **kwargs):
        """
        After the authentication this is where you should end up

        :param user:
        :param areq: The Authorization Request
        :param skey: Session key
        :param permission: A permission specification
        :param authn: The Authentication Method used
        :param kwargs: possible other parameters
        :return: A redirect to the redirect_uri of the client
        """
        _log_debug = logger.debug
        _log_debug("- in authenticated() -")

        self.sdb.update(skey, "auz", permission)

        _log_debug("response type: %s" % areq["response_type"])

        # create the response
        aresp = AuthorizationResponse()
        try:
            aresp["state"] = areq["state"]
        except KeyError:
            pass

        if "response_type" in areq and \
                len(areq["response_type"]) == 1 and \
                "none" in areq["response_type"]:
            pass
        else:
            #if self.sdb.is_revoked(sinfo):
            #    return self._error(error="access_denied",
            #                       descr="Token is revoked")

            try:
                aresp["scope"] = areq["scope"]
            except KeyError:
                pass

            _log_debug("_dic: %s" % self.sdb[skey])

            rtype = set(areq["response_type"][:])
            if "code" in areq["response_type"]:
                #if issue_new_code:
                #    scode = self.sdb.duplicate(_sinfo)
                #    _sinfo = self.sdb[scode]

                _code = aresp["code"] = self.sdb.get_token(skey)
                rtype.remove("code")
            else:
                _code = self.sdb[skey]["code"]
                self.sdb.update(skey, "code", None)

            if "token" in rtype:
                self.sdb.upgrade_to_token(skey, issue_refresh=False,
                                          access_grant=_code)
                atr = AccessTokenResponse(**aresp.to_dict())
                aresp = atr
                _cont = self.sdb[skey]
                _log_debug("_dic: %s" % _cont)
                for key, val in _cont.items():
                    if key in aresp.parameters() and val is not None:
                        aresp[key] = val

                rtype.remove("token")

            if len(rtype):
                return BadRequest("Unknown response type")

        try:
            redirect_uri = self.get_redirect_uri(areq)
        except (RedirectURIError, ParameterError), err:
            return BadRequest("%s" % err)
開發者ID:takehikokodama,項目名稱:pyoidc,代碼行數:77,代碼來源:provider.py


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