Use new authorization and session functions

This commit is contained in:
David
2020-06-19 13:03:53 +02:00
parent 42385a14f0
commit a5bd7f2d6e
2 changed files with 25 additions and 21 deletions

View File

@@ -1,6 +1,7 @@
using System;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Session;
using Microsoft.AspNetCore.Http;
namespace Jellyfin.Api.Helpers
{
@@ -28,10 +29,17 @@ namespace Jellyfin.Api.Helpers
: value.Split(separator);
}
internal static SessionInfo GetSession(ISessionContext sessionContext)
internal static SessionInfo GetSession(ISessionManager sessionManager, IAuthorizationContext authContext, HttpRequest request)
{
// TODO: how do we get a SessionInfo without IRequest?
SessionInfo session = sessionContext.GetSession("Request");
var authorization = authContext.GetAuthorizationInfo(request);
var user = authorization.User;
var session = sessionManager.LogSessionActivity(
authorization.Client,
authorization.Version,
authorization.DeviceId,
authorization.Device,
request.HttpContext.Connection.RemoteIpAddress.ToString(),
user);
if (session == null)
{