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