99using Microsoft . Extensions . DependencyInjection ;
1010using Microsoft . Extensions . DependencyInjection . Extensions ;
1111using Microsoft . Extensions . Hosting ;
12- using Microsoft . Extensions . Logging ;
12+ using Newtonsoft . Json ;
1313
1414namespace Jp . Management
1515{
1616 public class Startup
1717 {
1818 public IConfiguration Configuration { get ; }
1919
20- public Startup ( ILogger < Startup > logger , IConfiguration configuration )
20+ public Startup ( IConfiguration configuration )
2121 {
2222 Configuration = configuration ;
2323 }
2424 // This method gets called by the runtime. Use this method to add services to the container.
2525 // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
26- public void ConfigureServices ( IServiceCollection services , ILoggerFactory logger )
26+ public void ConfigureServices ( IServiceCollection services )
2727 {
28- services . AddMvcCore ( ) . AddApiExplorer ( ) ;
28+ services
29+ . AddMvcCore ( )
30+ . AddNewtonsoftJson ( options =>
31+ {
32+ options . SerializerSettings . NullValueHandling = NullValueHandling . Ignore ;
33+ } ) . AddApiExplorer ( ) ;
2934
3035 // Identity Database
3136 services . AddAuthentication ( Configuration ) ;
@@ -36,7 +41,7 @@ public void ConfigureServices(IServiceCollection services, ILoggerFactory logger
3641 services . AddPolicies ( ) ;
3742
3843 // configure auth Server
39- services . AddIdentityServerAuthentication ( logger . CreateLogger < Startup > ( ) , Configuration ) ;
44+ services . AddIdentityServerAuthentication ( Configuration ) ;
4045
4146 // configure openapi
4247 services . AddSwagger ( Configuration ) ;
@@ -64,6 +69,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
6469 app . UseHttpsRedirection ( ) ;
6570 }
6671
72+ app . UseAuthorization ( ) ;
6773 app . UseAuthentication ( ) ;
6874 app . UseSwagger ( ) ;
6975 app . UseSwaggerUI ( c =>
@@ -72,7 +78,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
7278 c . OAuthClientId ( "Swagger" ) ;
7379 c . OAuthAppName ( "User Management UI - full access" ) ;
7480 } ) ;
75-
81+ app . UseRouting ( ) ;
7682 app . UseEndpoints ( endpoints =>
7783 {
7884 endpoints . MapControllers ( ) ;
0 commit comments