using Furion;
using Furion.DataEncryption;
using Furion.HttpRemote;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FlexJobApi.Core
{
///
/// 电子签客户端资源提供者
///
public class ElectronSignServerCustomerResourceHttpProvider : IResourceHttpProvider
{
public async Task SendAsStringAsync(HttpRequestBuilder builder)
{
var httpRemoteService = App.GetRequiredService();
var appId = App.GetConfig("ElectronSignServer:AppId");
var privateKey = App.GetConfig("ElectronSignServer:PrivateKey");
var sign = MD5Encryption.Encrypt($"{appId}-{privateKey}".ToUpper(), true);
builder = builder
.WithHeader("appId", appId)
.WithHeader("sign", sign);
var response = await httpRemoteService.SendAsStringAsync(builder);
return response;
}
}
}