Upgrade to 4.0Changelog
Reference

Rate-limit policies

The rate-limit policies AuthEndpoints registers, their limits, and the routes that use them.

Most policies partition by client IP address. AuthEndpoints.ConfirmIdentity.EmailCode partitions by the signed-in user id and falls back to the client IP when that id is absent. A rejected request returns 429. Policies take effect only when the pipeline calls UseRateLimiter(). UseAuthEndpoints calls it. Call UseRateLimiter() after UseAuthentication() so the email-code step-up policy can read the user id.

Policies

Policy constantLimiterLimit
AuthEndpoints.LoginToken bucket10 tokens. 2 tokens are added every 10 seconds.
AuthEndpoints.AccountAbuseFixed window10 requests per minute
AuthEndpoints.ConfirmIdentityFixed window20 requests per minute
AuthEndpoints.ConfirmIdentity.EmailCodeFixed window3 requests per minute, partitioned by user id (client IP when the user id is absent)
AuthEndpoints.Passkey.ObtainOptionsFixed window5 requests per minute
AuthEndpoints.Passkey.RegisterFixed window3 requests per minute
AuthEndpoints.EmailCode.SendFixed windowEmailCode.SendsPerIpPerMinute requests per minute. The default is 5.

No policy queues requests. The QueueLimit is 0.

Routes per policy

PolicyRoutes
AuthEndpoints.LoginCookie and Identity bearer POST /login, JWT POST /create and POST /refresh, passkey POST /passkeys/login, external GET /login/{provider} and GET /link/{scheme}, email-code POST /emailCode/verify
AuthEndpoints.EmailCode.SendPOST /emailCode/send
AuthEndpoints.AccountAbusePOST /register, POST /resendConfirmationEmail, POST /forgotPassword, POST /resetPassword, POST /manage/password
AuthEndpoints.ConfirmIdentityPOST /confirmIdentity, POST /confirmIdentity/passkeyOptions
AuthEndpoints.ConfirmIdentity.EmailCodePOST /confirmIdentity/emailCode/send
AuthEndpoints.Passkey.ObtainOptionsPOST /passkeys/creationOptions, POST /passkeys/requestOptions, POST /passkeys/register/options
AuthEndpoints.Passkey.RegisterPOST /passkeys/register, POST /passkeys/

Identity bearer POST /refresh has no rate limit.

POST /emailCode/send and POST /confirmIdentity/emailCode/send also enforce ResendCooldown (default 60 seconds) and MaxSendsPerEmail per SendWindow (default 5 sends per hour). Both limits are per address and per stored purpose, so a step-up send does not block a sign-in send. Those checks return the normal 200 send body and do not return 429. The 429 on POST /emailCode/send is only the per-IP window. The 429 on POST /confirmIdentity/emailCode/send is the per-user window.

Registration

DI callPolicies it registers
AddCookieAuthEndpointsLogin, AccountAbuse, ConfirmIdentity
AddBearerAuthEndpointsLogin, AccountAbuse, ConfirmIdentity
AddPasswordEndpointsLogin, AccountAbuse
AddAccountManagementEndpointsAccountAbuse, ConfirmIdentity
AddAccountAbuseRateLimitingAccountAbuse
AddConfirmIdentityRateLimitingConfirmIdentity
AddJwtEndpointsLogin, AccountAbuse, ConfirmIdentity
AddPasswordAuthLogin, AccountAbuse, ConfirmIdentity. Also Passkey.ObtainOptions and Passkey.Register when Passkeys.ServerDomain is set.
AddPasskeyEndpointsLogin, AccountAbuse, ConfirmIdentity, Passkey.ObtainOptions, Passkey.Register
AddExternalAuthEndpointsLogin
AddEmailCodeSendEndpointsEmailCode.Send, ConfirmIdentity.EmailCode
AddEmailCodeSignInEndpointsLogin
AddEmailCodeEndpointsLogin, EmailCode.Send, ConfirmIdentity.EmailCode
AddConfirmIdentityEmailCodeRateLimitingConfirmIdentity.EmailCode

Each policy is registered once, even when several calls add it.