зеркало из https://github.com/Azure/hpcpack-acm.git
Use HTTPS for Frontend
This commit is contained in:
Родитель
6f3c2f315f
Коммит
beb2987e3e
|
@ -84,9 +84,6 @@ Secret Disclosure Risks
|
|||
From: AzSec@microsoft.com
|
||||
###
|
||||
|
||||
# *.pfx
|
||||
*.[Pp][Ff][Xx]
|
||||
|
||||
# *.key
|
||||
*.[Kk][Ee][Yy]
|
||||
|
||||
|
@ -277,7 +274,6 @@ ClientBin/
|
|||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
bower_components/
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Bazinga.AspNetCore.Authentication.Basic" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.2" />
|
||||
<PackageReference Include="WindowsAzure.Storage" Version="9.1.0" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
namespace Microsoft.HpcAcm.Frontend
|
||||
{
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using System.Net;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
public static class KestrelServerOptionsExtensions
|
||||
{
|
||||
public static void UseHttps(this KestrelServerOptions options)
|
||||
{
|
||||
var config = options.ApplicationServices.GetRequiredService<IConfiguration>();
|
||||
var server = config.GetSection("ServerOptions");
|
||||
options.Listen(IPAddress.Any, 443, listenOptions => listenOptions.UseHttps(server["CertPath"]));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -53,7 +53,7 @@
|
|||
services.AddSingleton<ServerObject>();
|
||||
services.AddSingleton<DataProvider>();
|
||||
})
|
||||
.UseUrls("http://*:5000")
|
||||
.UseKestrel(options => options.UseHttps())
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"ServerOptions": {
|
||||
"CertPath": "https.pfx"
|
||||
},
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
|
|
Двоичный файл не отображается.
|
@ -5,5 +5,7 @@
|
|||
public class ServerOptions
|
||||
{
|
||||
public string HostName { get; set; } = Environment.MachineName.ToLowerInvariant();
|
||||
|
||||
public string CertPath { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче