aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Session/SessionManager.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-09-17 00:22:37 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-09-17 00:22:37 -0400
commitdc45d342ed8b0af04d6b7ea4eca519dd1cfba5cb (patch)
tree2059be0e9f8df558277409d15e8a6da63239a477 /MediaBrowser.Server.Implementations/Session/SessionManager.cs
parente20ca8f407fda5be6b17aac9d34a84621ae56e6b (diff)
fix web socket session creation
Diffstat (limited to 'MediaBrowser.Server.Implementations/Session/SessionManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Session/SessionManager.cs15
1 files changed, 13 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
index b21fcddd4..afcdf9d90 100644
--- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs
+++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
@@ -1341,8 +1341,19 @@ namespace MediaBrowser.Server.Implementations.Session
private async Task<AuthenticationResult> AuthenticateNewSessionInternal(AuthenticationRequest request, bool enforcePassword)
{
- var user = _userManager.Users
- .FirstOrDefault(i => string.Equals(request.Username, i.Name, StringComparison.OrdinalIgnoreCase));
+ User user = null;
+ if (!string.IsNullOrWhiteSpace(request.UserId))
+ {
+ var idGuid = new Guid(request.UserId);
+ user = _userManager.Users
+ .FirstOrDefault(i => i.Id == idGuid);
+ }
+
+ if (user == null)
+ {
+ user = _userManager.Users
+ .FirstOrDefault(i => string.Equals(request.Username, i.Name, StringComparison.OrdinalIgnoreCase));
+ }
if (user != null && !string.IsNullOrWhiteSpace(request.DeviceId))
{