public static ProviderAccount addProviderAccount(Providers providers) { JsonSerializer serialiser = new JsonSerializer(); serialiser.NullValueHandling = NullValueHandling.Ignore; Provider p = providers.getProvider()[0]; String providerJson = JsonConvert.SerializeObject(p.loginForm, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); providerJson = "{\"loginForm\":" + providerJson; providerJson = providerJson.Replace("\r\n", ""); // providerJson = providerJson.Replace(" ", ""); providerJson = providerJson + "}"; string aa = providerJson; Console.WriteLine(aa); String addSiteURL = LoginApp.localURLVer1 + "providers/providerAccounts?providerId=" + providers.getProvider()[0].getId(); List <string> headers = new List <string>(); string usersessionid = LoginApp.usession; string cbrandsessionid = LoginApp.cbsession; headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}"); String jsonResponse = HTTP.doPost(addSiteURL, providerJson, headers); ProviderAccount providerAccount = (ProviderAccount)GSONParser.handleJson(jsonResponse, typeof(ProviderAccount)); return(providerAccount); }
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 getProviderAccount(String providerAccountId) { String getRefreshStatusURL = LoginApp.localURLVer1 + "providers/providerAccounts/" + providerAccountId.ToString(); List <string> headers = new List <string>(); string usersessionid = LoginApp.usession; string cbrandsessionid = LoginApp.cbsession; headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}"); String jsonResponse = HTTP.doGet(getRefreshStatusURL, headers); // Console.WriteLine(jsonResponse); ProviderAccount providerAccount = (ProviderAccount)GSONParser.handleJson(jsonResponse, typeof(ProviderAccount)); return(providerAccount); }
public static RefreshStatus getRefreshStatus(String providerAccountId) { //String mn = "getRefreshStatus( " + providerAccountId.ToString() + " )"; //Console.WriteLine(fqcn + " :: " + mn); String getRefreshStatusURL = LoginApp.localURLVer1 + "refresh/" + providerAccountId.ToString(); List <string> headers = new List <string>(); string usersessionid = LoginApp.usession; string cbrandsessionid = LoginApp.cbsession; headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}"); String jsonResponse = HTTP.doGet(getRefreshStatusURL, headers); // Console.WriteLine(jsonResponse); RefreshStatus refreshStatus = (RefreshStatus)GSONParser.handleJson(jsonResponse, typeof(RefreshStatus)); Console.WriteLine(refreshStatus.toString()); return(refreshStatus); }
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); }