private void btnAuthenticate_Click(object sender, EventArgs e) { pcRestProxy = new PCRestProxy( cmbWebProtocol.Text, txtPCServerAndPort.Text, txtDomain.Text, txtProject.Text, txtProxyUrl.Text, txtProxyUser.Text, txtProxyPassword.Text ); bool authenticated = pcRestProxy.Authenticate(txtPCUserName.Text, txtPCPassword.Text); if (authenticated) { btnAuthenticate.Text = "Authenticated"; btnAuthenticate.BackColor = Color.Green; } else { btnAuthenticate.Text = "Authentication failed"; btnAuthenticate.BackColor = Color.Red; } }
private void Test_Load(object sender, EventArgs e) { pcRestProxy = new PCRestProxy( cmbWebProtocol.Text, txtPCServerAndPort.Text, txtDomain.Text, txtProject.Text, txtProxyUrl.Text, txtProxyUser.Text, txtProxyPassword.Text ); _authenticated = pcRestProxy.Authenticate(txtPCUserName.Text, txtPCPassword.Text); }
public static bool TestConnection(string pcServerURL, string pcUserName, string pcPassword, string proxyURL, string proxyUserName, string proxyPassword) { _webProtocol = pcServerURL.Trim().StartsWith("https") ? "https" : "http"; _pcServerAndPort = pcServerURL.Trim().Replace("https://", "").Replace("http://", ""); _pcUserName = pcUserName; _pcPassword = pcPassword; _proxyURL = proxyURL; _proxyUserName = proxyUserName; _proxyPassword = proxyPassword; _pcRestProxy = new PCRestProxy(_webProtocol, _pcServerAndPort, "", "", proxyURL, proxyUserName, proxyPassword); return(_pcRestProxy.Authenticate(_pcUserName, _pcPassword)); }
public bool Login() { PCErrorResponse pcErrorResponse = new PCErrorResponse("", 0); try { _fileLog.Write(LogMessageType.Info, string.Format("Trying to login: [PCServer: '{0}://{1}', User: '******']", _pcModel.isHTTPSProtocol(), _pcModel.PCServerAndPort, _pcModel.UserName)); _loggedIn = _pcRestProxy.Authenticate(_pcModel.UserName, _pcModel.Password, ref pcErrorResponse); } catch (Exception e) { _fileLog.Write(LogMessageType.Error, "Error: " + e.Message); if (pcErrorResponse.ErrorCode > 0) { _fileLog.Write(LogMessageType.Error, "\n ExceptionMessage: " + pcErrorResponse.ExceptionMessage + "\n ErrorCode: " + pcErrorResponse.ErrorCode.ToString()); } } if (!_loggedIn && pcErrorResponse.ErrorCode > 0) { _fileLog.Write(LogMessageType.Info, "\n ExceptionMessage: " + pcErrorResponse.ExceptionMessage + "\n ErrorCode: " + pcErrorResponse.ErrorCode.ToString()); } _fileLog.Write(LogMessageType.Info, string.Format("Login {0}", _loggedIn ? "succeeded\n" : "failed\n")); return(_loggedIn); }
public bool TestConnection() { Helper.CheckedConnection = _pcRestProxy.Authenticate(_pcUserName, _pcPassword); return(Helper.CheckedConnection); }
public bool TestConnection() { Helper.CheckedConnection = _pcRestProxy.Authenticate(_pcUserName, _pcPassword, _useTokenForAuthentication.ToLower() == "true"); return(Helper.CheckedConnection); }