diff --git a/FastTunel.Core.WebApi/FastTunel.Core.WebApi.csproj.user b/FastTunel.Core.WebApi/FastTunel.Core.WebApi.csproj.user
index efbdd2d..a4a0915 100644
--- a/FastTunel.Core.WebApi/FastTunel.Core.WebApi.csproj.user
+++ b/FastTunel.Core.WebApi/FastTunel.Core.WebApi.csproj.user
@@ -3,5 +3,6 @@
ApiControllerEmptyScaffolder
root/Common/Api
+ IIS Express
\ No newline at end of file
diff --git a/FastTunnel.Client/appsettings.json b/FastTunnel.Client/appsettings.json
index c22829e..25a3742 100644
--- a/FastTunnel.Client/appsettings.json
+++ b/FastTunnel.Client/appsettings.json
@@ -57,6 +57,7 @@
"LocalPort": 3389, // windows远程桌面端口为3389
"RemotePort": 1274 // 访问 服务端ip:1274 即可实现远程window桌面
}
- ]
+ ],
+ "Token": "TOKEN_FOR_CLIENT_AUTHENTICATION"
}
}
\ No newline at end of file
diff --git a/FastTunnel.Core/Client/FastTunnelClient.cs b/FastTunnel.Core/Client/FastTunnelClient.cs
index 52b991d..7fa0800 100644
--- a/FastTunnel.Core/Client/FastTunnelClient.cs
+++ b/FastTunnel.Core/Client/FastTunnelClient.cs
@@ -145,7 +145,6 @@ namespace FastTunnel.Core.Client
}
_client.Connect();
-
_logger.LogInformation("连接成功");
}
catch (Exception)
@@ -160,6 +159,7 @@ namespace FastTunnel.Core.Client
{
Webs = ClientConfig.Webs,
SSH = ClientConfig.SSH,
+ Token = ClientConfig.Attach
},
};
diff --git a/FastTunnel.Core/Config/DefaultClientConfig.cs b/FastTunnel.Core/Config/DefaultClientConfig.cs
index 79fcdd1..81e8058 100644
--- a/FastTunnel.Core/Config/DefaultClientConfig.cs
+++ b/FastTunnel.Core/Config/DefaultClientConfig.cs
@@ -13,5 +13,7 @@ namespace FastTunnel.Core.Config
public IEnumerable Webs { get; set; }
public IEnumerable SSH { get; set; }
+
+ public string Attach { get; set; }
}
}
\ No newline at end of file
diff --git a/FastTunnel.Core/Config/DefaultServerConfig.cs b/FastTunnel.Core/Config/DefaultServerConfig.cs
index 3ca470f..a7b1890 100644
--- a/FastTunnel.Core/Config/DefaultServerConfig.cs
+++ b/FastTunnel.Core/Config/DefaultServerConfig.cs
@@ -22,5 +22,7 @@ namespace FastTunnel.Core.Config
public bool WebHasNginxProxy { get; set; } = false;
public bool SSHEnabled { get; set; } = false;
+
+ public string Token { get; set; }
}
}
diff --git a/FastTunnel.Core/Config/IServerConfig.cs b/FastTunnel.Core/Config/IServerConfig.cs
index 68e624b..7444b74 100644
--- a/FastTunnel.Core/Config/IServerConfig.cs
+++ b/FastTunnel.Core/Config/IServerConfig.cs
@@ -31,5 +31,7 @@ namespace FastTunnel.Core.Config
#endregion
bool SSHEnabled { get; set; }
+
+ public string Token { get; set; }
}
}
diff --git a/FastTunnel.Core/Models/Massage/LogInMassage.cs b/FastTunnel.Core/Models/Massage/LogInMassage.cs
index e8c3bff..3f901a0 100644
--- a/FastTunnel.Core/Models/Massage/LogInMassage.cs
+++ b/FastTunnel.Core/Models/Massage/LogInMassage.cs
@@ -16,5 +16,10 @@ namespace FastTunnel.Core.Models
/// 端口转发隧道列表
///
public IEnumerable SSH { get; set; }
+
+ ///
+ /// 客户端附加信息
+ ///
+ public string Token { get; set; }
}
}
diff --git a/FastTunnel.Server/FastTunnel.Server.csproj b/FastTunnel.Server/FastTunnel.Server.csproj
index fbe13a6..3946b83 100644
--- a/FastTunnel.Server/FastTunnel.Server.csproj
+++ b/FastTunnel.Server/FastTunnel.Server.csproj
@@ -16,7 +16,6 @@
-
@@ -30,6 +29,4 @@
-
-
diff --git a/FastTunnel.Server/Filters/TestAuthenticationFilter.cs b/FastTunnel.Server/Filters/TestAuthenticationFilter.cs
index ddfef8c..84dc459 100644
--- a/FastTunnel.Server/Filters/TestAuthenticationFilter.cs
+++ b/FastTunnel.Server/Filters/TestAuthenticationFilter.cs
@@ -13,7 +13,10 @@ namespace FastTunnel.Server.Filters
{
public bool Authentication(FastTunnelServer server, LogInMassage requet)
{
- return true;
+ if (string.IsNullOrEmpty(server.ServerSettings.Token))
+ return true;
+
+ return server.ServerSettings.Token.Equals(requet.Token);
}
}
}
diff --git a/FastTunnel.Server/Views/Home/Index.cshtml b/FastTunnel.Server/Views/Home/Index.cshtml
deleted file mode 100644
index 87e83e1..0000000
--- a/FastTunnel.Server/Views/Home/Index.cshtml
+++ /dev/null
@@ -1,6 +0,0 @@
-@*
- For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
-*@
-@{
-}
-Soming soon!
\ No newline at end of file
diff --git a/FastTunnel.Server/config/appsettings.json b/FastTunnel.Server/config/appsettings.json
index bdfe510..55ca8d0 100644
--- a/FastTunnel.Server/config/appsettings.json
+++ b/FastTunnel.Server/config/appsettings.json
@@ -27,6 +27,8 @@
"WebAllowAccessIps": [],
// ѡǷSSHúSSHͶ˿ת.Ĭfalse
- "SSHEnabled": true
+ "SSHEnabled": true,
+
+ "Token": "TOKEN_FOR_CLIENT_AUTHENTICATION"
}
}
diff --git a/FastTunnel.sln b/FastTunnel.sln
index 17e40a8..11aee2e 100644
--- a/FastTunnel.sln
+++ b/FastTunnel.sln
@@ -11,8 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastTunnel.Server", "FastTu
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{0E2A9DA2-26AE-4657-B4C5-3A913E2F5A3C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastTunel.Core.WebApi", "FastTunel.Core.WebApi\FastTunel.Core.WebApi.csproj", "{79B1CA3F-D9E9-45F2-8A50-72084B41A0E6}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -31,17 +29,12 @@ Global
{DEF2E322-9075-4C3F-9967-7EAF0EE28CEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEF2E322-9075-4C3F-9967-7EAF0EE28CEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEF2E322-9075-4C3F-9967-7EAF0EE28CEB}.Release|Any CPU.Build.0 = Release|Any CPU
- {79B1CA3F-D9E9-45F2-8A50-72084B41A0E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {79B1CA3F-D9E9-45F2-8A50-72084B41A0E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {79B1CA3F-D9E9-45F2-8A50-72084B41A0E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {79B1CA3F-D9E9-45F2-8A50-72084B41A0E6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C8ADFEB1-59DB-4CE3-8D04-5B547107BCCB} = {0E2A9DA2-26AE-4657-B4C5-3A913E2F5A3C}
- {79B1CA3F-D9E9-45F2-8A50-72084B41A0E6} = {0E2A9DA2-26AE-4657-B4C5-3A913E2F5A3C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3D9C6B44-6706-4EE8-9043-802BBE474A2E}