Skip to content

RateLimitingDotNET8: target net10.0, fix rejection status and auth partitioner - #2111

Closed
vladimir-pecanac-main wants to merge 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/116349-rate-limiting
Closed

RateLimitingDotNET8: target net10.0, fix rejection status and auth partitioner#2111
vladimir-pecanac-main wants to merge 1 commit into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/116349-rate-limiting

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Modernizes the aspnetcore-webapi/RateLimitingDotNET8 sample and fixes two defects.

  • Retarget the app and test projects to net10.0 and refresh NuGet package versions.
  • Set RejectionStatusCode to 429 on the fixed window registration so the documented fixed/sliding/token/concurrency limiters return 429 on their own, instead of relying on the authorization limiter's global setting (they otherwise fall back to the framework default 503).
  • Replace the blocking GetTokenAsync("access_token").Result call in the authorization partitioner with a synchronous read of httpContext.User.Identity?.Name, avoiding sync-over-async on a per-request delegate and keying partitions on a stable user identity.

Build and all 14 tests pass on net10.0.

…rtitioner

- Retarget app and test projects to net10.0; refresh NuGet package versions.
- Set RejectionStatusCode to 429 on the fixed window registration so the
  documented limiters return 429 on their own instead of the framework
  default 503.
- Replace the blocking GetTokenAsync().Result call in the authorization
  partitioner with a synchronous read of the authenticated user identity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant