No more JWTs for Scripts + Polish (#4274)

Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
Joe Milazzo
2025-12-13 06:55:02 -07:00
committed by GitHub
parent b67680c639
commit 8043650aa5
131 changed files with 7804 additions and 1849 deletions
+6 -5
View File
@@ -1,4 +1,6 @@
using API.Services.Store;
using API.Middleware;
using API.Services.Store;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
@@ -7,18 +9,16 @@ namespace API.Controllers;
#nullable enable
[Authorize]
[ApiController]
[Route("api/[controller]")]
[Authorize]
public class BaseApiController : ControllerBase
{
private IUserContext? _userContext;
/// <summary>
/// Gets the current user context. Available in all derived controllers.
/// </summary>
protected IUserContext UserContext =>
_userContext ??= HttpContext.RequestServices.GetRequiredService<IUserContext>();
field ??= HttpContext.RequestServices.GetRequiredService<IUserContext>();
/// <summary>
/// Gets the current authenticated user's ID.
@@ -31,4 +31,5 @@ public class BaseApiController : ControllerBase
/// </summary>
/// <remarks>Warning! Username's can contain .. and /, do not use folders or filenames explicitly with the Username</remarks>
protected string? Username => UserContext.GetUsername();
}