mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-20 06:30:57 +01:00
Add wrapper object for authentication event information
This commit is contained in:
@@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Events;
|
||||
using MediaBrowser.Controller.Events;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Controller.Events.Authentication;
|
||||
using MediaBrowser.Model.Activity;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -14,7 +14,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<AuthenticationRequest>>
|
||||
public class AuthenticationFailedLogger : IEventConsumer<GenericEventArgs<AuthenticationRequestEventArgs>>
|
||||
{
|
||||
private readonly ILocalizationManager _localizationManager;
|
||||
private readonly IActivityManager _activityManager;
|
||||
@@ -31,7 +31,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Security
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task OnEvent(GenericEventArgs<AuthenticationRequest> eventArgs)
|
||||
public async Task OnEvent(GenericEventArgs<AuthenticationRequestEventArgs> eventArgs)
|
||||
{
|
||||
await _activityManager.CreateAsync(new ActivityLog(
|
||||
string.Format(
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Entities;
|
||||
using Jellyfin.Data.Events;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Events;
|
||||
using MediaBrowser.Controller.Events.Authentication;
|
||||
using MediaBrowser.Model.Activity;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
|
||||
@@ -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<AuthenticationResult>>
|
||||
public class AuthenticationSucceededLogger : IEventConsumer<GenericEventArgs<AuthenticationResultEventArgs>>
|
||||
{
|
||||
private readonly ILocalizationManager _localizationManager;
|
||||
private readonly IActivityManager _activityManager;
|
||||
@@ -29,7 +29,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Security
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task OnEvent(GenericEventArgs<AuthenticationResult> eventArgs)
|
||||
public async Task OnEvent(GenericEventArgs<AuthenticationResultEventArgs> eventArgs)
|
||||
{
|
||||
await _activityManager.CreateAsync(new ActivityLog(
|
||||
string.Format(
|
||||
@@ -42,7 +42,7 @@ namespace Jellyfin.Server.Implementations.Events.Consumers.Security
|
||||
ShortOverview = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
_localizationManager.GetLocalizedString("LabelIpAddressValue"),
|
||||
eventArgs.Argument.SessionInfo.RemoteEndPoint),
|
||||
eventArgs.Argument.SessionInfo?.RemoteEndPoint),
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,11 @@ using Jellyfin.Server.Implementations.Events.Consumers.System;
|
||||
using Jellyfin.Server.Implementations.Events.Consumers.Updates;
|
||||
using Jellyfin.Server.Implementations.Events.Consumers.Users;
|
||||
using MediaBrowser.Common.Updates;
|
||||
using MediaBrowser.Controller.Authentication;
|
||||
using MediaBrowser.Controller.Events;
|
||||
using MediaBrowser.Controller.Events.Authentication;
|
||||
using MediaBrowser.Controller.Events.Session;
|
||||
using MediaBrowser.Controller.Events.Updates;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Controller.Subtitles;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -35,8 +34,8 @@ namespace Jellyfin.Server.Implementations.Events
|
||||
collection.AddScoped<IEventConsumer<SubtitleDownloadFailureEventArgs>, SubtitleDownloadFailureLogger>();
|
||||
|
||||
// Security consumers
|
||||
collection.AddScoped<IEventConsumer<GenericEventArgs<AuthenticationRequest>>, AuthenticationFailedLogger>();
|
||||
collection.AddScoped<IEventConsumer<GenericEventArgs<AuthenticationResult>>, AuthenticationSucceededLogger>();
|
||||
collection.AddScoped<IEventConsumer<GenericEventArgs<AuthenticationRequestEventArgs>>, AuthenticationFailedLogger>();
|
||||
collection.AddScoped<IEventConsumer<GenericEventArgs<AuthenticationResultEventArgs>>, AuthenticationSucceededLogger>();
|
||||
|
||||
// Session consumers
|
||||
collection.AddScoped<IEventConsumer<PlaybackStartEventArgs>, PlaybackStartLogger>();
|
||||
|
||||
Reference in New Issue
Block a user