예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailWhenTooManyAttempts() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFailWhenTooManyAttempts()
        {
            // Given
            int            maxFailedAttempts = ThreadLocalRandom.current().Next(1, 10);
            Authentication auth = CreateAuthentication(maxFailedAttempts);

            for (int i = 0; i < maxFailedAttempts; ++i)
            {
                try
                {
                    auth.Authenticate(map("scheme", "basic", "principal", "bob", "credentials", UTF8.encode("gelato")));
                }
                catch (AuthenticationException e)
                {
                    assertThat(e.Status(), equalTo(Org.Neo4j.Kernel.Api.Exceptions.Status_Security.Unauthorized));
                }
            }

            // Expect
            Exception.expect(typeof(AuthenticationException));
            Exception.expect(HasStatus(Org.Neo4j.Kernel.Api.Exceptions.Status_Security.AuthenticationRateLimit));
            Exception.expectMessage("The client has provided incorrect authentication details too many times in a row.");

            //When
            auth.Authenticate(map("scheme", "basic", "principal", "bob", "credentials", UTF8.encode("gelato")));
        }
예제 #2
0
        public void Authenticate_MissingUserNameAddsError_Test()
        {
            target.Username = string.Empty;
            target.Authenticate();
            var result = from error in target.ValidationErrors where error.Contains("Username Required") select error;

            Assert.AreEqual(1, result.Count());
        }
        public async Task AuthenticateShouldCallNextWhenNoAuthHeaderExists()
        {
            var request  = new Mock <HttpRequest>();
            var response = new Mock <HttpResponse>();
            var context  = new Mock <HttpContext>();
            var headers  = new HeaderDictionary();
            var items    = new Dictionary <object, object>();

            context.Setup(x => x.Request).Returns(request.Object);
            context.Setup(x => x.Response).Returns(response.Object);
            context.Setup(x => x.Items).Returns(items);
            request.Setup(x => x.Headers).Returns(headers);

            var         expectedLogin = new Login();
            bool        nextWasCalled = false;
            Func <Task> next          = () =>
            {
                nextWasCalled = true;
                return(Task.FromResult(0));
            };

            var authenticate = Authentication.Authenticate(x => expectedLogin);

            await authenticate(context.Object, next);

            Assert.True(nextWasCalled);
            Assert.False(context.Object.IsAuthenticated());
        }
예제 #4
0
        public MvcWebApp()
        {
            Browser = Driver.GetDriver();

            try
            {
                if (WindowSize != null)
                {
                    Browser.Manage().Window.Size = WindowSize.Value;
                }

                foreach (var callback in PreTestCallbacks)
                {
                    callback(this);
                }

                Authentication?.Authenticate(this);
            }
            //If something happens and the class can't be created, we still need to destroy the browser.
            catch (Exception)
            {
                Browser.Quit();
                Browser.Dispose();
                throw;
            }
        }
