Update managing api security
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Managing.Api.Models.Requests;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using Managing.Api.Models.Requests;
|
||||
using Managing.Application.Abstractions;
|
||||
using Managing.Application.Abstractions.Services;
|
||||
using Managing.Application.Shared;
|
||||
@@ -289,6 +291,16 @@ public class TradingController : BaseController
|
||||
|
||||
var httpClient = _httpClientFactory.CreateClient();
|
||||
|
||||
// Add basic authentication if credentials are provided
|
||||
var username = _configuration["N8n:Username"];
|
||||
var password = _configuration["N8n:Password"];
|
||||
|
||||
if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
|
||||
{
|
||||
var credentials = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{username}:{password}"));
|
||||
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credentials);
|
||||
}
|
||||
|
||||
_logger.LogInformation(
|
||||
"Submitting indicator request: {IndicatorName} - {Strategy} by {Requester}",
|
||||
request.IndicatorName,
|
||||
|
||||
Reference in New Issue
Block a user