Skip to content

Commit 3397fa9

Browse files
committed
Update token validation error message and add rate limiting to export endpoint
1 parent 856f244 commit 3397fa9

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

OpenBioCardServer/Controllers/Classic/ClassicAdminController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public async Task<IActionResult> CheckPermission([FromBody] ClassicAdminRequest
5151

5252
if (account.UserName != request.Username)
5353
{
54-
return Unauthorized(new ClassicErrorResponse("Token does not match username"));
54+
return Unauthorized(new ClassicErrorResponse("Invalid token"));
5555
}
5656

5757
if (!await _authService.HasAdminPermissionAsync(account))

OpenBioCardServer/Controllers/Classic/ClassicUserController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.RateLimiting;
3+
using OpenBioCardServer.Constants;
24
using OpenBioCardServer.Models.DTOs.Classic;
35
using OpenBioCardServer.Models.DTOs.Classic.General;
46
using OpenBioCardServer.Models.DTOs.Classic.Profile;
@@ -94,6 +96,7 @@ public async Task<IActionResult> UpdateProfile(string username, [FromBody] Class
9496
/// Export user data (requires authentication)
9597
/// </summary>
9698
[HttpGet("{username}/export")]
99+
[EnableRateLimiting(RateLimitPolicies.General)]
97100
public async Task<IActionResult> ExportData(string username)
98101
{
99102
var token = GetTokenFromHeader();

0 commit comments

Comments
 (0)