Remove Emby.Server.Connect

This commit is contained in:
Andrew Rabert 2018-12-10 19:27:54 -05:00
parent 03b637b22b
commit 7c2248727a
8 changed files with 54 additions and 75 deletions

View File

@ -1994,7 +1994,8 @@ namespace Emby.Server.Implementations
CanSelfRestart = CanSelfRestart, CanSelfRestart = CanSelfRestart,
CanSelfUpdate = CanSelfUpdate, CanSelfUpdate = CanSelfUpdate,
CanLaunchWebBrowser = CanLaunchWebBrowser, CanLaunchWebBrowser = CanLaunchWebBrowser,
WanAddress = ConnectManager.WanApiAddress, // TODO - remove WanAddress
WanAddress = "0.0.0.0",
HasUpdateAvailable = HasUpdateAvailable, HasUpdateAvailable = HasUpdateAvailable,
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup, SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
TranscodingTempPath = ApplicationPaths.TranscodingTempPath, TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
@ -2027,7 +2028,8 @@ namespace Emby.Server.Implementations
Version = ApplicationVersion.ToString(), Version = ApplicationVersion.ToString(),
Id = SystemId, Id = SystemId,
OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(), OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(),
WanAddress = ConnectManager.WanApiAddress, // TODO - remove WanAddress
WanAddress = "0.0.0.0",
ServerName = FriendlyName, ServerName = FriendlyName,
LocalAddress = localAddress LocalAddress = localAddress
}; };

View File

@ -50,14 +50,9 @@ namespace Emby.Server.Implementations.HttpServer.Security
var auth = AuthorizationContext.GetAuthorizationInfo(request); var auth = AuthorizationContext.GetAuthorizationInfo(request);
if (!IsExemptFromAuthenticationToken(auth, authAttribtues, request)) if (!IsExemptFromAuthenticationToken(auth, authAttribtues, request))
{
var valid = IsValidConnectKey(auth.Token);
if (!valid)
{ {
ValidateSecurityToken(request, auth.Token); ValidateSecurityToken(request, auth.Token);
} }
}
if (authAttribtues.AllowLocalOnly && !request.IsLocal) if (authAttribtues.AllowLocalOnly && !request.IsLocal)
{ {
@ -221,16 +216,6 @@ namespace Emby.Server.Implementations.HttpServer.Security
return info as AuthenticationInfo; return info as AuthenticationInfo;
} }
private bool IsValidConnectKey(string token)
{
if (string.IsNullOrEmpty(token))
{
return false;
}
return ConnectManager.IsAuthorizationTokenValid(token);
}
private void ValidateSecurityToken(IRequest request, string token) private void ValidateSecurityToken(IRequest request, string token)
{ {
if (string.IsNullOrEmpty(token)) if (string.IsNullOrEmpty(token))

View File

@ -162,10 +162,6 @@ namespace Emby.Server.Implementations.HttpServer.Security
_authRepo.Update(tokenInfo); _authRepo.Update(tokenInfo);
} }
} }
else
{
info.User = _connectManager.GetUserFromExchangeToken(token);
}
httpReq.Items["OriginalAuthenticationInfo"] = tokenInfo; httpReq.Items["OriginalAuthenticationInfo"] = tokenInfo;
} }

View File

@ -0,0 +1,46 @@
using MediaBrowser.Common.Events;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Connect;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Connect;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Users;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.IO;
using MediaBrowser.Controller.Authentication;
using MediaBrowser.Controller.Security;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.Plugins;
namespace Emby.Server.Implementations.Library
{
public class ConnectManager : IConnectManager
{
public ConnectManager()
{
}
}
}

View File

