Beispiel #1
0
        /// <summary>
        /// Applies the configuration settings.
        /// </summary>
        /// <param name="configuration"></param>
        public void ApplyConfiguration(CruiseControl configuration)
        {
            var security = (configuration.Security) as InternalServerSecurity;

            foreach (ListViewItem user in userList.CheckedItems)
            {
                var data = user.Tag as string[];
                if (data.Length > 2)
                {
                    var userValue = new UserPasswordAuthentication();
                    userValue.UserName    = data[0];
                    userValue.DisplayName = data[1];
                    userValue.Password    = data[2];
                    security.Users.Add(userValue);
                }
                else
                {
                    var userValue = new UsernameAuthentication();
                    userValue.UserName = data[0];
                    if (data.Length > 1)
                    {
                        userValue.DisplayName = data[1];
                    }
                    security.Users.Add(userValue);
                }
            }
        }
Beispiel #2
0
        public void TestMissingUserName()
        {
            UserPasswordAuthentication authentication = new UserPasswordAuthentication("johndoe", "iknowyou");
            LoginRequest credentials = new LoginRequest();
            bool         isValid     = authentication.Authenticate(credentials);

            Assert.IsFalse(isValid);
        }
Beispiel #3
0
        public void GetUserNameReturnsName()
        {
            string       userName    = "******";
            LoginRequest credentials = new LoginRequest(userName);
            UserPasswordAuthentication authentication = new UserPasswordAuthentication();
            string result = authentication.GetUserName(credentials);

            Assert.AreEqual(userName, result);
        }
Beispiel #4
0
        public void TestIncorrectUserName()
        {
            UserPasswordAuthentication authentication = new UserPasswordAuthentication("johndoe", "iknowyou");
            LoginRequest credentials = new LoginRequest("janedoe");

            credentials.AddCredential(LoginRequest.PasswordCredential, "iknowyou");
            bool isValid = authentication.Authenticate(credentials);

            Assert.IsFalse(isValid);
        }
Beispiel #5
0
        public void GetSetAllProperties()
        {
            string userName    = "******";
            string displayName = "John Doe";
            string password    = "******";
            UserPasswordAuthentication authentication = new UserPasswordAuthentication();

            authentication.UserName = userName;
            Assert.AreEqual(userName, authentication.UserName, "UserName not correctly set");
            Assert.AreEqual(userName, authentication.Identifier, "Identifier not correctly set");
            authentication.Password = password;
            Assert.AreEqual(password, authentication.Password, "Password not correctly set");
            authentication.DisplayName = displayName;
            Assert.AreEqual(displayName, authentication.DisplayName, "DisplayName not correctly set");
        }