public static void doChallenge(LoginForm loginForm, String providerAccountId) { String mn = "doChallenge( " + loginForm.ToString() + " providerAccountId = " + providerAccountId; String providerJson = JsonConvert.SerializeObject(loginForm, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); //providerJson = providerJson.Replace("loginForm", ""); // providerJson = providerJson.Replace("\\", providerJson = providerJson.Replace("IsOptional", "isOptional"); providerJson = providerJson.Replace("\r\n", ""); providerJson = providerJson.Replace(" ", ""); providerJson = providerJson.Replace("SecurityKey", "Security Key"); providerJson = providerJson.Replace("Whatisthenameofyourstate?", "What is the name of your state?"); providerJson = providerJson.Replace("Whatisthenameofyourfirstschool", "What is the name of your first school"); //providerJson = providerJson.Replace("loginForm",""); //providerJson = "{\"mfaTimeout\":99940,\"formType\":\"token\",\"row\":[{\"id\":\"token_row\",\"label\":\"Security Key\",\"fieldRowChoice\":\"0001\",\"form\":\"0001\",\"field\":[{\"id\":\"token\",\"name\":\"tokenValue\",\"isOptional\":false,\"value\":\"123456\",\"valueEditable\":\"true\",\"maxLength\":6,\"type\":\"text\"}]}]}"; providerJson = "{\"loginForm\":" + providerJson + "}"; Console.WriteLine(providerJson); String addSiteURL = LoginApp.localURLVer1 + "providers/" + providerAccountId; List <string> headers = new List <string>(); string usersessionid = LoginApp.usession; string cbrandsessionid = LoginApp.cbsession; headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}"); String jsonResponse = HTTP.doPut(addSiteURL, headers, "MFAChallenge=" + providerJson); }
public static ProviderAccount doChallenge(LoginForm loginForm, String providerAccountId) { String mn = "doChallenge( " + loginForm.ToString() + " providerAccountId = " + providerAccountId; String providerJson = JsonConvert.SerializeObject(loginForm, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); providerJson = providerJson.Replace("\r\n", ""); providerJson = "{\"loginForm\":" + providerJson + "}"; Console.WriteLine(providerJson); String addSiteURL = LoginApp.localURLVer1 + "providers/providerAccounts?providerAccountIds=" + providerAccountId; List <string> headers = new List <string>(); string usersessionid = LoginApp.usession; string cbrandsessionid = LoginApp.cbsession; headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}"); String jsonResponse = HTTP.doPutNew(addSiteURL, headers, providerJson); ProviderAccount providerAccount = (ProviderAccount)GSONParser.handleJson(jsonResponse, typeof(ProviderAccount)); return(providerAccount); }