예제 #5
0
        private async void Login_OnClick(object sender, RoutedEventArgs e)
        {
            if (Email.Text.IsNullOrEmpty() || Password.Password.IsNullOrEmpty())
            {
                ErrorMessage.Text = Externally.EmptyEmailOrPasswordIsNotAllowed;
                return;
            }

            Login.Disable();

            try
            {
                await Authentication.Authenticate(Email.Text, Password.Password);
            }
            catch (Exception exception)
            {
                SetErrorHint(exception);
                Login.Enable();
                return;
            }

            var mainWindow = new MainWindow();

            mainWindow.Show();

            Close();
        }
        public async Task AuthenticateShouldPopulateUserOnSuccess()
        {
            var request  = new Mock <HttpRequest>();
            var response = new Mock <HttpResponse>();
            var context  = new Mock <HttpContext>();
            var headers  = new HeaderDictionary();
            var items    = new Dictionary <object, object>();

            context.Setup(x => x.Request).Returns(request.Object);
            context.Setup(x => x.Response).Returns(response.Object);
            context.Setup(x => x.Items).Returns(items);
            request.Setup(x => x.Headers).Returns(headers);

            headers.Add("Authorization", "Bearer my-token");
            var expectedLogin = new Login
            {
                LoginId = 12,
                Email   = "*****@*****.**"
            };
            bool        nextWasCalled = false;
            Func <Task> next          = () =>
            {
                nextWasCalled = true;
                return(Task.FromResult(0));
            };

            var authenticate = Authentication.Authenticate(x => expectedLogin);

            await authenticate(context.Object, next);

            Assert.True(nextWasCalled);
            Assert.Equal(expectedLogin, context.Object.GetAuthenticatedLogin());
        }
        private void LoginToMonitis()
        {
            try
            {
                if (String.IsNullOrEmpty(LogintextBox.Text))
                {
                    MessageBox.Show("Monitis Account Login is empty.");
                    return;
                }
                if (String.IsNullOrEmpty(PasswordtextBox.Text))
                {
                    MessageBox.Show("Monitis Account Password is empty.");
                    return;
                }

                var auth = new Authentication();
                auth.Authenticate(LogintextBox.Text, PasswordtextBox.Text, OutputType.XML);
                DialogResult = DialogResult.Yes;
            }
            catch (Exception ex)
            {
                if (ex.Message == "Invalid username or password")
                {
                    MessageBox.Show("Invalid username or password");
                }
                else
                {
                    MessageBox.Show("Can not connect to Monitis Server");
                }
            }
        }
 /// <summary>
 /// Login with username and password
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LoginBtn_Click(object sender, EventArgs e)
 {
     if (IsTextFieldsEmpty())
     {
         (string username, string password)account = (username.Text, password.Text);
         if (au.Authenticate(account, accntList))
         {
             loginStat.Text = "Authentication is successful.";
             statusStrip1.Update();
             Thread.Sleep(1000);
             DialogResult = DialogResult.OK;
             this.Close();
         }
         else
         {
             MessageBox.Show("Your password or username is invalid.");
             loginStat.Text = "Authentication Failed";
         }
     }
     else
     {
         MessageBox.Show("Please enter Username and Password.");
     }
     ClearTextFields();
 }
예제 #9
0
        private static IEntityServices SetupConnection(int connectionId, string domainName)
        {
            ConnectionDto connection;

            using (var db = new TenantDb(ConnectionString.ForDomain(domainName)))
            {
                var conn = db.Connections.Single(x => x.ConnectionId == connectionId && x.IsActive);
                connection = new ConnectionDto
                {
                    ConnectionId = conn.ConnectionId,
                    Url = conn.Url.Trim(),
                    UserName = conn.UserName.Trim(),
                    Password = conn.Password.Trim()
                };
            }
            IAuthenticator authenticator = new Authentication();
            IOrganizationService organizationService = authenticator.Authenticate(new AuthenticationInformation
            {
                OrganizationUri = connection.Url,
                UserName = connection.UserName,
                Password = connection.Password
            });

            IEntityServices entityService = new EntityServices(organizationService);
            return entityService;
        }
예제 #10
0
파일: CpLogin.cs 프로젝트: DragonicK/Sigman
        public void Process(byte[] buffer, Connection connection)
        {
            var key = connection.AesKey.GetClientKey();
            var iv  = connection.AesKey.GetClientIv();

            var aes = new AesCryptography()
            {
                CipherMode  = System.Security.Cryptography.CipherMode.CBC,
                KeySize     = AesKeySize.KeySize128,
                PaddingMode = System.Security.Cryptography.PaddingMode.PKCS7
            };

            var decrypted = aes.Decrypt(buffer, key, iv, out var sucess);

            if (sucess)
            {
                var msg      = new ByteBuffer(decrypted);
                var username = msg.ReadString();
                var password = msg.ReadString();

                var result = Authentication.Authenticate(username, password);

                var packet = new SpAuthenticationResult(result);
                packet.Send(connection, true);

                Global.WriteLog($"User: {username} trying to login.", "Green");
                Global.WriteLog($"Result: {result}", "Black");
            }
            else
            {
                connection.Disconnect();
                Global.WriteLog($"Failed to decrypt login packet.", "Black");
            }
        }
