aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Session
diff options
context:
space:
mode:
authorClaus Vium <cvium@users.noreply.github.com>2022-10-07 07:49:46 +0200
committerGitHub <noreply@github.com>2022-10-07 07:49:46 +0200
commit803972a76f6f8eb590b2de06662f7e83ce40273d (patch)
treedd72f47907390a7a88373d4cc7510d602ed2d556 /Emby.Server.Implementations/Session
parent927fe33d3a0ec7f9e0fb568cfd423c6e8b966c9d (diff)
parent6afc9110439c3c5345beb9a6bac1968ee4dedce8 (diff)
Merge pull request #8500 from cvium/fix_authcontext_usage
Diffstat (limited to 'Emby.Server.Implementations/Session')
-rw-r--r--Emby.Server.Implementations/Session/SessionWebSocketListener.cs16
1 files changed, 5 insertions, 11 deletions
diff --git a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
index 35fd5caae..c654828b1 100644
--- a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
+++ b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
@@ -6,6 +6,7 @@ using System.Linq;
using System.Net.WebSockets;
using System.Threading;
using System.Threading.Tasks;
+using Jellyfin.Api.Extensions;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Net;
@@ -53,7 +54,6 @@ namespace Emby.Server.Implementations.Session
private readonly ISessionManager _sessionManager;
private readonly ILogger<SessionWebSocketListener> _logger;
private readonly ILoggerFactory _loggerFactory;
- private readonly IAuthorizationContext _authorizationContext;
/// <summary>
/// The KeepAlive cancellation token.
@@ -66,17 +66,14 @@ namespace Emby.Server.Implementations.Session
/// <param name="logger">The logger.</param>
/// <param name="sessionManager">The session manager.</param>
/// <param name="loggerFactory">The logger factory.</param>
- /// <param name="authorizationContext">The authorization context.</param>
public SessionWebSocketListener(
ILogger<SessionWebSocketListener> logger,
ISessionManager sessionManager,
- ILoggerFactory loggerFactory,
- IAuthorizationContext authorizationContext)
+ ILoggerFactory loggerFactory)
{
_logger = logger;
_sessionManager = sessionManager;
_loggerFactory = loggerFactory;
- _authorizationContext = authorizationContext;
}
/// <inheritdoc />
@@ -110,21 +107,18 @@ namespace Emby.Server.Implementations.Session
private async Task<SessionInfo> GetSession(HttpContext httpContext, string remoteEndpoint)
{
- var authorizationInfo = await _authorizationContext.GetAuthorizationInfo(httpContext)
- .ConfigureAwait(false);
-
- if (!authorizationInfo.IsAuthenticated)
+ if (!httpContext.User.Identity?.IsAuthenticated ?? false)
{
return null;
}
- var deviceId = authorizationInfo.DeviceId;
+ var deviceId = httpContext.User.GetDeviceId();
if (httpContext.Request.Query.TryGetValue("deviceId", out var queryDeviceId))
{
deviceId = queryDeviceId;
}
- return await _sessionManager.GetSessionByAuthenticationToken(authorizationInfo.Token, deviceId, remoteEndpoint)
+ return await _sessionManager.GetSessionByAuthenticationToken(httpContext.User.GetToken(), deviceId, remoteEndpoint)
.ConfigureAwait(false);
}