Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
|
||||
namespace adas_core.module.Relays.Utils;
|
||||
|
||||
public static class HttpUtils
|
||||
{
|
||||
public static HttpRequestHeaders AddBasicAuth(string username, string password, HttpRequestHeaders headers)
|
||||
{
|
||||
var auth = Encoding.ASCII.GetBytes($"{username}:{password}");
|
||||
var clientAuthorizationHeader = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(auth));
|
||||
headers.Add("Authorization", clientAuthorizationHeader.ToString());
|
||||
return headers;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user