예제 #11
0
        public ActionResult Index(Admin user)
        {
            var auth = Authentication.Authenticate(user);

            if (auth.status == 0)
            {
                Alert("Error", "Incorrect credentials", Enums.NotificationType.error);
                return(View());
            }

            if (auth.status == 1 && auth.authenticatedUserName != null)
            {
                Session["Staff_Name"] = auth.authenticatedUserName;
                Alert("Welcome", $"Hello {Session["Staff_Name"]}", Enums.NotificationType.success);

                return(RedirectToAction("Index", "StaffHomePage", new
                {
                    area = "Staff"
                }));
            }

            if (auth.status == 2 && auth.authenticatedUserName != null)
            {
                Session["Username"] = auth.authenticatedUserName;
                Alert("Welcome", $"Hello {Session["Username"]}", Enums.NotificationType.success);

                return(RedirectToAction("Index", "AdminHomePage", new
                {
                    area = "Admin"
                }));
            }

            return(View());
        }
        public static void GetReminder(string date)
        {
            CalendarService service = Authentication.Authenticate();

            EventsResource.ListRequest request = service.Events.List("primary");
            request.TimeMin      = DateTime.Parse(date, CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal);
            request.ShowDeleted  = false;
            request.SingleEvents = true;
            request.MaxResults   = 5;
            request.OrderBy      = EventsResource.ListRequest.OrderByEnum.StartTime;

            Events events = request.Execute();

            if (events.Items != null && events.Items.Count > 0)
            {
                Console.WriteLine("Events on that date:\n");
                foreach (var eventItem in events.Items)
                {
                    int    count = 0;
                    string when  = eventItem.Start.DateTime.ToString();
                    if (string.IsNullOrEmpty(when))
                    {
                        when = eventItem.Start.Date;
                    }
                    Console.WriteLine("{0}-{1}  ({2})", ++count, eventItem.Summary, when);
                }
                Console.WriteLine();
            }
            else
            {
                Console.WriteLine("No reminders found on that date.\n");
            }
        }
        public static void DeleteReminder(string date)
        {
            CalendarService service = Authentication.Authenticate();

            EventsResource.ListRequest request = service.Events.List("primary");
            request.TimeMin      = DateTime.Parse(date, CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal);
            request.ShowDeleted  = false;
            request.SingleEvents = true;
            request.MaxResults   = 5;
            request.OrderBy      = EventsResource.ListRequest.OrderByEnum.StartTime;

            Events events = request.Execute();

            if (events.Items != null && events.Items.Count > 0)
            {
                int count = 0;
                foreach (var eventItem in events.Items)
                {
                    string eventID = eventItem.Id;
                    service.Events.Delete("primary", eventID).Execute();
                    count++;
                }
                Console.WriteLine($"{count} reminder(s) deleted on that date.\n");
            }
            else
            {
                Console.WriteLine("No reminders found on that date.\n");
            }
        }
    // Use this for initialization
    void Start()
    {
#if UNITY_EDITOR || !UNITY_WSA
        // Unity will complain that the following statement is deprecated, however it's still working :)
#pragma warning disable CS0618 // Type or member is obsolete
        ServicePointManager.CertificatePolicy = new CustomCertificatePolicy();
#pragma warning restore CS0618 // Type or member is obsolete

        // This 'workaround' seems to work for the .NET Storage SDK, but not here. Leaving this for clarity
        //ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
#endif

        // FOR MORE INFO ON AUTHENTICATION AND HOW TO GET YOUR API KEY, PLEASE VISIT
        // https://docs.microsoft.com/en-us/azure/cognitive-services/speech/how-to/how-to-authentication
        Authentication auth           = new Authentication();
        Task <string>  authenticating = auth.Authenticate("https://northeurope.api.cognitive.microsoft.com/sts/v1.0/issueToken",
                                                          TTSKey); // INSERT-YOUR-BING-SPEECH-API-KEY-HERE

        //Task<string> authenticating = auth.Authenticate("https://westus.api.cognitive.microsoft.com/sts/v1.0/issueToken",
        //                                        TTSKey); // INSERT-YOUR-BING-SPEECH-API-KEY-HERE

        // Since the authentication process needs to run asynchronously, we run the code in a coroutine to
        // avoid blocking the main Unity thread.
        // Make sure you have successfully obtained a token before making any Text-to-Speech API calls.
        StartCoroutine(AuthenticateSpeechService(authenticating));
    }
