public AuthenticationRepository(IUserRepository userRepository, ISqlSettingsRepository settingsRepository, ILdapRepository ldapRepository, ISamlRepository samlRepository, IServiceLogRepository logRepository, IApplicationSettingsRepository applicationSettingsRepository) { _userRepository = userRepository; _settingsRepository = settingsRepository; _ldapRepository = ldapRepository; _samlRepository = samlRepository; _log = logRepository; _applicationSettingsRepository = applicationSettingsRepository; }
public static async Task <User> ConvertToDbUser(UserDto user, OperationMode operationMode, ISqlSettingsRepository settingsRepository, int userId = 0) { var databaseUser = new User { Department = user.Department, Enabled = user.Enabled, ExpirePassword = user.ExpirePassword, GroupMembership = user.GroupMembership, Guest = user.Guest, Image_ImageId = user.Image_ImageId, Title = user.Title, Login = user.Login, Source = user.Source, InstanceAdminRoleId = user.InstanceAdminRoleId, AllowFallback = user.AllowFallback, DisplayName = user.DisplayName, FirstName = user.FirstName, LastName = user.LastName, Email = user.Email, UserSALT = Guid.NewGuid(), Id = userId, CurrentVersion = user.CurrentVersion }; if (operationMode == OperationMode.Create) { var settings = await settingsRepository.GetUserManagementSettingsAsync(); string decodedPassword; try { decodedPassword = SystemEncryptions.Decode(user.Password); } catch (FormatException) { throw new BadRequestException(ErrorMessages.IncorrectBase64FormatPasswordField, ErrorCodes.BadRequest); } if (string.IsNullOrWhiteSpace(decodedPassword) && (!user.AllowFallback.HasValue || !user.AllowFallback.Value) && settings.IsFederatedAuthenticationEnabled) { databaseUser.Password = GeneratePassword(); } else { ValidatePassword(databaseUser, decodedPassword); databaseUser.Password = HashingUtilities.GenerateSaltedHash(decodedPassword, databaseUser.UserSALT); } } return(databaseUser); }
internal ConfigController ( IApplicationSettingsRepository applicationSettingsRepository, ISqlSettingsRepository settingsRepository, IUserRepository userRepository, IFeaturesService featuresService, IHttpClientProvider httpClientProvider, IServiceLogRepository log) : base(log) { _applicationSettingsRepository = applicationSettingsRepository; _settingsRepository = settingsRepository; _userRepository = userRepository; _featuresService = featuresService; _httpClientProvider = httpClientProvider; }
internal UsersController ( IAuthenticationRepository authenticationRepository, IUserRepository userRepository, ISqlSettingsRepository settingsRepository, IEmailHelper emailHelper, IApplicationSettingsRepository applicationSettingsRepository, IServiceLogRepository log, IHttpClientProvider httpClientProvider, IPrivilegesRepository privilegesRepository, IItemInfoRepository itemInfoRepository, ISendMessageExecutor sendMessageExecutor, IImageService imageService, ISqlHelper sqlHelper) { _authenticationRepository = authenticationRepository; _userRepository = userRepository; _settingsRepository = settingsRepository; _emailHelper = emailHelper; _applicationSettingsRepository = applicationSettingsRepository; _log = log; _httpClientProvider = httpClientProvider; _privilegesManager = new PrivilegesManager(privilegesRepository); _itemInfoRepository = itemInfoRepository; _sendMessageExecutor = sendMessageExecutor; _imageService = imageService; _sqlHelper = sqlHelper; }
internal LdapRepository(ISqlSettingsRepository settingsRepository, IServiceLogRepository log, IAuthenticator authenticator = null) { _settingsRepository = settingsRepository; _log = log; _authenticator = authenticator ?? this; }
public static async Task <User> CreateDbUserFromDtoAsync(UserDto user, OperationMode operationMode, ISqlSettingsRepository settingsRepository, int userId = 0) { UserValidator.ValidateModel(user, operationMode); var dbUserModel = await UserConverter.ConvertToDbUser(user, operationMode, settingsRepository, userId); return(dbUserModel); }