Fixed a deployment bug where we weren't listening on port properly. New way will force firewall exception dialog on Windows and work across board. Implemented user preferences and ability to update them.

This commit is contained in:
Joseph Milazzo 2021-02-06 13:08:48 -06:00
parent 3548a3811c
commit bd5a1338c4
24 changed files with 987 additions and 5 deletions

View file

@ -3,6 +3,7 @@ using API.Middleware;
using Hangfire;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@ -26,6 +27,11 @@ namespace API
services.AddApplicationServices(_config);
services.AddControllers();
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders =
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
});
services.AddCors();
services.AddIdentityServices(_config);
services.AddSwaggerGen(c =>
@ -45,11 +51,16 @@ namespace API
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "API v1"));
app.UseHangfireDashboard();
}
app.UseForwardedHeaders();
app.UseRouting();
// Ordering is important. Cors, authentication, authorization
app.UseCors(policy => policy.AllowAnyHeader().AllowAnyMethod().WithOrigins("http://localhost:4200"));
if (env.IsDevelopment())
{
app.UseCors(policy => policy.AllowAnyHeader().AllowAnyMethod().WithOrigins("http://localhost:4200"));
}
app.UseAuthentication();
@ -61,6 +72,7 @@ namespace API
{
ContentTypeProvider = new FileExtensionContentTypeProvider() // this is not set by default
});
app.UseEndpoints(endpoints =>
{