public static int doCoBrandLogin() { string coBrandUserName = "******"; string coBrandPassword = "******"; string mn = "doCoBrandLogin(coBrandUserName " + coBrandUserName + ", coBrandPassword " + coBrandPassword + " )"; //string requestBody = "cobrandLogin="******"&cobrandPassword="******"{\"cobrand\":{\"cobrandLogin\":\"" +coBrandUserName + "\",\"cobrandPassword\":\"" + coBrandPassword+"\"}"; string requestBody = "{\"cobrand\": {\"cobrandLogin\":\"" + coBrandUserName + "\",\"cobrandPassword\":\"" + coBrandPassword + "\"}}"; string coBrandLoginURL = "https://developer.api.yodlee.com:443/ysl/restserver/v1/" + "cobrand/login"; string jsonResponse = HTTP.doPostUser(coBrandLoginURL, null, requestBody, null); if (jsonResponse == null) { Console.WriteLine("Wrong cobrand username/password"); return(0); } else { CobrandContext coBrand = (CobrandContext)GSONParser.handleJson(jsonResponse, typeof(CobrandContext)); Console.WriteLine("--- Cobrand Session Id ---"); Console.WriteLine(coBrand.session.cobSession); Console.WriteLine("--------------------------"); loginTokens["cobSession"] = coBrand.session.cobSession; cbsession = coBrand.session.cobSession; return(1); } }
public static int registerUser() { // Console.WriteLine("Enter your userName: "******"cobUserName"]; //Console.WriteLine("Enter " + coBrandUserName + "'s password: "******"cobPassword"]; string registerJson = ConfigurationManager.AppSettings["regJson"]; string registerUrl = localURLVer1 + "/user/register"; string cobses = loginTokens["cobSession"];//cobrand session id List <string> headers = new List <string>(); headers.Add("Authorization:{cobSession= " + cobses + "}");//passing cobrand session id. string jsonResponse = HTTP.doPostUser(registerUrl, headers, null, registerJson); if (jsonResponse == null) { Console.WriteLine("Wrong cobrand username/password"); return(0); } else { CobrandContext coBrand = (CobrandContext)GSONParser.handleJson(jsonResponse, typeof(CobrandContext)); Console.WriteLine("--- Cobrand Session Id ---"); Console.WriteLine(coBrand.session.cobSession); Console.WriteLine("--------------------------"); loginTokens["cobSession"] = coBrand.session.cobSession; cbsession = coBrand.session.cobSession; return(1); } }
public CobrandContext parseJSON(string json) { string mn = "parseJSON(" + json + ")"; // Console.WriteLine(fqcn + " :: " + mn); CobrandContext cobrandcntxt = JsonConvert.DeserializeObject <CobrandContext>(json); return(cobrandcntxt); }
public CobrandContext getCobrandContext() { DateTime now = DateTime.Now; DateTime expired = created.AddMinutes(COBRAND_CONTEXT_TIME_OUT); if (now >= expired) { // System.Console.WriteLine("\t(CobrandContext is old, creating new one...)"); // Cobrand Context expired, create new one cobrandLoginService = new CobrandLoginService(); cobrandLoginService.Url = System.Configuration.ConfigurationManager.AppSettings.Get("soapServer") + "/" + cobrandLoginService.GetType().FullName; // Get Cobrand Credentials from AppSettings (requires App.config file) string cobrandIdStr = System.Configuration.ConfigurationManager.AppSettings.Get("cobrandId"); long cobrandId = long.Parse(cobrandIdStr); string applicationId = System.Configuration.ConfigurationManager.AppSettings.Get("applicationId"); string username = System.Configuration.ConfigurationManager.AppSettings.Get("username"); string password = System.Configuration.ConfigurationManager.AppSettings.Get("password"); string tncVersionStr = System.Configuration.ConfigurationManager.AppSettings.Get("tncVersion"); long tncVersion = long.Parse(tncVersionStr); // Note you can remove warnings by adding reference 'System.Configuration' from the .NET tab // and replacing code "ConfigurationManager.AppSettings.Get" with "ConfigurationManager.AppSettings" // This only works with .NET 2.0 or above. Leaving code as is for now.s Locale locale = new Locale(); locale.country = "US"; CobrandPasswordCredentials cobrandPasswordCredentials = new CobrandPasswordCredentials(); cobrandPasswordCredentials.password = password; cobrandPasswordCredentials.loginName = username; // authentication of a cobrand in the Yodlee software platform and returns // a valid CobrandContext if the authentication is successful. This method takes a generic CobrandCredentials argument as the // authentication related credentials of the cobrand. cobrandContext = cobrandLoginService.loginCobrand( cobrandId, true, applicationId, locale, tncVersion, true, cobrandPasswordCredentials); created = DateTime.Now; return(cobrandContext); } else { // System.Console.WriteLine("\t(using cached CobrandContext...)"); return(cobrandContext); } }
public CobrandContext GetCobrandContext() { DateTime now = DateTime.Now; DateTime expired = created.AddMinutes(COBRAND_CONTEXT_TIME_OUT); if (now >= expired) { // Cobrand Context expired, create new one cobrandLoginService = new CobrandLoginService(); string soapServer = CurrentValues.Instance.YodleeSoapServer; cobrandLoginService.Url = soapServer + "/" + cobrandLoginService.GetType().FullName; // Get Cobrand Credentials from AppSettings (requires App.config file) long cobrandId = CurrentValues.Instance.YodleeCobrandId; string applicationId = CurrentValues.Instance.YodleeApplicationId; string username = CurrentValues.Instance.YodleeUsername; string password = CurrentValues.Instance.YodleePassword; string tncVersionStr = CurrentValues.Instance.YodleeTncVersion; long tncVersion = long.Parse(tncVersionStr); // Note you can remove warnings by adding reference 'System.Configuration' from the .NET tab // and replacing code "ConfigurationSettings.AppSettings.Get" with "ConfigurationManager.AppSettings" // This only works with .NET 2.0 or above. Leaving code as is for now.s var locale = new Locale { country = "US" }; var cobrandPasswordCredentials = new CobrandPasswordCredentials { password = password, loginName = username }; // authentication of a cobrand in the Yodlee software platform and returns // a valid CobrandContext if the authentication is successful. This method takes a generic CobrandCredentials argument as the // authentication related credentials of the cobrand. cobrandContext = cobrandLoginService.loginCobrand( cobrandId, true, applicationId, locale, tncVersion, true, cobrandPasswordCredentials); Log.DebugFormat("GetCobrandContext cobrand login successful"); created = DateTime.Now; return(cobrandContext); } return(cobrandContext); }
void sessionlessViewItems() { System.Console.Write("Login: "******""; System.Console.Write("Password: "******"SessionLess core calls"); PasswordCredentials passwordCredentials = new PasswordCredentials(); passwordCredentials.loginName = userName; passwordCredentials.password = password; UserContext sessionlessUserContext = new UserContext(); CobrandContext cobrandContext = getCobrandContext(); sessionlessUserContext.cobrandConversationCredentials = cobrandContext.cobrandConversationCredentials; sessionlessUserContext.conversationCredentials = passwordCredentials; sessionlessUserContext.applicationId = cobrandContext.applicationId; sessionlessUserContext.channelId = cobrandContext.channelId; sessionlessUserContext.channelIdSpecified = true; sessionlessUserContext.cobrandId = cobrandContext.cobrandId; sessionlessUserContext.cobrandIdSpecified = true; sessionlessUserContext.ipAddress = cobrandContext.ipAddress; sessionlessUserContext.isPasswordExpired = false; sessionlessUserContext.locale = cobrandContext.locale; sessionlessUserContext.preferenceInfo = cobrandContext.preferenceInfo; sessionlessUserContext.tncVersion = cobrandContext.tncVersion; sessionlessUserContext.tncVersionSpecified = true; sessionlessUserContext.valid = true; sessionlessUserContext.validationHandler = cobrandContext.validationHandler; Object[] itemSummaries = (Object[])dataService.getItemSummaries(sessionlessUserContext); if (itemSummaries == null || itemSummaries.Length == 0) { System.Console.WriteLine("You have no Items Added."); } else { for (int i = 0; i < itemSummaries.Length; i++) { ItemSummary itemSummary = (ItemSummary)itemSummaries[i]; String displayName = itemSummary.contentServiceInfo.contentServiceDisplayName; System.Console.WriteLine("ItemId: " + itemSummary.itemId + " DisplayName: " + displayName + " errorCode: " + itemSummary.refreshInfo.statusCode + " refreshInfo time: " /**new Date(itemSummary.refreshInfo.lastUpdatedTime * 1000)*/); } } }
/** * Basic constructor will generate the form vistor. * * @param form the form to wrap with a vistor * @param cobrandContext the context this form came from */ public FormFieldsVisitor(Form form, CobrandContext cobrandContext) { this.cobrandContext = cobrandContext; populateQueue(form); }