25 lines
715 B
C#
25 lines
715 B
C#
using System;
|
|
using System.Net.Http;
|
|
using System.Security.Authentication;
|
|
|
|
namespace LCU.Library.Internal.Security.HttpsClient;
|
|
|
|
public static class TrustingHttpClient
|
|
{
|
|
public static HttpClient GetClient(string endPoint)
|
|
{
|
|
var handler = new HttpClientHandler
|
|
{
|
|
SslProtocols = SslProtocols.Tls12 |
|
|
SslProtocols.Tls11 |
|
|
SslProtocols.Tls,
|
|
ServerCertificateCustomValidationCallback = (_, _, _, _) => true
|
|
};
|
|
var httpClient = new HttpClient(handler)
|
|
{
|
|
Timeout = TimeSpan.FromSeconds(60),
|
|
BaseAddress = new Uri(endPoint)
|
|
};
|
|
return httpClient;
|
|
}
|
|
} |