From 0ac6c158124393bab5acea43673725ddc35b1cff Mon Sep 17 00:00:00 2001 From: ChristopherJamesMorris Date: Wed, 27 Apr 2022 15:48:12 +0100 Subject: [PATCH] #128 Added DataProtection to the app services startup --- .../Infrastructure/ServiceCollectionExtensions.cs | 6 ++++++ .../Properties/launchSettings.json | 2 +- source/gpconnect-appointment-checker/appsettings.json | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/source/gpconnect-appointment-checker/Configuration/Infrastructure/ServiceCollectionExtensions.cs b/source/gpconnect-appointment-checker/Configuration/Infrastructure/ServiceCollectionExtensions.cs index dc990cb6..83d8c59a 100644 --- a/source/gpconnect-appointment-checker/Configuration/Infrastructure/ServiceCollectionExtensions.cs +++ b/source/gpconnect-appointment-checker/Configuration/Infrastructure/ServiceCollectionExtensions.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using System; +using Microsoft.AspNetCore.DataProtection; namespace gpconnect_appointment_checker.Configuration.Infrastructure { @@ -77,6 +78,10 @@ public static IServiceCollection ConfigureApplicationServices(this IServiceColle services.AddSingleton(); services.AddSingleton(); + services.AddDataProtection() + .SetApplicationName("GpConnectAppointmentChecker") + .DisableAutomaticKeyGeneration(); + services.AddAntiforgery(options => { options.SuppressXFrameOptionsHeader = true; @@ -85,6 +90,7 @@ public static IServiceCollection ConfigureApplicationServices(this IServiceColle options.Cookie.SameSite = SameSiteMode.None; }); + services.Configure(configuration.GetSection("SingleSignOn")); services.Configure(configuration.GetSection("General")); services.Configure(configuration.GetSection("Spine")); diff --git a/source/gpconnect-appointment-checker/Properties/launchSettings.json b/source/gpconnect-appointment-checker/Properties/launchSettings.json index 591a5730..7f5ac630 100644 --- a/source/gpconnect-appointment-checker/Properties/launchSettings.json +++ b/source/gpconnect-appointment-checker/Properties/launchSettings.json @@ -23,7 +23,7 @@ "ASPNETCORE_ENVIRONMENT": "Development", "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" }, - "applicationUrl": "https://localhost:5001;http://localhost:5000" + "applicationUrl": "https://localhost:5001" }, "Docker": { "commandName": "Docker", diff --git a/source/gpconnect-appointment-checker/appsettings.json b/source/gpconnect-appointment-checker/appsettings.json index 697c15ba..20bd49c6 100644 --- a/source/gpconnect-appointment-checker/appsettings.json +++ b/source/gpconnect-appointment-checker/appsettings.json @@ -4,7 +4,8 @@ "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information", - "System.Net.Http.HttpClient": "Warning" + "System.Net.Http.HttpClient": "Warning", + "Microsoft.AspNetCore.DataProtection": "Information" } }, "AllowedHosts": "*"