diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-11-15 10:51:49 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-11-15 10:51:49 -0500 |
| commit | 4edcab9c11cf8e8cfbfc0bd9afe7b7ec067fd1e3 (patch) | |
| tree | f805e748ff55a9d45bf67371efa4c6b46620bcac /MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs | |
| parent | a4b75934e5a4737ba7721c33ad9a009060a8a246 (diff) | |
updated service stack
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs index e9a8cc752..57d87749c 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs @@ -4,6 +4,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Security; +using MediaBrowser.Controller.Session; using System; using System.Collections.Generic; using System.Linq; @@ -14,10 +15,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security { private readonly IServerConfigurationManager _config; - public AuthService(IUserManager userManager, IAuthorizationContext authorizationContext, IServerConfigurationManager config, IConnectManager connectManager) + public AuthService(IUserManager userManager, IAuthorizationContext authorizationContext, IServerConfigurationManager config, IConnectManager connectManager, ISessionManager sessionManager) { AuthorizationContext = authorizationContext; _config = config; + SessionManager = sessionManager; ConnectManager = connectManager; UserManager = userManager; } @@ -25,6 +27,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security public IUserManager UserManager { get; private set; } public IAuthorizationContext AuthorizationContext { get; private set; } public IConnectManager ConnectManager { get; private set; } + public ISessionManager SessionManager { get; private set; } /// <summary> /// Redirect the client to a specific URL if authentication failed. @@ -91,6 +94,18 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security ValidateRoles(roles, user); } + + if (!string.IsNullOrWhiteSpace(auth.DeviceId) && + !string.IsNullOrWhiteSpace(auth.Client) && + !string.IsNullOrWhiteSpace(auth.Device)) + { + SessionManager.LogSessionActivity(auth.Client, + auth.Version, + auth.DeviceId, + auth.Device, + request.RemoteIp, + user); + } } private bool IsExemptFromAuthenticationToken(AuthorizationInfo auth, IAuthenticationAttributes authAttribtues) |
