Exemplo n.º 1
0
        public static Providers getProviderLoginForm(String providerId)
        {
            //Console.WriteLine(fqcn + " :: " + mn);
            String        getSiteURL      = LoginApp.localURLVer1 + "providers/" + providerId;
            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(getSiteURL, headers);
            Providers providers    = (Providers)GSONParser.handleJson(jsonResponse, typeof(Providers));

            Console.WriteLine(providers.toString());
            return(providers);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public static Accounts getAccounts()
        {
            string mn = "getAccounts()";

            Console.WriteLine(fqcn + " :: " + mn);
            string        accountSummaryURL = LoginApp.localURLVer1 + "accounts/";
            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(accountSummaryURL, headers);//headers-authorization headers i.e-member external sesionid,cobrand external session id
            Type     acc          = typeof(Accounts);
            Accounts accounts     = (Accounts)GSONParser.handleJson(jsonResponse, acc);

            return(accounts);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        public static int doCoBrandLogin()
        {
            string coBrandUserName = ConfigurationManager.AppSettings["cobUserName"];
            string coBrandPassword = ConfigurationManager.AppSettings["cobPassword"];
            //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 = localURLVer1 + "cobrand/login";
            string jsonResponse    = HTTP.doPostUser(coBrandLoginURL, null, requestBody, null);

            if (jsonResponse == null)
            {
                return(0);
            }
            else
            {
                CobrandContext coBrand = (CobrandContext)GSONParser.handleJson(jsonResponse, typeof(CobrandContext));
                loginTokens["cobSession"] = coBrand.session.cobSession;
                cbsession = coBrand.session.cobSession;
                return(1);
            }
        }
Exemplo n.º 6
0
        public static void searchProvider(String searchString)
        {
            String mn = "searchSite(searchString " + searchString + " )";

            Console.WriteLine(fqcn + " :: " + mn);
            String        searchProviderURL = LoginApp.localURLVer1 + "providers?name=" + searchString;
            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(searchProviderURL, headers);
            Providers providers    = (Providers)GSONParser.handleJson(jsonResponse, typeof(Providers));

            Console.WriteLine("------------------------------------------------");
            Console.WriteLine(" Id  Provider Name        Login Url");
            Console.WriteLine("------------------------------------------------");
            for (int i = 0; i < providers.provider.Length; i++)//deserialized json response for showing tabular format .
            {
                Console.WriteLine(providers.provider[i].id + " " + ">>" + " " + providers.provider[i].name + "  " + ">>" + "  " + providers.provider[i].loginUrl);
            }
            Console.WriteLine("--------------------------------------------------");
            //Console.Write(providers.toString());
        }