mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-08-15 04:50:19 +02:00
global: add some basic rate limiting
This commit is contained in:
@@ -31,6 +31,7 @@ using IdentityServer4.Stores;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.RateLimiting;
|
||||
using Streetwriters.Common;
|
||||
using Streetwriters.Common.Enums;
|
||||
using Streetwriters.Common.Interfaces;
|
||||
@@ -112,6 +113,7 @@ namespace Streetwriters.Identity.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("verify")]
|
||||
[EnableRateLimiting("strict")]
|
||||
public async Task<IActionResult> SendVerificationEmail([FromForm] string newEmail)
|
||||
{
|
||||
var client = Clients.FindClientById(User.FindFirstValue("client_id"));
|
||||
@@ -145,6 +147,7 @@ namespace Streetwriters.Identity.Controllers
|
||||
|
||||
[HttpPost("recover")]
|
||||
[AllowAnonymous]
|
||||
[EnableRateLimiting("strict")]
|
||||
public async Task<IActionResult> ResetUserPassword([FromForm] ResetPasswordForm form)
|
||||
{
|
||||
var client = Clients.FindClientById(form.ClientId);
|
||||
|
||||
@@ -26,6 +26,7 @@ using AspNetCore.Identity.Mongo.Model;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.RateLimiting;
|
||||
using Streetwriters.Common;
|
||||
using Streetwriters.Common.Enums;
|
||||
using Streetwriters.Common.Models;
|
||||
@@ -90,6 +91,7 @@ namespace Streetwriters.Identity.Controllers
|
||||
[HttpPost("send")]
|
||||
[Authorize("mfa")]
|
||||
[Authorize(LocalApi.PolicyName)]
|
||||
[EnableRateLimiting("strict")]
|
||||
public async Task<IActionResult> RequestCode([FromForm] string type)
|
||||
{
|
||||
var client = Clients.FindClientById(User.FindFirstValue("client_id"));
|
||||
|
||||
@@ -25,6 +25,7 @@ using AspNetCore.Identity.Mongo.Model;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.RateLimiting;
|
||||
using Streetwriters.Common;
|
||||
using Streetwriters.Common.Enums;
|
||||
using Streetwriters.Common.Models;
|
||||
@@ -51,6 +52,7 @@ namespace Streetwriters.Identity.Controllers
|
||||
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[EnableRateLimiting("strict")]
|
||||
public async Task<IActionResult> Signup([FromForm] SignupForm form)
|
||||
{
|
||||
if (Constants.DISABLE_SIGNUPS)
|
||||
|
||||
Reference in New Issue
Block a user