diff --git a/NHS-Login-Dotnet-Core-Sample.csproj b/NHS-Login-Dotnet-Core-Sample.csproj index 69eec41..505cff5 100644 --- a/NHS-Login-Dotnet-Core-Sample.csproj +++ b/NHS-Login-Dotnet-Core-Sample.csproj @@ -1,8 +1,7 @@ - + - netcoreapp2.2 - InProcess + net8.0 @@ -10,7 +9,10 @@ + + + diff --git a/Startup.cs b/Startup.cs index 97705af..ba5f5a6 100644 --- a/Startup.cs +++ b/Startup.cs @@ -1,9 +1,4 @@ -using System.Collections.Generic; -using System.IO; -using System.Security.Cryptography; -using System.Text; using System.Threading.Tasks; -using IdentityModel; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Microsoft.AspNetCore.Builder; @@ -12,11 +7,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.IdentityModel.Protocols.OpenIdConnect; -using Org.BouncyCastle.Crypto.Parameters; -using Org.BouncyCastle.OpenSsl; -using Org.BouncyCastle.Security; -using Base64Url = Jose.Base64Url; namespace NHS.Login.Dotnet.Core.Sample { @@ -39,6 +31,9 @@ public void ConfigureServices(IServiceCollection services) options.MinimumSameSitePolicy = SameSiteMode.None; }); + services.AddMvc(); + services.AddControllersWithViews().AddRazorRuntimeCompilation(); + services.AddAuthentication(options => { options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme; @@ -78,14 +73,12 @@ public void ConfigureServices(IServiceCollection services) } }; }); - - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { @@ -99,16 +92,20 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) } app.UseAuthentication(); + + app.UseRouting(); + + app.UseAuthorization(); + app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); - app.UseMvc(routes => + app.UseEndpoints(e => { - routes.MapRoute( - name: "default", - template: "{controller=Home}/{action=Index}/{id?}"); + e.MapDefaultControllerRoute(); + e.MapRazorPages(); }); } }