The Free Software Media System - Server Backend & API
Register and construct IAuthenticationRepository correctly
Mark Monteiroa5234dfd886e
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.csindex 9e570588a8..86b267303e 100644--- a/Emby.Server.Implementations/ApplicationHost.cs+++ b/Emby.Server.Implementations/ApplicationHost.cs@@ -254,8 +254,6 @@ namespace Emby.Server.Implementations/// <value>The user data repository.</value>private IUserDataManager UserDataManager { get; set; }- private IAuthenticationRepository AuthenticationRepository { get; set; }-/// <summary>/// Gets the installation manager./// </summary>@@ -655,8 +653,7 @@ namespace Emby.Server.ImplementationsserviceCollection.AddSingleton<IItemRepository, SqliteItemRepository>();- AuthenticationRepository = GetAuthenticationRepository();- serviceCollection.AddSingleton(AuthenticationRepository);+ serviceCollection.AddSingleton<IAuthenticationRepository, AuthenticationRepository>();serviceCollection.AddSingleton<IUserRepository, SqliteUserRepository>();@@ -755,6 +752,7 @@ namespace Emby.Server.Implementations_sessionManager = Resolve<ISessionManager>();_httpServer = Resolve<IHttpServer>();+ ((AuthenticationRepository)Resolve<IAuthenticationRepository>()).Initialize();((SqliteUserRepository)Resolve<IUserRepository>()).Initialize();((ActivityRepository)Resolve<IActivityRepository>()).Initialize();_displayPreferencesRepository.Initialize();@@ -839,15 +837,6 @@ namespace Emby.Server.Implementations}}- private IAuthenticationRepository GetAuthenticationRepository()- {- var repo = new AuthenticationRepository(LoggerFactory, ServerConfigurationManager);-- repo.Initialize();-- return repo;- }-/// <summary>/// Dirty hacks./// </summary>diff --git a/Emby.Server.Implementations/Security/AuthenticationRepository.cs b/Emby.Server.Implementations/Security/AuthenticationRepository.csindex 1ef5c4b996..4e4029f06f 100644--- a/Emby.Server.Implementations/Security/AuthenticationRepository.cs+++ b/Emby.Server.Implementations/Security/AuthenticationRepository.cs@@ -15,8 +15,8 @@ namespace Emby.Server.Implementations.Security{public class AuthenticationRepository : BaseSqliteRepository, IAuthenticationRepository{- public AuthenticationRepository(ILoggerFactory loggerFactory, IServerConfigurationManager config)- : base(loggerFactory.CreateLogger(nameof(AuthenticationRepository)))+ public AuthenticationRepository(ILogger<AuthenticationRepository> logger, IServerConfigurationManager config)+ : base(logger){DbFilePath = Path.Combine(config.ApplicationPaths.DataPath, "authentication.db");}