Beispiel #1
0
 public WhiteListController(ILogger <WhiteListController> logger, IConfiguration config, IWebHostEnvironment env, IWhiteListService list)
 {
     _logger = logger;
     _env    = env;
     _list   = list;
     _token  = config["token"];
 }
Beispiel #2
0
 public async Task Invoke(HttpContext context, IWhiteListService whiteListService)
 {
     if (!whiteListService.Check(context.Request.Path, context.Connection.RemoteIpAddress))
     {
         _onKill(context);
         return;
     }
     await next(context);
 }
Beispiel #3
0
        // 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();
            });
        }