diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.cs
index 01111a998..fede6caaf 100644
--- a/MediaBrowser.Api/UserService.cs
+++ b/MediaBrowser.Api/UserService.cs
@@ -106,6 +106,9 @@ namespace MediaBrowser.Api
/// The password.
[ApiMember(Name = "Password", IsRequired = true, DataType = "string", ParameterType = "body", Verb = "POST")]
public string Password { get; set; }
+
+ [ApiMember(Name = "PasswordMd5", IsRequired = true, DataType = "string", ParameterType = "body", Verb = "POST")]
+ public string PasswordMd5 { get; set; }
}
///
@@ -351,7 +354,8 @@ namespace MediaBrowser.Api
AppVersion = auth.Version,
DeviceId = auth.DeviceId,
DeviceName = auth.Device,
- Password = request.Password,
+ PasswordSha1 = request.Password,
+ PasswordMd5 = request.PasswordMd5,
RemoteEndPoint = Request.RemoteIp,
Username = request.Username
diff --git a/MediaBrowser.Controller/Connect/IConnectManager.cs b/MediaBrowser.Controller/Connect/IConnectManager.cs
index 8bd0332c0..52175fdd2 100644
--- a/MediaBrowser.Controller/Connect/IConnectManager.cs
+++ b/MediaBrowser.Controller/Connect/IConnectManager.cs
@@ -47,5 +47,13 @@ namespace MediaBrowser.Controller.Connect
/// The identifier.
/// Task.
Task CancelAuthorization(string id);
+
+ ///
+ /// Authenticates the specified username.
+ ///
+ /// The username.
+ /// The password MD5.
+ /// Task.
+ Task Authenticate(string username, string passwordMd5);
}
}
diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs
index 39ec2b85d..e9785e2ce 100644
--- a/MediaBrowser.Controller/Library/IUserManager.cs
+++ b/MediaBrowser.Controller/Library/IUserManager.cs
@@ -131,5 +131,15 @@ namespace MediaBrowser.Controller.Library
/// The remote end point.
/// UserDto.
UserDto GetUserDto(User user, string remoteEndPoint = null);
+
+ ///
+ /// Authenticates the user.
+ ///
+ /// The username.
+ /// The password sha1.
+ /// The password MD5.
+ /// The remote end point.
+ /// Task<System.Boolean>.
+ Task AuthenticateUser(string username, string passwordSha1, string passwordMd5, string remoteEndPoint);
}
}
diff --git a/MediaBrowser.Controller/Session/AuthenticationRequest.cs b/MediaBrowser.Controller/Session/AuthenticationRequest.cs
index 38871e814..bfd7f928b 100644
--- a/MediaBrowser.Controller/Session/AuthenticationRequest.cs
+++ b/MediaBrowser.Controller/Session/AuthenticationRequest.cs
@@ -4,7 +4,8 @@ namespace MediaBrowser.Controller.Session
public class AuthenticationRequest
{
public string Username { get; set; }
- public string Password { get; set; }
+ public string PasswordSha1 { get; set; }
+ public string PasswordMd5 { get; set; }
public string App { get; set; }
public string AppVersion { get; set; }
public string DeviceId { get; set; }
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs
index 56ff427ad..c76f78009 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingUtils.cs
@@ -20,6 +20,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
return string.Format("\"{0}\"", url);
}
+ if (protocol == MediaProtocol.Rtsp)
+ {
+ var url = inputFiles.First();
+
+ return string.Format("\"{0}\"", url);
+ }
return GetConcatInputArgument(inputFiles);
}
diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
index 0217c2dc7..3aacffd9b 100644
--- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
+++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
@@ -104,6 +104,9 @@
ApiClient\IServerEvents.cs
+
+ ApiClient\ServerCredentials.cs
+
ApiClient\ServerDiscoveryInfo.cs
diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
index 4fc9f479e..b80788a98 100644
--- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
+++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
@@ -70,6 +70,9 @@
ApiClient\IServerEvents.cs
+
+ ApiClient\ServerCredentials.cs
+
ApiClient\ServerDiscoveryInfo.cs
diff --git a/MediaBrowser.Model/ApiClient/ServerCredentials.cs b/MediaBrowser.Model/ApiClient/ServerCredentials.cs
new file mode 100644
index 000000000..787fb9a0d
--- /dev/null
+++ b/MediaBrowser.Model/ApiClient/ServerCredentials.cs
@@ -0,0 +1,60 @@
+using MediaBrowser.Model.Extensions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace MediaBrowser.Model.ApiClient
+{
+ public class ServerCredentials
+ {
+ public List Servers { get; set; }
+
+ public string ConnectUserId { get; set; }
+ public string ConnectAccessToken { get; set; }
+
+ public ServerCredentials()
+ {
+ Servers = new List();
+ }
+
+ public void AddOrUpdateServer(ServerInfo server)
+ {
+ if (server == null)
+ {
+ throw new ArgumentNullException("server");
+ }
+
+ var list = Servers.ToList();
+
+ var index = FindIndex(list, server.Id);
+
+ if (index != -1)
+ {
+ list[index] = server;
+ }
+ else
+ {
+ list.Add(server);
+ }
+
+ Servers = list;
+ }
+
+ private int FindIndex(List servers, string id)
+ {
+ var index = 0;
+
+ foreach (var server in servers)
+ {
+ if (StringHelper.Equals(id, server.Id))
+ {
+ return index;
+ }
+
+ index++;
+ }
+
+ return -1;
+ }
+ }
+}
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index 80c125933..3faca062a 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -71,6 +71,7 @@
+
diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
index e3d4b600c..f1a9601cb 100644
--- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
+++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
@@ -1,4 +1,6 @@
-using MediaBrowser.Common.Configuration;
+using System.Security.Cryptography;
+using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
@@ -825,5 +827,24 @@ namespace MediaBrowser.Server.Implementations.Connect
_logger.Debug("Connect returned a 404 when removing a user auth link. Handling it.");
}
}
+
+ public async Task Authenticate(string username, string passwordMd5)
+ {
+ var request = new HttpRequestOptions
+ {
+ Url = GetConnectUrl("user/authenticate")
+ };
+
+ request.SetPostData(new Dictionary
+ {
+ {"userName",username},
+ {"password",passwordMd5}
+ });
+
+ // No need to examine the response
+ using (var stream = (await _httpClient.SendAsync(request, "POST").ConfigureAwait(false)).Content)
+ {
+ }
+ }
}
}
diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs
index 163ad943e..1b3f64984 100644
--- a/MediaBrowser.Server.Implementations/Library/UserManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs
@@ -147,7 +147,12 @@ namespace MediaBrowser.Server.Implementations.Library
Users = await LoadUsers().ConfigureAwait(false);
}
- public async Task AuthenticateUser(string username, string passwordSha1, string remoteEndPoint)
+ public Task AuthenticateUser(string username, string passwordSha1, string remoteEndPoint)
+ {
+ return AuthenticateUser(username, passwordSha1, null, remoteEndPoint);
+ }
+
+ public async Task AuthenticateUser(string username, string passwordSha1, string passwordMd5, string remoteEndPoint)
{
if (string.IsNullOrWhiteSpace(username))
{
@@ -161,11 +166,31 @@ namespace MediaBrowser.Server.Implementations.Library
throw new AuthenticationException(string.Format("The {0} account is currently disabled. Please consult with your administrator.", user.Name));
}
- var success = string.Equals(GetPasswordHash(user), passwordSha1.Replace("-", string.Empty), StringComparison.OrdinalIgnoreCase);
+ var success = false;
- if (!success && _networkManager.IsInLocalNetwork(remoteEndPoint) && user.Configuration.EnableLocalPassword)
+ // Authenticate using local credentials if not a guest
+ if (!user.ConnectLinkType.HasValue || user.ConnectLinkType.Value != UserLinkType.Guest)
{
- success = string.Equals(GetLocalPasswordHash(user), passwordSha1.Replace("-", string.Empty), StringComparison.OrdinalIgnoreCase);
+ success = string.Equals(GetPasswordHash(user), passwordSha1.Replace("-", string.Empty), StringComparison.OrdinalIgnoreCase);
+
+ if (!success && _networkManager.IsInLocalNetwork(remoteEndPoint) && user.Configuration.EnableLocalPassword)
+ {
+ success = string.Equals(GetLocalPasswordHash(user), passwordSha1.Replace("-", string.Empty), StringComparison.OrdinalIgnoreCase);
+ }
+ }
+
+ // Maybe user accidently entered connect credentials. let's be flexible
+ if (!success && user.ConnectLinkType.HasValue && !string.IsNullOrWhiteSpace(passwordMd5))
+ {
+ try
+ {
+ await _connectFactory().Authenticate(user.ConnectUserName, passwordMd5).ConfigureAwait(false);
+ success = true;
+ }
+ catch
+ {
+
+ }
}
// Update LastActivityDate and LastLoginDate, then save
diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json
index 07faaf884..78ccba96e 100644
--- a/MediaBrowser.Server.Implementations/Localization/Server/server.json
+++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json
@@ -1245,5 +1245,6 @@
"HeaderSchedule": "Schedule",
"OptionEveryday": "Every day",
"OptionWeekdays": "Weekdays",
- "OptionWeekends": "Weekends"
+ "OptionWeekends": "Weekends",
+ "MessageProfileInfoSynced": "User profile information synced with Media Browser Connect."
}
diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
index 9f77f5294..cf204a5ba 100644
--- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs
+++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
@@ -1252,7 +1252,7 @@ namespace MediaBrowser.Server.Implementations.Session
&& !(user != null && user.ConnectLinkType.HasValue && user.ConnectLinkType.Value == UserLinkType.Guest);
var result = allowWithoutPassword ||
- await _userManager.AuthenticateUser(request.Username, request.Password, request.RemoteEndPoint).ConfigureAwait(false);
+ await _userManager.AuthenticateUser(request.Username, request.PasswordSha1, request.PasswordMd5, request.RemoteEndPoint).ConfigureAwait(false);
if (!result)
{
diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec
index 7591687ed..fa18975c9 100644
--- a/Nuget/MediaBrowser.Common.Internal.nuspec
+++ b/Nuget/MediaBrowser.Common.Internal.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common.Internal
- 3.0.487
+ 3.0.488
MediaBrowser.Common.Internal
Luke
ebr,Luke,scottisafool
@@ -12,7 +12,7 @@
Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.
Copyright © Media Browser 2013
-
+
diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec
index c130fa993..effe8e3fa 100644
--- a/Nuget/MediaBrowser.Common.nuspec
+++ b/Nuget/MediaBrowser.Common.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common
- 3.0.487
+ 3.0.488
MediaBrowser.Common
Media Browser Team
ebr,Luke,scottisafool
diff --git a/Nuget/MediaBrowser.Model.Signed.nuspec b/Nuget/MediaBrowser.Model.Signed.nuspec
index 9e4971e1f..ff1001cf3 100644
--- a/Nuget/MediaBrowser.Model.Signed.nuspec
+++ b/Nuget/MediaBrowser.Model.Signed.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Model.Signed
- 3.0.487
+ 3.0.488
MediaBrowser.Model - Signed Edition
Media Browser Team
ebr,Luke,scottisafool
diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec
index d9cbadb18..5660e78b0 100644
--- a/Nuget/MediaBrowser.Server.Core.nuspec
+++ b/Nuget/MediaBrowser.Server.Core.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Server.Core
- 3.0.487
+ 3.0.488
Media Browser.Server.Core
Media Browser Team
ebr,Luke,scottisafool
@@ -12,7 +12,7 @@
Contains core components required to build plugins for Media Browser Server.
Copyright © Media Browser 2013
-
+