diff --git a/StaffDBServer/Program.cs b/StaffDBServer/Program.cs index e8b94d0..11b2156 100644 --- a/StaffDBServer/Program.cs +++ b/StaffDBServer/Program.cs @@ -17,6 +17,7 @@ using HRD.WebApi.DAL.Middleware; using HRD.WebApi.Helpers; using StaffDBServer.SharedControllers; using HRD.LDAPService; +using Microsoft.AspNetCore.Server.IISIntegration; AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs) => { @@ -41,7 +42,26 @@ try builder.Host.UseNLog(); // Add services to the container - builder.Services.ConfigureWebApiExtensionsAtFirst(); // at first + // at first + //services.AddCors(); + builder.Services.AddCustomCors("AllowAllOrigins"); + + builder.Services.Configure(options => + { + options.AuthenticationDisplayName = "Windows"; + options.ForwardClientCertificate = true; + options.AutomaticAuthentication = true; + }); + builder.Services.AddAuthentication(IISDefaults.AuthenticationScheme); + + builder.Services.ConfigureJWT(StaffDBServer.Extends.JwtMiddlewareOptionsHelper.GetJwtMiddlewareOptions()); ; + + builder.Services.ConfigureDAL(WebApiMiddlewareOptionsHelper.GetWebApiMiddlewareOptions()); + + builder.Services.AddSingleton(); + + builder.Services.ConfigureSwagger(); + builder.Services.ConfigureRepositoryWrapper(); // add repos var cnnStr = WebApiConfig.ConnectionString(EN_ConnectionType.SQLServer); diff --git a/StaffDBServer/_Shared/SharedExtensions/ServiceExtensions.cs b/StaffDBServer/_Shared/SharedExtensions/ServiceExtensions.cs index a8f1e3b..384e39c 100644 --- a/StaffDBServer/_Shared/SharedExtensions/ServiceExtensions.cs +++ b/StaffDBServer/_Shared/SharedExtensions/ServiceExtensions.cs @@ -11,28 +11,6 @@ namespace StaffDBServer.SharedExtensions { public static class ServiceExtensions { - public static void ConfigureWebApiExtensionsAtFirst(this IServiceCollection services) - { - //services.AddCors(); - services.AddCustomCors("AllowAllOrigins"); - - services.Configure(options => - { - options.AuthenticationDisplayName = "Windows"; - options.ForwardClientCertificate = true; - options.AutomaticAuthentication = true; - }); - services.AddAuthentication(IISDefaults.AuthenticationScheme); - - services.ConfigureJWT(Extends.JwtMiddlewareOptionsHelper.GetJwtMiddlewareOptions()); ; - - services.ConfigureDAL(WebApiMiddlewareOptionsHelper.GetWebApiMiddlewareOptions()); - - services.AddSingleton(); - - services.ConfigureSwagger(); - } - public static void ConfigureWebApiExtensionsEnd(this IServiceCollection services) { services.AddMvc()