Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

I want my joget application to integrate with an asp.net web application, so i have added the following  code in my asp.net web application to start and complete a joget process, so that after the user login to asp.net web application and he clicks on the "start/complete" link it will call two joget APis and start a process then complete the first activity.

Code Block
                    var query = HttpUtility.ParseQueryString(string.Empty);
                    query["j_username"] = "kermit";
                    query["hash"] = "9449B5ABCFA9AFDA36B801351ED3DF66";
                    query["loginAs"] = User.Identity.Name;
                    query["var_imagurl"] = "42";
                    query["var_status"] = "1";
                    query["field2"] = "frommvc";
                    var url = new UriBuilder("http://localhost:8080/jw/web/json/workflow/process/start/" + name.ToString() + ":42:process1");

                    url.Query = query.ToString();
                    string json = client.DownloadString(url.ToString());
                    var serializer = new JavaScriptSerializer();
                    var myObject = serializer.Deserialize<newprocess>(json);
                    string activityid = myObject.activityId;
                    var query2 = HttpUtility.ParseQueryString(string.Empty);
                    query2["j_username"] = "kermit";
                    query2["hash"] = "9449B5ABCFA9AFDA36B801351ED3DF66";
                    query2["loginAs"] = User.Identity.Name;


                    var url2 = new UriBuilder("http://localhost:8080/jw/web/json/workflow/assignment/completeWithVariable/" + activityid.ToString());

                    url2.Query = query.ToString();
                    string json2 = client.DownloadString(url2.ToString());



return Content(json2, "application/json");

in my call i am using the JSON API authentication to make sure that the requests is coming from the asp.net web application and not from other application. and i am also passing the username to provide authorization (since the two application will share the same usernames).

Based on the above i have the following two questions:-

1. so am i using the JSON API Authentication right ,,,?

2.  and is my approach secure ?

Best Regards