Exemple #1
0
        public override void handlePOSTRequest(HttpProcessor p, StreamReader inputData, Hashtable httpHeaders)
        {
            Console.WriteLine("POST request: {0}", p.http_url);
            string data = inputData.ReadToEnd();
            NameValueCollection qscoll = HttpUtility.ParseQueryString(data);
            var username  = qscoll["username"];
            var password  = qscoll["password"];
            var directory = ConfigurationManager.AppSettings["directory"];
            var host      = ConfigurationManager.AppSettings["host"];
            var prefix    = ConfigurationManager.AppSettings["prefix"];

            // username password kontolü burada yapılıyor.
            if (validateUser(username, password) == 1)
            {
                Helper.WriteErrorLog(username + password + directory + host + prefix);

                // ticket üretilip gönderiliyor.
                QlikSenseTicketRequest ticketexample = new QlikSenseTicketRequest();
                string ticketresponse = ticketexample.TicketRequest("POST", host, username, directory, prefix);
                Helper.WriteErrorLog(ticketresponse);
                Result list = JsonConvert.DeserializeObject <Result>(ticketresponse);
                list.Host   = host;
                list.Prefix = prefix;
                string output = JsonConvert.SerializeObject(list);
                p.outputStream.WriteLine(output);
            }
            else
            {
                string noauthenticate = "{\"nouser\":\"1\"}";
                p.outputStream.WriteLine(noauthenticate);
            }
        }
        public override void handlePOSTRequest(HttpProcessor p, StreamReader inputData, Hashtable httpHeaders)
        {
            Console.WriteLine("POST request: {0}", p.http_url);
            string data = inputData.ReadToEnd();
            NameValueCollection qscoll = HttpUtility.ParseQueryString(data);
            var username = qscoll["username"];
            var password = qscoll["password"];
            var directory = ConfigurationManager.AppSettings["directory"];
            var host = ConfigurationManager.AppSettings["host"];
            var prefix = ConfigurationManager.AppSettings["prefix"];

            // username password kontolü burada yapılıyor.
            if (validateUser(username, password) == 1)
            {

                Helper.WriteErrorLog(username + password + directory + host + prefix);

                // ticket üretilip gönderiliyor.
                QlikSenseTicketRequest ticketexample = new QlikSenseTicketRequest();
                string ticketresponse = ticketexample.TicketRequest("POST", host, username, directory, prefix);
                Helper.WriteErrorLog(ticketresponse);
                Result list = JsonConvert.DeserializeObject<Result>(ticketresponse);
                list.Host = host;
                list.Prefix = prefix;
                string output = JsonConvert.SerializeObject(list);
                p.outputStream.WriteLine(output);

            }
            else
            {
                string noauthenticate = "{\"nouser\":\"1\"}";
                p.outputStream.WriteLine(noauthenticate);

            }
        }