diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Session/SessionManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Session/SessionManager.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 985378f8e..d24de75cb 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -800,5 +800,29 @@ namespace MediaBrowser.Server.Implementations.Session session.AdditionalUsers.Remove(user); } } + + /// <summary> + /// Authenticates the new session. + /// </summary> + /// <param name="user">The user.</param> + /// <param name="password">The password.</param> + /// <param name="clientType">Type of the client.</param> + /// <param name="appVersion">The application version.</param> + /// <param name="deviceId">The device identifier.</param> + /// <param name="deviceName">Name of the device.</param> + /// <param name="remoteEndPoint">The remote end point.</param> + /// <returns>Task{SessionInfo}.</returns> + /// <exception cref="UnauthorizedAccessException"></exception> + public async Task<SessionInfo> AuthenticateNewSession(User user, string password, string clientType, string appVersion, string deviceId, string deviceName, string remoteEndPoint) + { + var result = await _userManager.AuthenticateUser(user, password).ConfigureAwait(false); + + if (!result) + { + throw new UnauthorizedAccessException("Invalid user or password entered."); + } + + return await LogSessionActivity(clientType, appVersion, deviceId, deviceName, remoteEndPoint, user).ConfigureAwait(false); + } } }
\ No newline at end of file |
