diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs index ec3dfeb60..ede85fb67 100644 --- a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs +++ b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs @@ -49,6 +49,7 @@ namespace Emby.Server.Implementations.HttpServer.Security string device = null; string client = null; string version = null; + string token = null; if (auth != null) { @@ -56,9 +57,13 @@ namespace Emby.Server.Implementations.HttpServer.Security auth.TryGetValue("Device", out device); auth.TryGetValue("Client", out client); auth.TryGetValue("Version", out version); + auth.TryGetValue("Token", out token); } - var token = httpReq.Headers["X-Emby-Token"]; + if (string.IsNullOrWhiteSpace(token)) + { + token = httpReq.Headers["X-Emby-Token"]; + } if (string.IsNullOrWhiteSpace(token)) { @@ -156,8 +161,10 @@ namespace Emby.Server.Implementations.HttpServer.Security // There should be at least to parts if (parts.Length != 2) return null; + var acceptedNames = new[] { "MediaBrowser", "Emby"}; + // It has to be a digest request - if (!string.Equals(parts[0], "MediaBrowser", StringComparison.OrdinalIgnoreCase)) + if (!acceptedNames.Contains(parts[0] ?? string.Empty, StringComparer.OrdinalIgnoreCase)) { return null; } @@ -174,7 +181,7 @@ namespace Emby.Server.Implementations.HttpServer.Security if (param.Length == 2) { - var value = NormalizeValue (param[1].Trim(new[] { '"' })); + var value = NormalizeValue(param[1].Trim(new[] { '"' })); result.Add(param[0], value); } } @@ -182,14 +189,14 @@ namespace Emby.Server.Implementations.HttpServer.Security return result; } - private string NormalizeValue(string value) - { - if (string.IsNullOrWhiteSpace (value)) - { - return value; - } + private string NormalizeValue(string value) + { + if (string.IsNullOrWhiteSpace(value)) + { + return value; + } - return System.Net.WebUtility.HtmlEncode(value); - } + return System.Net.WebUtility.HtmlEncode(value); + } } } diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 20253367e..4bb58cd73 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.693 + 3.0.694 Emby.Common Emby Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 08e604150..c475a4c91 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.693 + 3.0.694 Emby.Server.Core Emby Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Emby Server. Copyright © Emby 2013 - +