This commit is contained in:
SpringHgui 2021-06-13 00:26:03 +08:00
parent 93fa1af379
commit 3d7ff85aee
6 changed files with 8 additions and 8 deletions

View File

@ -17,7 +17,7 @@ namespace FastTunnel.Core.Extensions
/// <param name="services"></param>
public static void AddFastTunnelServer(this IServiceCollection services)
{
services.AddSingleton<IFastTunnelAuthenticationFilter, DefaultAuthenticationFilter>();
services.AddSingleton<IAuthenticationFilter, DefaultAuthenticationFilter>();
services.AddSingleton<FastTunnelServer, FastTunnelServer>();
services.AddHostedService<ServiceFastTunnelServer>();

View File

@ -6,7 +6,7 @@ using System.Text;
namespace FastTunnel.Core.Filters
{
public class DefaultAuthenticationFilter : IFastTunnelAuthenticationFilter
public class DefaultAuthenticationFilter : IAuthenticationFilter
{
public virtual bool Authentication(FastTunnelServer server, LogInMassage requet)
{

View File

@ -6,7 +6,7 @@ using System.Text;
namespace FastTunnel.Core.Filters
{
public interface IFastTunnelAuthenticationFilter : IFastTunntlfilter
public interface IAuthenticationFilter : IFastTunntlfilter
{
bool Authentication(FastTunnelServer server, LogInMassage requet);
}

View File

@ -48,10 +48,10 @@ namespace FastTunnel.Core.Handlers
{
bool hasTunnel = false;
var filters = FastTunnelGlobal.GetFilters(typeof(IFastTunnelAuthenticationFilter));
var filters = FastTunnelGlobal.GetFilters(typeof(IAuthenticationFilter));
if (filters.Count() > 0)
{
foreach (IFastTunnelAuthenticationFilter item in filters)
foreach (IAuthenticationFilter item in filters)
{
var result = item.Authentication(server, requet);
if (!result)

View File

@ -20,13 +20,13 @@ namespace FastTunnel.Core.Services
public class ServiceFastTunnelServer : IHostedService
{
readonly ILogger<ServiceFastTunnelServer> _logger;
readonly IFastTunnelAuthenticationFilter _authenticationFilter;
readonly IAuthenticationFilter _authenticationFilter;
FastTunnelServer _Server;
public ServiceFastTunnelServer(
ILogger<ServiceFastTunnelServer> logger,
FastTunnelServer fastTunnelServer,
IFastTunnelAuthenticationFilter authenticationFilter)
IAuthenticationFilter authenticationFilter)
{
_logger = logger;
_authenticationFilter = authenticationFilter;

View File

@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace FastTunnel.Server.Filters
{
public class TestAuthenticationFilter : IFastTunnelAuthenticationFilter
public class TestAuthenticationFilter : IAuthenticationFilter
{
public bool Authentication(FastTunnelServer server, LogInMassage requet)
{