예제 #1
0
        public async Task MessageReturnedWhenTwoFactorModeDoesNotMatchEnum()
        {
            var columnName    = Constant.DelmitedFileColumnNames.LoginMethod.TwoFactorMode;
            var currentColumn = new ObjectColumn <Int32>(columnName)
            {
                Data = "Random Non Existing two-factor mode"
            };
            var objectColumns = new List <IObjectColumn>()
            {
                currentColumn,
                new ObjectColumn <String>(Constant.DelmitedFileColumnNames.UserAdminObject.CanChangePassword)
                {
                    Data = "true"
                },
                new ObjectColumn <String>(Constant.DelmitedFileColumnNames.UserAdminObject.MaximumPasswordAgeInDays)
                {
                    Data = "30"
                },
                new ObjectColumn <String>(Constant.DelmitedFileColumnNames.LoginMethod.TwoFactorInfo)
                {
                    Data = "*****@*****.**"
                },
                new ObjectColumn <String>(Constant.DelmitedFileColumnNames.UserAdminObject.UserMustChangePasswordOnNextLogin)
                {
                    Data = "false"
                }
            };
            var validation     = new ValidationPasswordLoginMethod(currentColumn, objectColumns);
            var expectedResult = String.Format(Constant.Messages.Violations.InvalidTwoFactorMode, columnName, String.Join(",", Enum.GetNames(typeof(Relativity.Services.Security.Models.TwoFactorMode))));
            var result         = await validation.ValidateAsync(null);

            Assert.AreEqual(expectedResult, result);
        }
예제 #2
0
        public async Task NoMessageReturnedWhenTwoFactorModeMatchesEnum()
        {
            var currentColumn = new ObjectColumn <Int32>(Constant.DelmitedFileColumnNames.LoginMethod.TwoFactorMode)
            {
                Data = Relativity.Services.Security.Models.TwoFactorMode.Always.ToString()
            };
            var objectColumns = new List <IObjectColumn>()
            {
                currentColumn,
                new ObjectColumn <String>(Constant.DelmitedFileColumnNames.UserAdminObject.CanChangePassword)
                {
                    Data = "true"
                },
                new ObjectColumn <String>(Constant.DelmitedFileColumnNames.UserAdminObject.MaximumPasswordAgeInDays)
                {
                    Data = "30"
                },
                new ObjectColumn <String>(Constant.DelmitedFileColumnNames.LoginMethod.TwoFactorInfo)
                {
                    Data = "*****@*****.**"
                },
                new ObjectColumn <String>(Constant.DelmitedFileColumnNames.UserAdminObject.UserMustChangePasswordOnNextLogin)
                {
                    Data = "false"
                }
            };
            var validation = new ValidationPasswordLoginMethod(currentColumn, objectColumns);
            var result     = await validation.ValidateAsync(null);

            Assert.AreEqual(null, result);
        }
예제 #3
0
        public Block CreateBlock(Page page)
        {
            //Reset current block size every time
            currentBlockCount = 0;

            var block = new Block()
            {
                Objects = new ObjectRefBlock()//new Columns()
            };

            _objectColumn = new ObjectColumn()
            {
                ColumnId = (uint)columnId
            };

            _objectColumn.Objects = CreateColumns(page);

            //Went over the cache limit
            if (currentSize > MaxSize)
            {
                //Clear the current size
                currentSize = 0;
                //Start the counter from 0 again
                counter = 0;
                //Clear the cache
                _lookup.Clear();
                //Set so that the previous cache should be forgotten
                _objectColumn.ClearPrevious = true;
            }

            page.Objects.Add(_objectColumn);

            return(block);
        }
예제 #4
0
        public async Task MessageReturnedWhenTwoFactorInfoNotAnEmailAddress()
        {
            var columnName    = Constant.DelmitedFileColumnNames.LoginMethod.TwoFactorInfo;
            var currentColumn = new ObjectColumn <String>(columnName)
            {
                Data = "NotAtSymbolNotAnEmailAddress"
            };
            var objectColumns = new List <IObjectColumn>()
            {
                currentColumn,
                new ObjectColumn <String>(Constant.DelmitedFileColumnNames.LoginMethod.TwoFactorMode)
                {
                    Data = Relativity.Services.Security.Models.TwoFactorMode.Always.ToString()
                }
            };
            var validation     = new ValidationPasswordLoginMethod(currentColumn, objectColumns);
            var expectedResult = String.Format(Constant.Messages.Violations.InvalidTwoFactorInfoEmailBadFormat, Constant.DelmitedFileColumnNames.LoginMethod.TwoFactorInfo, Relativity.Services.Security.Models.TwoFactorMode.None.ToString());
            var result         = await validation.ValidateAsync(null);

            Assert.AreEqual(expectedResult, result);
        }
예제 #5
0
        public async Task MessageReturnedWhenTwoFactorModeNotNullAndTwoFactorInfoPopulated()
        {
            var columnName    = Constant.DelmitedFileColumnNames.LoginMethod.TwoFactorInfo;
            var currentColumn = new ObjectColumn <Int32>(columnName)
            {
                Data = "*****@*****.**"
            };
            var objectColumns = new List <IObjectColumn>()
            {
                currentColumn,
                new ObjectColumn <String>(Constant.DelmitedFileColumnNames.LoginMethod.TwoFactorMode)
                {
                    Data = Relativity.Services.Security.Models.TwoFactorMode.None.ToString()
                }
            };
            var validation     = new ValidationPasswordLoginMethod(currentColumn, objectColumns);
            var expectedResult = String.Format(Constant.Messages.Violations.TwoFactorInfoShouldBeEmpty, columnName, Constant.DelmitedFileColumnNames.LoginMethod.TwoFactorMode, Relativity.Services.Security.Models.TwoFactorMode.None.ToString());
            var result         = await validation.ValidateAsync(null);

            Assert.AreEqual(expectedResult, result);
        }