예제 #15
0
        private async void Button_OnClicked(object sender, EventArgs e)
        {
            if (_oauth == null)
            {
                _oauth = new Authentication(new RootPageProvider {
                    Page = this
                }, UserDialogService,
                                            new SettingsProvider(AuthorityEntry.Text, ClientIdEntry.Text, ClientSecretEntry.Text,
                                                                 RedirectUrlEntry.Text, "auth", new Dictionary <string, string> {
                    { "scope", "profile" }
                }));
            }
            if (_token == null)
            {
                _token = await _oauth.Authenticate();

                UserDialogService.Alert(new AlertConfig {
                    Message = _token.ToString()
                });
                AccessTokenEntry.Text  = _token.AccessToken;
                RefreshTokenEntry.Text = _token.RefreshToken;
            }
            else
            {
                var token = await _oauth.RefreshToken(_token.RefreshToken);

                _token.ExpiresOn      = token.ExpiresOn;
                _token.AccessToken    = token.AccessToken;
                AccessTokenEntry.Text = _token.AccessToken;
            }
        }
예제 #16
0
        private void button_Login_Click(object sender, EventArgs e)
        {
            Authentication auth = new Authentication();
            AuthResponse   resp = auth.Authenticate(textBox_userID.Text, TextBox_secCode.Text);

            // TESTING
            resp           = new AuthResponse();
            resp.CompanyId = 1;
            resp.UserId    = 1;
            resp.UserName  = "******";
            resp.RoleId    = 1;
            resp.Success   = true;


            if (resp.Success)
            {
                Session.Instance.AuthUser = resp;
                MainMenu menu = new MainMenu();
                menu.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show(resp.Message);
            }
        }
예제 #17
0
        protected void ButtonLogin_Click(object sender, EventArgs e)
        {
            string loginToken = this.TextLogin.Text;
            string password   = this.TextPassword.Text;

            if (!string.IsNullOrEmpty(loginToken.Trim()) && !string.IsNullOrEmpty(password.Trim()))
            {
                try
                {
                    BasicPerson authenticatedPerson = Authentication.Authenticate(loginToken,
                                                                                  password);
                    Person p = Person.FromIdentity(authenticatedPerson.PersonId);

                    if (p.PreferredCulture != Thread.CurrentThread.CurrentCulture.Name)
                    {
                        p.PreferredCulture = Thread.CurrentThread.CurrentCulture.Name;
                    }

                    // TODO: Determine logged-on organization; possibly ask for clarification

                    FormsAuthentication.RedirectFromLoginPage(authenticatedPerson.PersonId + ",1", true);
                }
                catch (Exception exception)
                {
                    Debug.WriteLine(exception.ToString());
                    this.LabelLoginFailed.Text    = exception.ToString();
                    this.LabelLoginFailed.Visible = true;
                    this.TextLogin.Focus();
                }
            }
        }
예제 #18
0
        static void Main(string[] args)
        {
            Authentication stuff  = new Authentication();
            int            status = stuff.Authenticate();

            Search temp = new Search();
            var    data = temp.SearchRequest("audi", stuff.GetBearerToken());
        }
예제 #19
0
        public async void LoadVotesCommand()
        {
            await Authentication.Authenticate();

            var votestallyUrl = new Uri(App.BackendUrl + "/votes");
            var votestally    = await Common.WebClient.GetAsync <VoteTally[]>(votestallyUrl);

            VoteTallys.AddRange(votestally);
        }
 public void Authenticate_Valid_XML_ReturnsTrue()
 {
     var authentication = new Authentication();
     authentication.Authenticate(MonitisAccountInformation.Login, MonitisAccountInformation.Password, OutputType.XML);
     Assert.IsTrue((
         MonitisAccountInformation.ApiKey == authentication.apiKey&&
         MonitisAccountInformation.SekretKey == authentication.secretKey&&
         !string.IsNullOrEmpty(authentication.authToken)), "Authenticate (XML output) returns invalid value.");
 }
