The Free Software Media System - Server Backend & API
Use EventManager for AuthenticationSuccess, AuthenticationFailure (#8960)
Cody Robibero678bcf9a80ef
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.csindex 2f60d01a92..afa3721b88 100644--- a/Emby.Server.Implementations/Session/SessionManager.cs+++ b/Emby.Server.Implementations/Session/SessionManager.cs@@ -95,12 +95,6 @@ namespace Emby.Server.Implementations.Session_deviceManager.DeviceOptionsUpdated += OnDeviceManagerDeviceOptionsUpdated;}- /// <inheritdoc />- public event EventHandler<GenericEventArgs<AuthenticationRequest>> AuthenticationFailed;-- /// <inheritdoc />- public event EventHandler<GenericEventArgs<AuthenticationResult>> AuthenticationSucceeded;-/// <summary>/// Occurs when playback has started./// </summary>@@ -1468,7 +1462,7 @@ namespace Emby.Server.Implementations.Sessionif (user is null){- AuthenticationFailed?.Invoke(this, new GenericEventArgs<AuthenticationRequest>(request));+ await _eventManager.PublishAsync(new GenericEventArgs<AuthenticationRequest>(request)).ConfigureAwait(false);throw new AuthenticationException("Invalid username or password entered.");}@@ -1504,8 +1498,7 @@ namespace Emby.Server.Implementations.SessionServerId = _appHost.SystemId};- AuthenticationSucceeded?.Invoke(this, new GenericEventArgs<AuthenticationResult>(returnResult));-+ await _eventManager.PublishAsync(new GenericEventArgs<AuthenticationResult>(returnResult)).ConfigureAwait(false);return returnResult;}diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.csindex ae3fcad29b..19ac007b93 100644--- a/Jellyfin.Server.Implementations/Users/UserManager.cs+++ b/Jellyfin.Server.Implementations/Users/UserManager.cs@@ -157,7 +157,9 @@ namespace Jellyfin.Server.Implementations.Usersawait UpdateUserInternalAsync(dbContext, user).ConfigureAwait(false);}- OnUserUpdated?.Invoke(this, new GenericEventArgs<User>(user));+ var eventArgs = new UserUpdatedEventArgs(user);+ await _eventManager.PublishAsync(eventArgs).ConfigureAwait(false);+ OnUserUpdated?.Invoke(this, eventArgs);}/// <inheritdoc/>diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.csindex b16399598c..eefc5d222e 100644--- a/MediaBrowser.Controller/Session/ISessionManager.cs+++ b/MediaBrowser.Controller/Session/ISessionManager.cs@@ -57,16 +57,6 @@ namespace MediaBrowser.Controller.Session/// </summary>event EventHandler<SessionEventArgs> CapabilitiesChanged;- /// <summary>- /// Occurs when [authentication failed].- /// </summary>- event EventHandler<GenericEventArgs<AuthenticationRequest>> AuthenticationFailed;-- /// <summary>- /// Occurs when [authentication succeeded].- /// </summary>- event EventHandler<GenericEventArgs<AuthenticationResult>> AuthenticationSucceeded;-/// <summary>/// Gets the sessions./// </summary>