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())

        _context = self.client_get("service_context")
        _args = _context.state.extend_request_args({}, oauth2.AuthorizationRequest,
                                                   'auth_request', _state, parameters)

        _args = _context.state.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
Ejemplo n.º 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)}
Ejemplo n.º 3
0
    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())

        _si = self.client_get("service_context").state
        _args = _si.extend_request_args({}, oauth2.AccessTokenResponse,
                                        'token_response', _state, parameters)

        _args = _si.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, {}
def put_state_in_post_args(request_args, **kwargs):
    state = get_state_parameter(request_args, kwargs)
    return request_args, {'state': state}
 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.client_get("service_context").state.store_item(
         request_args, 'auth_request', _key)
     return request_args