// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var server = LinkedServerConfiguration.Load(Configuration); var idClient = IdentityClientConfiguration.Load(Configuration); ConfigureIdentityServices(server, idClient, services); ConfigureClientServices(server, services); services.AddScoped <IIdentityDataGetter, IdentityDataGetter>(); ConfigureFinalServices(Configuration, services); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); Utils.Linked = LinkedServerConfiguration.Load(Configuration); Utils.IdentityClient = IdentityClientConfiguration.Load(Configuration); services.AddHttpClient(); services.AddMvc().AddNewtonsoftJson(); services.AddResponseCompression(opts => { opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat( new[] { "application/octet-stream" }); }); }
public static void ConfigureApp(IConfiguration configuration, IApplicationBuilder app, IHostingEnvironment env) { app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); if (env?.IsDevelopment() == true) { app.UseDeveloperExceptionPage(); } else { // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseAuthentication(); app.UseOpenApi(); var idClient = IdentityClientConfiguration.Load(configuration); app.UseSwaggerUi3(config => { config.OAuth2Client = new NSwag.AspNetCore.OAuth2ClientSettings { ClientId = idClient?.ClientId ?? "", ClientSecret = idClient?.ClientSecret ?? "", }; }); app.UseReDoc(); app.UseCors(); app.UseMvc(); }