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


Python Request.response_type方法代码示例

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


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

示例1: create_authorization_response

# 需要导入模块: from oauthlib.common import Request [as 别名]
# 或者: from oauthlib.common.Request import response_type [as 别名]
    def create_authorization_response(self, uri, http_method='GET', body=None,
            headers=None):
        """Extract response_type and route to the designated handler."""
        request = Request(uri, http_method=http_method, body=body, headers=headers)
        query_params = params_from_uri(request.uri)
        body_params = request.decoded_body

        # Prioritize response_type defined as query param over those in body.
        # Chosen because the two core grant types utilizing the response type
        # parameter both supply it in the uri. However it is not specified
        # explicitely in RFC 6748.
        if 'response_type' in query_params:
            request.response_type = query_params.get('response_type')
        elif 'response_type' in body_params:
            request.response_type = body_params.get('response_type')
        else:
            raise errors.InvalidRequestError(
                description='The response_type parameter is missing.')

        if not request.response_type in self.response_types:
            raise errors.UnsupportedResponseTypeError(
                description='Invalid response type')

        return self.response_types.get(
                request.response_type).create_authorization_response(
                        request, self.default_token)
开发者ID:Chez,项目名称:oauthlib,代码行数:28,代码来源:__init__.py

示例2: test_request_invalid_client_id

# 需要导入模块: from oauthlib.common import Request [as 别名]
# 或者: from oauthlib.common.Request import response_type [as 别名]
    def test_request_invalid_client_id(self):
        request = Request('https://a.b./path')
        request.scope = 'openid profile'
        request.response_type = 'code'
        with pytest.raises(errors.MissingClientIdError):
            self.auth.validate_authorization_request(request)

        request.client_id = 'invalid_client'
        self.validator.validate_client_id.return_value = False
        with pytest.raises(errors.InvalidClientIdError):
            self.auth.validate_authorization_request(request)
开发者ID:intelie,项目名称:python-openidconnect,代码行数:13,代码来源:test_authorization_code.py

示例3: make_request

# 需要导入模块: from oauthlib.common import Request [as 别名]
# 或者: from oauthlib.common.Request import response_type [as 别名]
    def make_request(self, response_type='code',
            scope='openid profile email', **kwargs):
        request = Request('https://a.b/path')

        request.scope = scope
        request.client = 'superman'
        request.client_id = 'abcdef'
        request.redirect_uri = 'https://a.b/'
        request.response_type = response_type

        for prop, val in kwargs.items():
            setattr(request, prop, val)

        return request
开发者ID:intelie,项目名称:python-openidconnect,代码行数:16,代码来源:utils.py


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