Remove Emby.Server.Connect
This commit is contained in:
parent
03b637b22b
commit
7c2248727a
|
@ -1994,7 +1994,8 @@ namespace Emby.Server.Implementations
|
|||
CanSelfRestart = CanSelfRestart,
|
||||
CanSelfUpdate = CanSelfUpdate,
|
||||
CanLaunchWebBrowser = CanLaunchWebBrowser,
|
||||
WanAddress = ConnectManager.WanApiAddress,
|
||||
// TODO - remove WanAddress
|
||||
WanAddress = "0.0.0.0",
|
||||
HasUpdateAvailable = HasUpdateAvailable,
|
||||
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
|
||||
TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
|
||||
|
@ -2027,7 +2028,8 @@ namespace Emby.Server.Implementations
|
|||
Version = ApplicationVersion.ToString(),
|
||||
Id = SystemId,
|
||||
OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(),
|
||||
WanAddress = ConnectManager.WanApiAddress,
|
||||
// TODO - remove WanAddress
|
||||
WanAddress = "0.0.0.0",
|
||||
ServerName = FriendlyName,
|
||||
LocalAddress = localAddress
|
||||
};
|
||||
|
|
|
@ -51,12 +51,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
|||
|
||||
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)
|
||||
|
@ -221,16 +216,6 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
|||
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)
|
||||
{
|
||||
if (string.IsNullOrEmpty(token))
|
||||
|
|
|
@ -162,10 +162,6 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
|||
_authRepo.Update(tokenInfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
info.User = _connectManager.GetUserFromExchangeToken(token);
|
||||
}
|
||||
httpReq.Items["OriginalAuthenticationInfo"] = tokenInfo;
|
||||
}
|
||||
|
||||
|
|
46
Emby.Server.Implementations/Library/ConnectManager.cs
Normal file
46
Emby.Server.Implementations/Library/ConnectManager.cs
Normal 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()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -272,20 +272,6 @@ namespace Emby.Server.Implementations.Library
|
|||
authenticationProvider = authResult.Item1;
|
||||
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
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
throw new SecurityException("Invalid username or password entered.");
|
||||
|
@ -777,11 +746,6 @@ namespace Emby.Server.Implementations.Library
|
|||
throw new ArgumentNullException("user");
|
||||
}
|
||||
|
||||
if (user.ConnectLinkType.HasValue)
|
||||
{
|
||||
await _connectFactory().RemoveConnect(user).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
var allUsers = Users.ToList();
|
||||
|
||||
if (allUsers.FirstOrDefault(u => u.Id == user.Id) == null)
|
||||
|
@ -1277,4 +1241,4 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,16 +148,6 @@ namespace MediaBrowser.Api
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,9 +25,6 @@
|
|||
<PackageReference Include="SQLitePCLRaw.core" Version="1.1.11" />
|
||||
<PackageReference Include="SQLitePCLRaw.provider.sqlite3.netstandard11" Version="1.1.11" />
|
||||
<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">
|
||||
<HintPath>..\ThirdParty\emby\Emby.Server.MediaEncoding.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
|
@ -4,8 +4,8 @@ using System.Reflection;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
//using Emby.Server.CinemaMode;
|
||||
using Emby.Server.Connect;
|
||||
using Emby.Server.Implementations;
|
||||
using Emby.Server.Implementations.Library;
|
||||
using Emby.Server.Implementations.HttpServer;
|
||||
using Emby.Server.Implementations.Net;
|
||||
using MediaBrowser.Controller.Connect;
|
||||
|
@ -36,7 +36,7 @@ namespace MediaBrowser.Server.Mono
|
|||
|
||||
protected override IConnectManager CreateConnectManager()
|
||||
{
|
||||
return new ConnectManager();
|
||||
return new Emby.Server.Implementations.Library.ConnectManager();
|
||||
}
|
||||
|
||||
//protected override ISyncManager CreateSyncManager()
|
||||
|
@ -54,7 +54,6 @@ namespace MediaBrowser.Server.Mono
|
|||
var list = new List<Assembly>();
|
||||
|
||||
list.Add(GetType().Assembly);
|
||||
list.Add(typeof(ConnectManager).Assembly);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user