public IdThrottleMiddleware(RequestDelegate next, ThrottleOptions options, ICounterStore counterStore, ILogger <IdThrottleMiddleware> logger) : base(next, options, counterStore, logger) { var matcher = new ClientIdRuleMatcher(Options.ClientWhitelist, Options.ClientPolicies, Options.IdIgnoreCase); Processor = new ThrottleProcessor(Options, counterStore, matcher); }
public static ThrottleProcessor GetProcessorWithWhitelist(string whitelistedClientId, string whitelistedEndpoint) { var store = new FakeCounterStore(); var options = new BasicOptions { ClientWhitelist = new List <string> { whitelistedClientId }, EndpointWhitelist = new List <string> { whitelistedEndpoint } }; var matcher = new ClientIdRuleMatcher(options.ClientWhitelist, options.ClientPolicies, options.IdIgnoreCase); var processor = new ThrottleProcessor(options, store, matcher); return(processor); }