这是基于vue-vben-admin 模板适用于abp vNext的前端管理项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
1.1 KiB

using Microsoft.AspNetCore.Http;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace LINGYUN.Abp.MicroService.AllInOne;
/// <summary>
/// Forwards the current browser cookie when Elsa Studio calls the in-process Elsa API.
/// The Studio backend is protected by the same ABP authentication cookie as the host.
/// </summary>
public sealed class StudioBackendCookieHandler : DelegatingHandler
{
private readonly IHttpContextAccessor _httpContextAccessor;
public StudioBackendCookieHandler(IHttpContextAccessor httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor;
}
protected override Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request,
CancellationToken cancellationToken)
{
var cookie = _httpContextAccessor.HttpContext?.Request.Headers.Cookie.ToString();
if (!string.IsNullOrWhiteSpace(cookie))
{
request.Headers.TryAddWithoutValidation("Cookie", cookie);
}
return base.SendAsync(request, cancellationToken);
}
}