예제 #1
0
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            //probably not the right way to do this - must be some way to have the container inject
            IRateLimiterService service = context.HttpContext.RequestServices.GetService <IRateLimiterService>();
            Request             request = RateLimiterHelper.CreateRequestFromContext(context);
            State rateLimitResponse     = service.checkRequest(request);

            RateLimiterHelper.HandleResponse(rateLimitResponse, context);
        }
 public PrivateController(IPrivateServerService privateServerService,
                          IRateLimiterService rateLimiterService,
                          ITorCheckService torCheckService,
                          ICustomMapService customMapService,
                          ILogger <PrivateController> logger)
 {
     _privateServerService = privateServerService;
     _rateLimiterService   = rateLimiterService;
     _torCheckService      = torCheckService;
     _customMapService     = customMapService;
     _logger = logger;
 }