Esempio n. 1
0
        private static NameValueCollection CreateLoginCollection(Account account, LoginData data)
        {
            NameValueCollection collection = new NameValueCollection();

            collection.Add("accountName", account.Username);
            collection.Add("password", account.Password);
            collection.Add("useSrp", "false");
            collection.Add("publicA", string.Empty);
            collection.Add("clientEvidenceM1", string.Empty);
            collection.Add("persistLogin", "false");
            collection.Add("submit", "submit");
            collection.Add("csrftoken", data.CSRFToken);
            collection.Add("sessionTimeout", data.SessionTimeout.ToString());

            return collection;
        }
Esempio n. 2
0
        private static NameValueCollection CreateAuthenticationCollection(Account account, LoginData data, string code)
        {
            NameValueCollection collection = new NameValueCollection();

            collection.Add("authValue", code);
            collection.Add("persistAuthenticator", "true");
            collection.Add("csrftoken", data.CSRFToken);

            return collection;
        }
Esempio n. 3
0
        private static LoginData GetLoginData(string html, bool authentication)
        {
            LoginData data = new LoginData();

            int index = html.IndexOf("csrftoken");
            int value = html.IndexOf("value", index) + 7;
            int end = html.IndexOf("\" />", value);

            data.CSRFToken = html.Substring(value, end - value);

            if (authentication)
                return data;

            index = html.IndexOf("sessionTimeout");
            value = html.IndexOf("value", index) + 7;
            end = html.IndexOf("\" />", value);

            data.SessionTimeout = long.Parse(html.Substring(value, end - value));

            return data;
        }