void LogoutUser(JsonServiceClient client)
 {
     Auth auth = new Auth()
     {
         provider = "logout"
     };
     try
     {
         client.Post<AuthResponse>("Auth", auth);
     }
     catch (Exception)
     {
         throw new UserAuthenticationException(string.Format("Could not logout"));
     }
 }
 void LoginUser(JsonServiceClient client, string userName)
 {
     Auth auth = new Auth()
     {
         UserName = userName,
         Password = MD5Helper.CalculateMD5Hash("password123"),
         RememberMe = false,
         provider = "credentials"
     };
     try
     {
         client.Post<AuthResponse>("Auth", auth);
     }
     catch (Exception)
     {
         throw new UserAuthenticationException(string.Format("Could not login {0}", userName));
     }
 }
 void SendLoginAuth(string username, string password)
 {
     lock (_clientWrapper.ClientLock) {
         Auth auth = new Auth () {
             UserName = username,
             Password = MD5Helper.CalculateMD5Hash (password),
             RememberMe = false,
             provider = "credentials"
         };
         try {
             _clientWrapper.Client.Post<AuthResponse> ("Auth", auth);
         }
         catch (Exception) {
             throw new UserAuthenticationException (string.Format ("Could not login {0}", username));
         }
     }
 }
 void SendLogoutAuth()
 {
     lock (_clientWrapper.ClientLock) {
         Auth auth = new Auth () {
             provider = "logout"
         };
         try {
             _clientWrapper.Client.Post<AuthResponse> ("Auth", auth);
         }
         catch (Exception) {
             throw new UserAuthenticationException (string.Format ("Could not logout"));
         }
     }
 }
        private void Logout(JsonServiceClient client)
        {
            // Keeping this for now.  Dont want to figure it out again.
            //string authURI = string.Format("{0}/json/syncreply/Auth", SystemConstants.WebServiceBaseURL);

            //HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(authURI);
            //request.CookieContainer = cookieJar;
            //request.ContentType = "application/json";
            //request.Method = "POST";
            //using (StreamWriter sw = new StreamWriter(request.GetRequestStream(), new UTF8Encoding()))
            //{
            //    string requestText = string.Format("{{\"provider\":\"logout\"}}");

            //    sw.Write(requestText);
            //}

            //using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            //{
            //    if (response.StatusCode != HttpStatusCode.OK)
            //        Console.WriteLine("Bad Status Code");

            //    foreach (Cookie c in cookieJar.GetCookies(request.RequestUri))
            //    {
            //        Console.WriteLine("cookieJar.Add(new Cookie(\"{0}\", \"{1}\", \"/\", SystemConstants.WebServiceDomain));",
            //            c.Name, c.Value);
            //    }
            //}

            //return cookieJar;

            Auth auth = new Auth()
            {
                provider = "logout",
            };

            client.Post<AuthResponse>("Auth", auth);
        }