public WhiteListController(ILogger <WhiteListController> logger, IConfiguration config, IWebHostEnvironment env, IWhiteListService list) { _logger = logger; _env = env; _list = list; _token = config["token"]; }
public async Task Invoke(HttpContext context, IWhiteListService whiteListService) { if (!whiteListService.Check(context.Request.Path, context.Connection.RemoteIpAddress)) { _onKill(context); return; } await next(context); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IWhiteListService wl) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }