11using System ;
2- using System . Security . Claims ;
32using FrontEnd . Data ;
43using FrontEnd . HealthChecks ;
54using FrontEnd . Services ;
65using Microsoft . AspNetCore . Builder ;
76using Microsoft . AspNetCore . Hosting ;
87using Microsoft . AspNetCore . Mvc ;
9- using Microsoft . AspNetCore . Routing ;
108using Microsoft . Extensions . Configuration ;
119using Microsoft . Extensions . DependencyInjection ;
10+ using Microsoft . Extensions . Hosting ;
1211
1312namespace FrontEnd
1413{
@@ -39,15 +38,15 @@ public void ConfigureServices(IServiceCollection services)
3938 client . BaseAddress = new Uri ( Configuration [ "serviceUrl" ] ) ;
4039 } ) ;
4140
42- services . AddMvc ( options =>
41+ services . AddRazorPages ( options =>
4342 {
44- options . Filters . AddService < RequireLoginFilter > ( ) ;
43+ options . Conventions . AuthorizeFolder ( "/Admin" , "Admin" ) ;
4544 } )
46- . AddRazorPagesOptions ( options =>
45+ . AddMvcOptions ( options =>
4746 {
48- options . Conventions . AuthorizeFolder ( "/Admin" , "Admin" ) ;
47+ options . Filters . AddService < RequireLoginFilter > ( ) ;
4948 } )
50- . SetCompatibilityVersion ( CompatibilityVersion . Version_2_2 ) ;
49+ . SetCompatibilityVersion ( CompatibilityVersion . Version_3_0 ) ;
5150
5251 services . AddHealthChecks ( )
5352 . AddCheck < BackendHealthCheck > ( "backend" )
@@ -56,7 +55,7 @@ public void ConfigureServices(IServiceCollection services)
5655 services . AddSingleton < IAdminService , AdminService > ( ) ;
5756 }
5857
59- public void Configure ( IApplicationBuilder app , IHostingEnvironment env )
58+ public void Configure ( IApplicationBuilder app , IWebHostEnvironment env )
6059 {
6160 if ( env . IsDevelopment ( ) )
6261 {
@@ -69,21 +68,20 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
6968 app . UseHsts ( ) ;
7069 }
7170
72- app . UseStatusCodePagesWithReExecute ( "/Status/{0}" ) ;
71+ // app.UseStatusCodePagesWithReExecute("/Status/{0}");
7372
7473 app . UseHttpsRedirection ( ) ;
75-
7674 app . UseStaticFiles ( ) ;
7775
78- app . UseAuthentication ( ) ;
76+ app . UseRouting ( ) ;
7977
80- app . UseHealthChecks ( "/health" ) ;
78+ app . UseAuthentication ( ) ;
79+ app . UseAuthorization ( ) ;
8180
82- app . UseMvc ( routes =>
81+ app . UseEndpoints ( endpoints =>
8382 {
84- routes . MapRoute (
85- name : "default" ,
86- template : "{controller=Home}/{action=Index}/{id?}" ) ;
83+ endpoints . MapRazorPages ( ) ;
84+ endpoints . MapHealthChecks ( "/health" ) ;
8785 } ) ;
8886 }
8987 }
0 commit comments