using Microsoft.AspNetCore.Http; using System.Threading.Tasks; namespace Mirea.Api.Endpoint.Configuration.Core.Middleware; public class CookieAuthorizationMiddleware(RequestDelegate next) { public const string JwtAuthorizationName = "_ajwt"; public async Task InvokeAsync(HttpContext context) { if (context.Request.Cookies.ContainsKey(JwtAuthorizationName)) context.Request.Headers.Authorization = "Bearer " + context.Request.Cookies[JwtAuthorizationName]; await next(context); } }