Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wrapper method #478

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/AspNetCoreRateLimit/Core/IRateLimitProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public interface IRateLimitProcessor
Task<IEnumerable<RateLimitRule>> GetMatchingRulesAsync(ClientRequestIdentity identity, CancellationToken cancellationToken = default);
RateLimitHeaders GetRateLimitHeaders(RateLimitCounter? counter, RateLimitRule rule, CancellationToken cancellationToken = default);
Task<RateLimitCounter> ProcessRequestAsync(ClientRequestIdentity requestIdentity, RateLimitRule rule, CancellationToken cancellationToken = default);
bool IsWhitelisted(ClientRequestIdentity requestIdentity);
bool IsOnAllowedList(ClientRequestIdentity requestIdentity);
}
}
2 changes: 1 addition & 1 deletion src/AspNetCoreRateLimit/Core/RateLimitProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected RateLimitProcessor(RateLimitOptions options)
}


public virtual bool IsWhitelisted(ClientRequestIdentity requestIdentity)
public virtual bool IsOnAllowedList(ClientRequestIdentity requestIdentity)
gustafhalldor marked this conversation as resolved.
Show resolved Hide resolved
{
if (_options.ClientWhitelist != null && _options.ClientWhitelist.Contains(requestIdentity.ClientId))
{
Expand Down
4 changes: 2 additions & 2 deletions src/AspNetCoreRateLimit/Middleware/RateLimitMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public async Task Invoke(HttpContext context)
// compute identity from request
var identity = await ResolveIdentityAsync(context);

// check white list
if (_processor.IsWhitelisted(identity))
// check allowed list
if (_processor.IsOnAllowedList(identity))
{
await _next.Invoke(context);
return;
Expand Down