[WIP] Adds Hsts and HttpsRedirection to templates (#128)

This commit is contained in:
Justin Kotalik 2017-10-31 16:15:13 -07:00 committed by GitHub
parent 1a8ebaf77a
commit 509f791f10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View File

@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Http;
#endif
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
#if (OrganizationalAuth)
using Microsoft.AspNetCore.Mvc.Authorization;
#endif
@ -121,8 +122,10 @@ namespace Company.WebApplication1
else
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
#if (OrganizationalAuth || IndividualAuth)

View File

@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
#endif
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
#if (OrganizationalAuth && OrgReadAccess)
@ -95,8 +96,10 @@ namespace Company.WebApplication1
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
#if (OrganizationalAuth || IndividualAuth)

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
#if (OrganizationalAuth || IndividualB2CAuth)
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.JwtBearer;
@ -49,7 +50,12 @@ namespace Company.WebApplication1
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseHsts();
}
app.UseHttpsRedirection();
#if (OrganizationalAuth || IndividualAuth)
app.UseAuthentication();
#endif