/// <summary> /// Constructor method /// </summary> /// <param name="logger">ILogger<FindByIdController></param> /// <param name="webHostEnvironment">IWebHostEnvironment</param> /// <param name="httpContextAccessor">IHttpContextAccessor</param> /// <param name="authorizationService">IAuthorizationService</param> /// <param name="appSettings">AppSettings</param> /// <param name="dbContext">AuthorizationServiceDbContext</param> /// <method> /// public FindByIdController( /// ILogger<FindByIdController> logger, /// IWebHostEnvironment webHostEnvironment, /// IHttpContextAccessor httpContextAccessor, /// IAuthorizationService authorizationService, /// AppSettings appSettings, /// AuthorizationServiceDbContext dbContext /// ) : base(logger, webHostEnvironment, httpContextAccessor, authorizationService, appSettings, dbContext) /// </method> public FindByIdController( ILogger <FindByIdController> logger, IWebHostEnvironment webHostEnvironment, IHttpContextAccessor httpContextAccessor, IAuthorizationService authorizationService, AppSettings appSettings, AuthorizationServiceDbContext dbContext ) : base(logger, webHostEnvironment, httpContextAccessor, authorizationService, appSettings, dbContext) { }
/// <summary> /// Constructor method /// </summary> /// <param name="logger">ILogger</param> /// <param name="webHostEnvironment">IWebHostEnvironment</param> /// <param name="httpContextAccessor">IHttpContextAccessor</param> /// <param name="authorizationService">IAuthorizationService</param> /// <param name="appSettings">AppSettings</param> /// <param name="dbContext">AuthorizationServiceDbContext</param> /// <method> /// ApplicationBaseController( /// ILogger<T> logger, /// IWebHostEnvironment webHostEnvironment, /// IHttpContextAccessor httpContextAccessor, /// IAuthorizationService, /// AppSettings appSettings, /// AuthorizationServiceDbContext dbContext /// ) /// </method> protected ApplicationBaseController( ILogger <T> logger, IWebHostEnvironment webHostEnvironment, IHttpContextAccessor httpContextAccessor, IAuthorizationService authorizationService, AppSettings appSettings, AuthorizationServiceDbContext dbContext ) : base(logger, webHostEnvironment, httpContextAccessor) { _appSettings = appSettings; _dbContext = dbContext; _authorizationService = authorizationService; }
/// <summary> /// This required method gets called by the runtime. Use this method to configure the HTTP request pipeline. /// </summary> /// <param name="app">IApplicationBuilder</param> /// <param name="env">IWebHostEnvironment</param> /// <param name="logger">ILogger<Startup></param> /// <param name="lifetime">IHostApplicationLifetime</param> /// <param name="dbContext">AuthorizationServiceDbContext</param> /// <method>Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger<Startup> logger, IHostApplicationLifetime lifetime, AuthorizationServiceDbContext dbContext)</method> public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger <Startup> logger, IHostApplicationLifetime lifetime, AuthorizationServiceDbContext dbContext) { _logger = new Logger(logger); _logger.Trace($"Configure(IApplicationBuilder: {app}, IWebHostEnvironment: {env}, ILogger<Startup> {logger}, IHostApplicationLifetime: {lifetime})"); AESGCM.Seed(_appSettings.SecretKey); DbInitializer.Initialize(dbContext, _appSettings.SiteAdministrator); lifetime.ApplicationStarted.Register(OnAppStarted); lifetime.ApplicationStopping.Register(OnAppStopping); lifetime.ApplicationStopped.Register(OnAppStopped); app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } if (env.EnvironmentName.Equals("Production")) { app.UseHsts(); app.UseHttpsRedirection(); } app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }