diff --git a/Dockerfile b/Dockerfile
index ef29a45..6f9bada 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -30,6 +30,7 @@ COPY ./src/${PROJECT_NAME}.Utils/${PROJECT_NAME}.Utils.csproj
COPY ./src/Tests/${PROJECT_NAME}.Api.Tests.Integration/${PROJECT_NAME}.Api.Tests.Integration.csproj ./src/Tests/${PROJECT_NAME}.Api.Tests.Integration/
COPY ./src/Tests/${PROJECT_NAME}.Application.Tests/${PROJECT_NAME}.Application.Tests.csproj ./src/Tests/${PROJECT_NAME}.Application.Tests/
COPY ./src/Tests/${PROJECT_NAME}.Domain.Tests/${PROJECT_NAME}.Domain.Tests.csproj ./src/Tests/${PROJECT_NAME}.Domain.Tests/
+COPY ./src/Tests/${PROJECT_NAME}.Frontend.Tests/${PROJECT_NAME}.Frontend.Tests.csproj ./src/Tests/${PROJECT_NAME}.Frontend.Tests/
COPY ./src/Tests/${PROJECT_NAME}.Tests.Common/${PROJECT_NAME}.Tests.Common.csproj ./src/Tests/${PROJECT_NAME}.Tests.Common/
# Mount GitHub Token as a Docker secret so that NuGet Feed can be accessed
diff --git a/src/Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure/Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure.csproj b/src/Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure/Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure.csproj
index c4bc26c..0e8b8a7 100644
--- a/src/Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure/Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure.csproj
+++ b/src/Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure/Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure.csproj
@@ -13,6 +13,7 @@
+
diff --git a/src/Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure/InfrastructureServiceCollectionExtensions.cs b/src/Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure/InfrastructureServiceCollectionExtensions.cs
index 3ce0328..7f70d00 100644
--- a/src/Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure/InfrastructureServiceCollectionExtensions.cs
+++ b/src/Dfe.RegionalImprovementForStandardsAndExcellence.Infrastructure/InfrastructureServiceCollectionExtensions.cs
@@ -31,7 +31,15 @@ public static IServiceCollection AddInfrastructureDependencyGroup(
// Utils
services.AddScoped();
+ // Health check
+ AddInfrastructureHealthCheck(services);
+
return services;
}
+
+ public static void AddInfrastructureHealthCheck(this IServiceCollection services) {
+ services.AddHealthChecks()
+ .AddDbContextCheck("RISE Database");
+ }
}
}
diff --git a/src/Dfe.RegionalImprovementForStandardsAndExcellence/Program.cs b/src/Dfe.RegionalImprovementForStandardsAndExcellence/Program.cs
index ac3a30e..2d9db5d 100644
--- a/src/Dfe.RegionalImprovementForStandardsAndExcellence/Program.cs
+++ b/src/Dfe.RegionalImprovementForStandardsAndExcellence/Program.cs
@@ -1,6 +1,4 @@
-
using Microsoft.AspNetCore.CookiePolicy;
-
using Dfe.Academisation.CorrelationIdMiddleware;
using Dfe.RegionalImprovementForStandardsAndExcellence.Frontend.Models;
using Dfe.RegionalImprovementForStandardsAndExcellence.Frontend.Services;
@@ -8,11 +6,10 @@
using Dfe.RegionalImprovementForStandardsAndExcellence.Frontend.Services.Http;
using Microsoft.Identity.Web;
using Microsoft.AspNetCore.Authorization;
-using Microsoft.Extensions.Configuration;
using System.Security.Claims;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Authentication.Cookies;
-using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.HttpOverrides;
var builder = WebApplication.CreateBuilder(args);
@@ -74,11 +71,20 @@
options.Scope.Add("User.Read");
});
+// Enforce HTTPS in ASP.NET Core
+// @link https://learn.microsoft.com/en-us/aspnet/core/security/enforcing-ssl?
+builder.Services.AddHsts(options =>
+{
+ options.Preload = true;
+ options.IncludeSubDomains = true;
+ options.MaxAge = TimeSpan.FromDays(365);
+});
+
builder.Services.Configure(CookieAuthenticationDefaults.AuthenticationScheme,
options =>
{
options.AccessDeniedPath = "/access-denied";
- options.Cookie.Name = ".Rise.Login";
+ options.Cookie.Name = ".RISE.Login";
options.Cookie.HttpOnly = true;
options.Cookie.IsEssential = true;
options.ExpireTimeSpan = _authenticationExpiration;
@@ -118,12 +124,23 @@
var app = builder.Build();
+var forwardOptions = new ForwardedHeadersOptions
+{
+ ForwardedHeaders = ForwardedHeaders.All,
+ RequireHeaderSymmetry = false
+};
+forwardOptions.KnownNetworks.Clear();
+forwardOptions.KnownProxies.Clear();
+app.UseForwardedHeaders(forwardOptions);
+
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
+} else {
+ app.UseDeveloperExceptionPage();
}
app.UseHttpsRedirection();
@@ -146,6 +163,8 @@
endpoints.MapControllerRoute("default", "{controller}/{action}/");
});
+app.UseHealthChecks("/health");
+
app.Run();
-public partial class Program { } // Make the Program class partial for testing
\ No newline at end of file
+public partial class Program { } // Make the Program class partial for testing