aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/BaseApiService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/BaseApiService.cs')
-rw-r--r--MediaBrowser.Api/BaseApiService.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs
index 08686b43a..707cfb457 100644
--- a/MediaBrowser.Api/BaseApiService.cs
+++ b/MediaBrowser.Api/BaseApiService.cs
@@ -2,6 +2,7 @@
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
+using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Logging;
using ServiceStack.Web;
using System;
@@ -79,6 +80,20 @@ namespace MediaBrowser.Api
}
/// <summary>
+ /// Gets the session.
+ /// </summary>
+ /// <param name="sessionManager">The session manager.</param>
+ /// <returns>SessionInfo.</returns>
+ protected SessionInfo GetSession(ISessionManager sessionManager)
+ {
+ var auth = AuthorizationRequestFilterAttribute.GetAuthorization(Request);
+
+ return sessionManager.Sessions.First(i => string.Equals(i.DeviceId, auth.DeviceId) &&
+ string.Equals(i.Client, auth.Client) &&
+ string.Equals(i.ApplicationVersion, auth.Version));
+ }
+
+ /// <summary>
/// To the cached result.
/// </summary>
/// <typeparam name="T"></typeparam>