Exemple #1
0
    public override void OnActionExecuting(ActionExecutingContext context)
    {
        HttpContext httpContext = context.HttpContext;
        IFail2Ban   fail2Ban    = httpContext.RequestServices.GetFail2Ban();

        if (fail2Ban.IsRateLimitApplied(httpContext))
        {
            context.ModelState.TryAddModelError(
                this.ModelStateProperty,
                "You have attempted this too many times. Please try again later."
                );
        }
    }
Exemple #2
0
 public Fail2BanRecordMiddleware(IFail2Ban fail2Ban)
 {
     this._fail2Ban = fail2Ban;
 }