/// <summary> /// test 1 /// To authenticate the user /// </summary> /// <returns></returns> private string Test1() { Message m1 = new Message(); m1.TestID = 1; m_clientapi = new ClientAPI(); m_clientapi.SetRootServer(RootServerUrl); m_clientapi.SetAuthHostAddress(AuthServerUrl); m_clientapi.ConfigClient(); if (m_clientapi.AuthenticateUser("team2", "clientapi", out m_temptoken).valid) { m1.Passed = false; m1.Msg = "m_clientapi.AuthenticateUser() test1 fails"; } else { m1.Passed = true; m1.Msg = "m_clientapi.AuthenticateUser() test1 succeeds"; } return m1.ToString(); }
/// <summary> /// test2 /// test to authenticate the user credentials /// </summary> /// <returns></returns> private string Test2() { Message m2 = new Message(); m2.TestID = 2; m_clientapi = new ClientAPI(); m_clientapi.SetRootServer(RootServerUrl); m_clientapi.SetAuthHostAddress(AuthServerUrl); m_clientapi.ConfigClient(); if (m_clientapi.AuthenticateUser("team1", "rootserver", out m_temptoken).valid) { m2.Passed = false; m2.Msg = "m_clientapi.AuthenticateUser() test2 fails"; } else { m2.Passed = true; m2.Msg = "m_clientapi.AuthenticateUser() test2 succeeds"; } return m2.ToString(); }
/// <summary> /// test 3 /// test to authenticate the user /// </summary> /// <returns></returns> private string Test3() { Message m3 = new Message(); m3.TestID = 3; m_clientapi = new ClientAPI(); m_clientapi.SetRootServer(RootServerUrl); m_clientapi.SetAuthHostAddress(AuthServerUrl); m_clientapi.ConfigClient(); if (!(m_clientapi.AuthenticateUser("team1", "clientapi", out m_admintoken).valid)) { m3.Passed = false; m3.Msg = "m_clientapi.AuthenticateUser() test3 fails"; } else { m3.Passed = true; m3.Msg = "m_clientapi.AuthenticateUser() test3 succeeds"; } return m3.ToString(); }
private void m_btnLogIn_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { string temptoken; m_clientapi = new ClientAPI(); m_clientapi.SetAuthHostAddress(m_TxtAuthURL.Text.ToString()); m_clientapi.SetRootServer(m_TxtRootURL.Text.ToString()); m_clientapi.ConfigClient(); AuthResult m_AuthResult = m_clientapi.AuthenticateUser(m_txtUserName.Text, m_txtPassWord.Password, out temptoken); if (m_AuthResult.valid) { Logger.LogWrite("User: "******" is authenticated"); MessageBox.Show(m_txtUserName.Text + " Authenticated!!!", "Eskimo DB"); DesktopGUI m_UserMenuWindow = new DesktopGUI(temptoken, m_TxtRootURL.Text.ToString(), m_TxtAuthURL.Text.ToString()); m_UserMenuWindow.Show(); this.Close(); } else { Logger.LogWrite("User: "******" is not authenticated"); MessageBox.Show(m_AuthResult.msg); m_txtUserName.Text = string.Empty; m_txtPassWord.Password = string.Empty; } } catch (Exception ex) { MessageBox.Show("Please enter valid url. Error Message :" + ex.Message, "EskimoDB"); } }