The Free Software Media System - Server Backend & API
Apply review suggestions
Shadowghost4bb17039d706
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.csindex f26cc56636..03ff96b19a 100644--- a/Emby.Server.Implementations/Session/SessionManager.cs+++ b/Emby.Server.Implementations/Session/SessionManager.cs@@ -1463,7 +1463,7 @@ namespace Emby.Server.Implementations.Sessionif (user is null){- await _eventManager.PublishAsync(new GenericEventArgs<AuthenticationRequestEventArgs>(new AuthenticationRequestEventArgs(request))).ConfigureAwait(false);+ await _eventManager.PublishAsync(new AuthenticationRequestEventArgs(request)).ConfigureAwait(false);throw new AuthenticationException("Invalid username or password entered.");}@@ -1499,7 +1499,7 @@ namespace Emby.Server.Implementations.SessionServerId = _appHost.SystemId};- await _eventManager.PublishAsync(new GenericEventArgs<AuthenticationResultEventArgs>(new AuthenticationResultEventArgs(returnResult))).ConfigureAwait(false);+ await _eventManager.PublishAsync(new AuthenticationResultEventArgs(returnResult)).ConfigureAwait(false);return returnResult;}diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationFailedLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationFailedLogger.csindex f4835a585f..b5f18d9834 100644--- a/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationFailedLogger.cs+++ b/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationFailedLogger.cs@@ -2,7 +2,6 @@using System.Globalization;using System.Threading.Tasks;using Jellyfin.Data.Entities;-using Jellyfin.Data.Events;using MediaBrowser.Controller.Events;using MediaBrowser.Controller.Events.Authentication;using MediaBrowser.Model.Activity;@@ -14,7 +13,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Security/// <summary>/// Creates an entry in the activity log when there is a failed login attempt./// </summary>- public class AuthenticationFailedLogger : IEventConsumer<GenericEventArgs<AuthenticationRequestEventArgs>>+ public class AuthenticationFailedLogger : IEventConsumer<AuthenticationRequestEventArgs>{private readonly ILocalizationManager _localizationManager;private readonly IActivityManager _activityManager;@@ -31,13 +30,13 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Security}/// <inheritdoc />- public async Task OnEvent(GenericEventArgs<AuthenticationRequestEventArgs> eventArgs)+ public async Task OnEvent(AuthenticationRequestEventArgs eventArgs){await _activityManager.CreateAsync(new ActivityLog(string.Format(CultureInfo.InvariantCulture,_localizationManager.GetLocalizedString("FailedLoginAttemptWithUserName"),- eventArgs.Argument.Username),+ eventArgs.Username),"AuthenticationFailed",Guid.Empty){@@ -45,7 +44,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.SecurityShortOverview = string.Format(CultureInfo.InvariantCulture,_localizationManager.GetLocalizedString("LabelIpAddressValue"),- eventArgs.Argument.RemoteEndPoint),+ eventArgs.RemoteEndPoint),}).ConfigureAwait(false);}}diff --git a/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationSucceededLogger.cs b/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationSucceededLogger.csindex fe2737bafc..2ee5b4e88d 100644--- a/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationSucceededLogger.cs+++ b/Jellyfin.Server.Implementations/Events/Consumers/Security/AuthenticationSucceededLogger.cs@@ -12,7 +12,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Security/// <summary>/// Creates an entry in the activity log when there is a successful login attempt./// </summary>- public class AuthenticationSucceededLogger : IEventConsumer<GenericEventArgs<AuthenticationResultEventArgs>>+ public class AuthenticationSucceededLogger : IEventConsumer<AuthenticationResultEventArgs>{private readonly ILocalizationManager _localizationManager;private readonly IActivityManager _activityManager;@@ -29,20 +29,20 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Security}/// <inheritdoc />- public async Task OnEvent(GenericEventArgs<AuthenticationResultEventArgs> eventArgs)+ public async Task OnEvent(AuthenticationResultEventArgs eventArgs){await _activityManager.CreateAsync(new ActivityLog(string.Format(CultureInfo.InvariantCulture,_localizationManager.GetLocalizedString("AuthenticationSucceededWithUserName"),- eventArgs.Argument.User.Name),+ eventArgs.User.Name),"AuthenticationSucceeded",- eventArgs.Argument.User.Id)+ eventArgs.User.Id){ShortOverview = string.Format(CultureInfo.InvariantCulture,_localizationManager.GetLocalizedString("LabelIpAddressValue"),- eventArgs.Argument.SessionInfo?.RemoteEndPoint),+ eventArgs.SessionInfo?.RemoteEndPoint),}).ConfigureAwait(false);}}diff --git a/Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.cs b/Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.csindex 93ab15e24b..9a473de52d 100644--- a/Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.cs+++ b/Jellyfin.Server.Implementations/Events/EventingServiceCollectionExtensions.cs@@ -34,8 +34,8 @@ namespace Jellyfin.Server.Implementations.Eventscollection.AddScoped<IEventConsumer<SubtitleDownloadFailureEventArgs>, SubtitleDownloadFailureLogger>();// Security consumers- collection.AddScoped<IEventConsumer<GenericEventArgs<AuthenticationRequestEventArgs>>, AuthenticationFailedLogger>();- collection.AddScoped<IEventConsumer<GenericEventArgs<AuthenticationResultEventArgs>>, AuthenticationSucceededLogger>();+ collection.AddScoped<IEventConsumer<AuthenticationRequestEventArgs>, AuthenticationFailedLogger>();+ collection.AddScoped<IEventConsumer<AuthenticationResultEventArgs>, AuthenticationSucceededLogger>();// Session consumerscollection.AddScoped<IEventConsumer<PlaybackStartEventArgs>, PlaybackStartLogger>();diff --git a/MediaBrowser.Controller/Events/Authentication/AuthenticationRequestEventArgs.cs b/MediaBrowser.Controller/Events/Authentication/AuthenticationRequestEventArgs.csindex c0d8a277bd..2143c69986 100644--- a/MediaBrowser.Controller/Events/Authentication/AuthenticationRequestEventArgs.cs+++ b/MediaBrowser.Controller/Events/Authentication/AuthenticationRequestEventArgs.cs@@ -6,7 +6,7 @@ namespace MediaBrowser.Controller.Events.Authentication;/// <summary>/// A class representing an authentication result event./// </summary>-public class AuthenticationRequestEventArgs+public class AuthenticationRequestEventArgs : EventArgs{/// <summary>/// Initializes a new instance of the <see cref="AuthenticationRequestEventArgs"/> class.diff --git a/MediaBrowser.Controller/Events/Authentication/AuthenticationResultEventArgs.cs b/MediaBrowser.Controller/Events/Authentication/AuthenticationResultEventArgs.csindex 5564fa1cef..357ef9406d 100644--- a/MediaBrowser.Controller/Events/Authentication/AuthenticationResultEventArgs.cs+++ b/MediaBrowser.Controller/Events/Authentication/AuthenticationResultEventArgs.cs@@ -1,3 +1,4 @@+using System;using MediaBrowser.Controller.Authentication;using MediaBrowser.Controller.Session;using MediaBrowser.Model.Dto;@@ -7,7 +8,7 @@ namespace MediaBrowser.Controller.Events.Authentication;/// <summary>/// A class representing an authentication result event./// </summary>-public class AuthenticationResultEventArgs+public class AuthenticationResultEventArgs : EventArgs{/// <summary>/// Initializes a new instance of the <see cref="AuthenticationResultEventArgs"/> class.