Пример #1
0
    def oauth_pre_construct(self, request_args=None, post_args=None, **kwargs):
        """

        :param request_args: Initial set of request arguments
        :param kwargs: Extra keyword arguments
        :return: Request arguments
        """
        _state = get_state_parameter(request_args, kwargs)
        parameters = list(self.msg_type.c_param.keys())

        _args = self.extend_request_args({}, oauth2.AuthorizationRequest,
                                         'auth_request', _state, parameters)

        _args = self.extend_request_args(_args, oauth2.AuthorizationResponse,
                                         'auth_response', _state, parameters)

        if "grant_type" not in _args:
            _args["grant_type"] = "authorization_code"

        if request_args is None:
            request_args = _args
        else:
            _args.update(request_args)
            request_args = _args

        return request_args, post_args
Пример #2
0
def carry_state(request_args=None, **kwargs):
    """
    Make sure post_construct_methods have access to state

    :param request_args:
    :param kwargs:
    :return: The value of the state parameter
    """
    return request_args, {'state': get_state_parameter(request_args, kwargs)}
    def oauth_pre_construct(self, request_args=None, **kwargs):
        """Preconstructor of request arguments"""
        _state = get_state_parameter(request_args, kwargs)
        parameters = list(self.msg_type.c_param.keys())

        _args = self.extend_request_args({}, oauth2.AccessTokenResponse,
                                         'token_response', _state, parameters)

        _args = self.extend_request_args(_args, oauth2.AccessTokenResponse,
                                         'refresh_token_response', _state,
                                         parameters)

        if request_args is None:
            request_args = _args
        else:
            _args.update(request_args)
            request_args = _args

        return request_args, {}
Пример #4
0
 def store_auth_request(self, request_args=None, **kwargs):
     """Store the authorization request in the state DB."""
     _key = get_state_parameter(request_args, kwargs)
     self.store_item(request_args, 'auth_request', _key)
     return request_args
Пример #5
0
def put_state_in_post_args(request_args, **kwargs):
    state = get_state_parameter(request_args, kwargs)
    return request_args, {'state': state}