fix: change cookie name
This commit is contained in:
parent
a0ff624481
commit
eb272baa38
@ -1,15 +1,15 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Mirea.Api.Security.Common;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Mirea.Api.Endpoint.Configuration.Core.Middleware;
|
namespace Mirea.Api.Endpoint.Configuration.Core.Middleware;
|
||||||
|
|
||||||
public class CookieAuthorizationMiddleware(RequestDelegate next)
|
public class CookieAuthorizationMiddleware(RequestDelegate next)
|
||||||
{
|
{
|
||||||
public const string JwtAuthorizationName = "_ajwt";
|
|
||||||
public async Task InvokeAsync(HttpContext context)
|
public async Task InvokeAsync(HttpContext context)
|
||||||
{
|
{
|
||||||
if (context.Request.Cookies.ContainsKey(JwtAuthorizationName))
|
if (context.Request.Cookies.ContainsKey(CookieNames.AccessToken))
|
||||||
context.Request.Headers.Authorization = "Bearer " + context.Request.Cookies[JwtAuthorizationName];
|
context.Request.Headers.Authorization = "Bearer " + context.Request.Cookies[CookieNames.AccessToken];
|
||||||
|
|
||||||
await next(context);
|
await next(context);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user