public void PasswordManagementService_ValidateUser_WithCorrectPasswordShouldReturnTrue()
        {
            var user = new User();

            A.CallTo(() => _passwordEncryptionManager.ValidateUser(user, "password")).Returns(true);

            var result = _passwordManagementService.ValidateUser(user, "password");

            result.Should().BeTrue();
        }
Пример #2
0
        public bool ValidateUser(User user, string password)
        {
            var compareByteArrays = _passwordEncryptionManager.ValidateUser(user, password);

            if (compareByteArrays && !string.IsNullOrWhiteSpace(user.CurrentEncryption))
            {
                _passwordEncryptionManager.UpdateEncryption(user, password);
            }
            return(compareByteArrays);
        }
        public bool ValidateUser(User user, string password)
        {
            if (!string.IsNullOrWhiteSpace(user.Source) && _userSources.ContainsKey(user.Source))
            {
                return(_userSources[user.Source].ValidateUser(user, password));
            }

            var compareByteArrays = _passwordEncryptionManager.ValidateUser(user, password);

            if (compareByteArrays && !string.IsNullOrWhiteSpace(user.CurrentEncryption))
            {
                _passwordEncryptionManager.UpdateEncryption(user, password);
            }
            return(compareByteArrays);
        }