@ -272,20 +272,6 @@ namespace Emby.Server.Implementations.Library
authenticationProvider = authResult.Item1; authenticationProvider = authResult.Item1;
success = authResult.Item2; success = authResult.Item2;
} }
// Maybe user accidently entered connect credentials. let's be flexible
if (!success && user.ConnectLinkType.HasValue && !string.IsNullOrWhiteSpace(user.ConnectUserName))
{
try
{
await _connectFactory().Authenticate(user.ConnectUserName, password).ConfigureAwait(false);
success = true;
}
catch
{
}
}
} }
else else
{ {
@ -318,23 +304,6 @@ namespace Emby.Server.Implementations.Library
} }
} }
// Try originally entered username
if (!success && (user == null || !string.Equals(user.ConnectUserName, username, StringComparison.OrdinalIgnoreCase)))
{
try
{
var connectAuthResult = await _connectFactory().Authenticate(username, password).ConfigureAwait(false);
user = Users.FirstOrDefault(i => string.Equals(i.ConnectUserId, connectAuthResult.User.Id, StringComparison.OrdinalIgnoreCase));
success = user != null;
}
catch
{
}
}
if (user == null) if (user == null)
{ {
throw new SecurityException("Invalid username or password entered."); throw new SecurityException("Invalid username or password entered.");
@ -777,11 +746,6 @@ namespace Emby.Server.Implementations.Library
throw new ArgumentNullException("user"); throw new ArgumentNullException("user");
} }
if (user.ConnectLinkType.HasValue)
{
await _connectFactory().RemoveConnect(user).ConfigureAwait(false);
}
var allUsers = Users.ToList(); var allUsers = Users.ToList();
if (allUsers.FirstOrDefault(u => u.Id == user.Id) == null) if (allUsers.FirstOrDefault(u => u.Id == user.Id) == null)

View File

@ -148,16 +148,6 @@ namespace MediaBrowser.Api
var result = new UpdateStartupUserResult(); var result = new UpdateStartupUserResult();
if (!string.IsNullOrWhiteSpace(user.ConnectUserName) &&
string.IsNullOrWhiteSpace(request.ConnectUserName))
{
await _connectManager.RemoveConnect(user).ConfigureAwait(false);
}
else if (!string.Equals(user.ConnectUserName, request.ConnectUserName, StringComparison.OrdinalIgnoreCase))
{
result.UserLinkResult = await _connectManager.LinkUser(user, request.ConnectUserName).ConfigureAwait(false);
}
return result; return result;
} }
} }

View File

@ -25,9 +25,6 @@
<PackageReference Include="SQLitePCLRaw.core" Version="1.1.11" /> <PackageReference Include="SQLitePCLRaw.core" Version="1.1.11" />
<PackageReference Include="SQLitePCLRaw.provider.sqlite3.netstandard11" Version="1.1.11" /> <PackageReference Include="SQLitePCLRaw.provider.sqlite3.netstandard11" Version="1.1.11" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" /> <PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
<Reference Include="Emby.Server.Connect">
<HintPath>..\ThirdParty\emby\Emby.Server.Connect.dll</HintPath>
</Reference>
<Reference Include="Emby.Server.MediaEncoding"> <Reference Include="Emby.Server.MediaEncoding">
<HintPath>..\ThirdParty\emby\Emby.Server.MediaEncoding.dll</HintPath> <HintPath>..\ThirdParty\emby\Emby.Server.MediaEncoding.dll</HintPath>
</Reference> </Reference>

View File

@ -4,8 +4,8 @@ using System.Reflection;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
//using Emby.Server.CinemaMode; //using Emby.Server.CinemaMode;
using Emby.Server.Connect;
using Emby.Server.Implementations; using Emby.Server.Implementations;
using Emby.Server.Implementations.Library;
using Emby.Server.Implementations.HttpServer; using Emby.Server.Implementations.HttpServer;
using Emby.Server.Implementations.Net; using Emby.Server.Implementations.Net;
using MediaBrowser.Controller.Connect; using MediaBrowser.Controller.Connect;
@ -36,7 +36,7 @@ namespace MediaBrowser.Server.Mono
protected override IConnectManager CreateConnectManager() protected override IConnectManager CreateConnectManager()
{ {
return new ConnectManager(); return new Emby.Server.Implementations.Library.ConnectManager();
} }
//protected override ISyncManager CreateSyncManager() //protected override ISyncManager CreateSyncManager()
@ -54,7 +54,6 @@ namespace MediaBrowser.Server.Mono
var list = new List<Assembly>(); var list = new List<Assembly>();
list.Add(GetType().Assembly); list.Add(GetType().Assembly);
list.Add(typeof(ConnectManager).Assembly);
return list; return list;
} }