예제 #21
0
        private void btnLogin_Click(object sender, System.EventArgs e)
        {
            if (!btnLogin.Enabled)
            {
                return;
            }

            if (!Do)
            {
                MetroFramework.MetroMessageBox.Show(this, "Error\nOpen settings by Control+Alt+Shift+A\n Then restart!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (txtUsername.isEmptyOrHint())
            {
                txtUsername.Focus();
                return;
            }

            if (txtPassword.isEmptyOrHint())
            {
                txtPassword.Focus();
                return;
            }

            new Thread(() =>
            {
                txtUsername.Enabled = false;
                btnLogin.Enabled    = false;
                lblSignup.Enabled   = false;
                bool isOkay         = auth.Authenticate(txtUsername.Text.Trim(), txtPassword.Text.Trim());

                if (isOkay)
                {
                    Thread mainThread = new Thread(() =>
                    {
                        MainWindow w = new MainWindow();
                        Application.Run(w);
                    })
                    {
                        Name = "Main"
                    };
                    mainThread.SetApartmentState(ApartmentState.STA);
                    mainThread.Start();
                    this.ParentForm.Hide();
                }
                else
                {
                    MetroFramework.MetroMessageBox.Show(this, "Failed!", "Error", MessageBoxButtons.OK,
                                                        MessageBoxIcon.Error);
                    txtUsername.Enabled = true;
                    btnLogin.Enabled    = true;
                    lblSignup.Enabled   = true;
                }
                Thread.CurrentThread.Abort();
            }).Start();
        }
예제 #22
0
        private void StartAuthentication_Click(object sender, RoutedEventArgs e)
        {
            UserModel user = new UserModel();

            user.NameUser         = TxtUser.Text;
            user.Password         = TxtPassword.Text;
            LoginLayer.Visibility = Authentication.Authenticate(user) ? Visibility.Visible : Visibility.Collapsed;
            //var win = new MainBusiness();
            //win.Show();
        }
        public IActionResult Authenticate([FromBody] LoginViewModel loginParam)
        {
            var user = authentication.Authenticate(loginParam.UserName, loginParam.Password);

            if (user == null)
            {
                return(BadRequest(new { message = "Kullanici veya şifre hatalı!" }));
            }
            return(Ok(user));
        }
        public void Authenticate_Valid_Json_ReturnsTrue()
        {
            var authentication = new Authentication();

            authentication.Authenticate(MonitisAccountInformation.Login, MonitisAccountInformation.Password, OutputType.JSON);
            Assert.IsTrue((
                              MonitisAccountInformation.ApiKey == authentication.apiKey &&
                              MonitisAccountInformation.SekretKey == authentication.secretKey &&
                              !string.IsNullOrEmpty(authentication.authToken)), "Authenticate (XML output) returns invalid value.");
        }
예제 #25
0
 public IActionResult TryLogin([FromBody] UserCredentials ucred)
 {
     if (_auth.Authenticate(ucred))
     {
         return(Ok());
     }
     else
     {
         return(Unauthorized());
     }
 }
예제 #26
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            CredentialManager credentialManager = new CredentialManager(txtLoginName.Text, txtPassword.Text, dataAccess.GetConnection());

            if (!credentialManager.ValidateCredentials())
            {
                lblErrorMessages.Text = credentialManager.GetLastError();
                return;
            }
            Authentication.Authenticate(credentialManager.GetLogin(), credentialManager.GetTenant(), Session);
            Response.Redirect("PrintedDocuments.aspx");
        }
예제 #27
0
    // Use this for initialization
    void Start()
    {
        // The Authentication code below is only for the REST API version
        Authentication auth           = new Authentication();
        Task <string>  authenticating = auth.Authenticate($"https://{SpeechServiceRegion}.api.cognitive.microsoft.com/sts/v1.0/issueToken",
                                                          SpeechServiceAPIKey);

        // Since the authentication process needs to run asynchronously, we run the code in a coroutine to
        // avoid blocking the main Unity thread.
        // Make sure you have successfully obtained a token before making any Text-to-Speech API calls.
        StartCoroutine(AuthenticateSpeechService(authenticating));
    }
예제 #28
0
        // ReSharper disable once InconsistentNaming
        public static string TestCredentials(string credentialsLogin, string credentialsPass, string credentials2FA,
                                             string logonUriEncoded)
        {
            if (!string.IsNullOrEmpty(credentialsLogin.Trim()) && !string.IsNullOrEmpty(credentialsPass.Trim()))
            {
                string logonUri = HttpUtility.UrlDecode(logonUriEncoded);

                try
                {
                    Person authenticatedPerson = Authentication.Authenticate(credentialsLogin,
                                                                             credentialsPass);

                    int lastOrgId = authenticatedPerson.LastLogonOrganizationId;

                    if (PilotInstallationIds.IsPilot(PilotInstallationIds.PiratePartySE) && (lastOrgId == 3 || lastOrgId == 0))
                    {
                        lastOrgId = 1;                                   // legacy: log on to Piratpartiet SE if indeterminate; prevent sandbox for this pilot
                        authenticatedPerson.LastLogonOrganizationId = 1; // avoid future legacy problems
                    }
                    else if (lastOrgId == 0)
                    {
                        lastOrgId = Organization.SandboxIdentity;
                    }

                    Authority testAuthority = Authority.FromLogin(authenticatedPerson,
                                                                  Organization.FromIdentity(lastOrgId));

                    if (!authenticatedPerson.MemberOfWithInherited(lastOrgId) && !testAuthority.HasSystemAccess(AccessType.Read))
                    {
                        // If the person doesn't have access to the last organization (anymore), log on to Sandbox
                        // unless first pilot, in which case throw (deny login)

                        if (PilotInstallationIds.IsPilot(PilotInstallationIds.PiratePartySE))
                        {
                            throw new UnauthorizedAccessException();
                        }

                        lastOrgId = Organization.SandboxIdentity;
                    }

                    GuidCache.Set(logonUri + "-LoggedOn",
                                  Authority.FromLogin(authenticatedPerson, Organization.FromIdentity(lastOrgId)).ToEncryptedXml());

                    return("Success");  // Prepare here for "2FARequired" return code
                }
                catch (UnauthorizedAccessException)
                {
                    return("Fail");
                }
            }

            return("Fail");
        }
예제 #29
0
        public void OnLoginButtonClicked()
        {
            if (m_waitForResponse)
            {
                return;
            }

            var userName = m_loginForm.UserName.GetInput();
            var password = m_loginForm.Password.GetInput();

            Authentication.Authenticate(userName, password, OnAuthenticationCompleted);
            m_waitForResponse = true;
        }
 private static string GetToken()
 {
     if (_token == null || ((DateTime.Now - StartAuth) > TimeSpan.FromMinutes(30)))
     {
         _token    = Authentication.Authenticate(_options);
         StartAuth = DateTime.Now;
         return(_token);
     }
     else
     {
         return(_token);
     }
 }
예제 #31
0
        public void Authenticate_Test1()
        {
            // Arrange
            Environment.SetEnvironmentVariable(Authentication.RequireSignatureEnvironmentVariableName, null);
            var apiGatewayProxyRequest = new APIGatewayProxyRequest
            {
                Headers = new Dictionary <string, string>()
            };

            // Act
            var authenticationResult = authentication.Authenticate(apiGatewayProxyRequest);

            // Assert
            Assert.AreEqual(AuthenticationResult.InvalidSignature, authenticationResult);
        }
        public async Task <IActionResult> Index(LoginViewModel vm)
        {
            var result = await _authentication.Authenticate(vm.UserName, vm.Password);

            if (result)
            {
                return(Redirect("/"));
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Login ou senha inválido!");
                return(View(vm));
            }
        }
예제 #33
0
        private void TestConnectionAndAccount()
        {
            try
            {
                if (String.IsNullOrEmpty(LogintextBox.Text))
                {
                    MessageBox.Show("Monitis Account Login is empty.");
                    return;
                }
                if (String.IsNullOrEmpty(PasswordtextBox.Text))
                {
                    MessageBox.Show("Monitis Account Password is empty.");
                    return;
                }

                var auth = new Authentication();
                auth.Authenticate(LogintextBox.Text, PasswordtextBox.Text, OutputType.XML);
                MessageBox.Show("Success!");
            }
            catch (Exception ex)
            {
                if (ex.Message == "Invalid username or password")
                {
                    MessageBox.Show("Invalid username or password");
                }
                else
                {
                    MessageBox.Show("Can not connect to Monitis Server");
                }
            }
        }