/// <summary> /// Authenticate a user using an established session, a login and an md5 of their password. /// </summary> /// <param name="userName">Name of the user.</param> /// <param name="password">The password.</param> /// <param name="sessionID">The session identifier.</param> /// <returns> /// the request response parameters /// </returns> public Authenticate.Result Authenticate(string userName, string password, string sessionID) { RequestParameters requestParameters = new RequestParameters(); requestParameters.method = "authenticate"; requestParameters.parameters.Add("login", userName); string encryptedPassword = Encryptor.CalculateMD5Hash(password); requestParameters.parameters.Add("password", encryptedPassword.ToLower()); string responseJson = this.ExecuteJson(requestParameters, true, sessionID); Authenticate.ResponseRootObject authenticateResponse = new Authenticate.ResponseRootObject(); try { authenticateResponse = this.JsonSerializer.Deserialize <Authenticate.ResponseRootObject>(responseJson); } catch { authenticateResponse.result = new Data.Authenticate.Result(); authenticateResponse.result.success = false; } if (authenticateResponse == null) { authenticateResponse.result = new Data.Authenticate.Result(); authenticateResponse.result.success = false; } return(authenticateResponse.result); }
/// <summary> /// Authenticate a user using an established session, a login and an md5 of their password. /// </summary> /// <param name="userName">Name of the user.</param> /// <param name="password">The password.</param> /// <param name="sessionID">The session identifier.</param> /// <returns> /// the request response parameters /// </returns> public Authenticate.Result Authenticate(string userName, string password, string sessionID) { RequestParameters requestParameters = new RequestParameters(); requestParameters.method = "authenticate"; requestParameters.parameters.Add("login", userName); string encryptedPassword = Encryptor.CalculateMD5Hash(password); requestParameters.parameters.Add("password", encryptedPassword.ToLower()); string responseJson = this.ExecuteJson(requestParameters, true, sessionID); Authenticate.ResponseRootObject authenticateResponse = new Authenticate.ResponseRootObject(); try { authenticateResponse = this.JsonSerializer.Deserialize<Authenticate.ResponseRootObject>(responseJson); } catch { authenticateResponse.result = new Data.Authenticate.Result(); authenticateResponse.result.success = false; } if (authenticateResponse == null) { authenticateResponse.result = new Data.Authenticate.Result(); authenticateResponse.result.success = false; } return authenticateResponse.result; }