def update_params_for_auth!(host, path, http_method, header_params, query_params, form_params, auth_names, body)
      Array(auth_names).each do |auth_name|
        if auth_name == "khipu"
          params = query_params.merge(form_params)

          encoded = {}
          params.each do |k, v|
            encoded[percent_encode(k)] = percent_encode(v)
          end

          to_sign = http_method.to_s.upcase + "&" + percent_encode(host + path)

          encoded.keys.sort.each do |key|
            to_sign += "&#{key}=" + encoded[key]
          end
          if !body.nil? && header_params['Content-Type']=='application/json'
             to_sign += "&" + body
          end
          if Configuration.debugging
            Configuration.logger.debug "encoded params: #{encoded}"
            Configuration.logger.debug "string to sign: #{to_sign}"
          end

          hash = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), Configuration.secret, to_sign)
          header_params['Authorization'] = Configuration.receiver_id.to_s + ":" + hash

          next
        end
        auth_setting = Configuration.auth_settings[auth_name]
        next unless auth_setting
        case auth_setting[:in]
        when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
        when 'query'  then query_params[auth_setting[:key]] = auth_setting[:value]
        else fail ArgumentError, 'Authentication token must be in `query` of `header`'
        end
      end
    end
def update_params_for_auth!(host, path, http_method, header_params, query_params, form_params, auth_names, body)
      Array(auth_names).each do |auth_name|
        if auth_name == "khipu"
          params = query_params.merge(form_params)

          encoded = {}
          params.each do |k, v|
            encoded[percent_encode(k)] = percent_encode(v)
          end

          to_sign = http_method.to_s.upcase + "&" + percent_encode(host + path)

          encoded.keys.sort.each do |key|
            to_sign += "&#{key}=" + encoded[key]
          end
          if !body.nil? && header_params['Content-Type']=='application/json'
             to_sign += "&" + body
          end
          if Configuration.debugging
            Configuration.logger.debug "encoded params: #{encoded}"
            Configuration.logger.debug "string to sign: #{to_sign}"
          end

          hash = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), Configuration.secret, to_sign)
          header_params['Authorization'] = Configuration.receiver_id.to_s + ":" + hash

          next
        end
        auth_setting = Configuration.auth_settings[auth_name]
        next unless auth_setting
        case auth_setting[:in]
        when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
        when 'query'  then query_params[auth_setting[:key]] = auth_setting[:value]
        else fail ArgumentError, 'Authentication token must be in `query` of `header`'
        end
      end
    end
Update hearder and query params based on authentication settings.