This commit is contained in:
2018-07-05 17:07:29 +00:00
parent 877637f1e5
commit ba28bedd7d
2 changed files with 13 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@@ -16,6 +17,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Authentication;
namespace GZTW.Pecklist
{
public class Startup
@@ -44,6 +46,8 @@ namespace GZTW.Pecklist
services.AddMvc();
//get the key from the appsettings.json file
var secretKey = Configuration.GetSection("JWT").GetValue<string>("secret");
var signingKey = new SymmetricSecurityKey(System.Text.Encoding.ASCII.GetBytes(secretKey));
@@ -85,8 +89,14 @@ namespace GZTW.Pecklist
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
app.UseDefaultFiles();
app.UseStaticFiles(new StaticFileOptions
app.UseStaticFiles(new StaticFileOptions
{
OnPrepareResponse = context =>
{
@@ -97,6 +107,7 @@ namespace GZTW.Pecklist
}
}
});
app.UseAuthentication();
app.UseMvc();