17 lines
608 B
C#
17 lines
608 B
C#
using Microsoft.AspNetCore.Http;
|
|
using Mirea.Api.Security.Common.Interfaces;
|
|
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, IRevokedToken revokedTokenStore)
|
|
{
|
|
if (context.Request.Cookies.ContainsKey(JwtAuthorizationName))
|
|
context.Request.Headers.Authorization = "Bearer " + context.Request.Cookies[JwtAuthorizationName];
|
|
|
|
await next(context);
|
|
}
|
|
} |