Register and construct IAuthenticationRepository correctly

This commit is contained in:
Mark Monteiro 2020-04-04 19:36:27 -04:00
parent 4daa5436fc
commit a5234dfd88
2 changed files with 4 additions and 15 deletions

View file

@ -254,8 +254,6 @@ namespace Emby.Server.Implementations
/// <value>The user data repository.</value> /// <value>The user data repository.</value>
private IUserDataManager UserDataManager { get; set; } private IUserDataManager UserDataManager { get; set; }
private IAuthenticationRepository AuthenticationRepository { get; set; }
/// <summary> /// <summary>
/// Gets the installation manager. /// Gets the installation manager.
/// </summary> /// </summary>
@ -655,8 +653,7 @@ namespace Emby.Server.Implementations
serviceCollection.AddSingleton<IItemRepository, SqliteItemRepository>(); serviceCollection.AddSingleton<IItemRepository, SqliteItemRepository>();
AuthenticationRepository = GetAuthenticationRepository(); serviceCollection.AddSingleton<IAuthenticationRepository, AuthenticationRepository>();
serviceCollection.AddSingleton(AuthenticationRepository);
serviceCollection.AddSingleton<IUserRepository, SqliteUserRepository>(); serviceCollection.AddSingleton<IUserRepository, SqliteUserRepository>();
@ -755,6 +752,7 @@ namespace Emby.Server.Implementations
_sessionManager = Resolve<ISessionManager>(); _sessionManager = Resolve<ISessionManager>();
_httpServer = Resolve<IHttpServer>(); _httpServer = Resolve<IHttpServer>();
((AuthenticationRepository)Resolve<IAuthenticationRepository>()).Initialize();
((SqliteUserRepository)Resolve<IUserRepository>()).Initialize(); ((SqliteUserRepository)Resolve<IUserRepository>()).Initialize();
((ActivityRepository)Resolve<IActivityRepository>()).Initialize(); ((ActivityRepository)Resolve<IActivityRepository>()).Initialize();
_displayPreferencesRepository.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> /// <summary>
/// Dirty hacks. /// Dirty hacks.
/// </summary> /// </summary>

View file

@ -15,8 +15,8 @@ namespace Emby.Server.Implementations.Security
{ {
public class AuthenticationRepository : BaseSqliteRepository, IAuthenticationRepository public class AuthenticationRepository : BaseSqliteRepository, IAuthenticationRepository
{ {
public AuthenticationRepository(ILoggerFactory loggerFactory, IServerConfigurationManager config) public AuthenticationRepository(ILogger<AuthenticationRepository> logger, IServerConfigurationManager config)
: base(loggerFactory.CreateLogger(nameof(AuthenticationRepository))) : base(logger)
{ {
DbFilePath = Path.Combine(config.ApplicationPaths.DataPath, "authentication.db"); DbFilePath = Path.Combine(config.ApplicationPaths.DataPath, "authentication.db");
} }