From adb9b3a981df5f8c92a7322678eeab1becd9c07b Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 26 Dec 2024 15:19:59 +0800 Subject: [PATCH] =?UTF-8?q?fix=20ssl=E9=AA=8C=E8=AF=81=E7=A7=BB=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Dlhis.Dh.Api/Clients/DhClientHandler.cs | 22 +++++++++++++++++++++ Src/Dlhis.Dh.Api/IDhApi.cs | 5 +++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 Src/Dlhis.Dh.Api/Clients/DhClientHandler.cs diff --git a/Src/Dlhis.Dh.Api/Clients/DhClientHandler.cs b/Src/Dlhis.Dh.Api/Clients/DhClientHandler.cs new file mode 100644 index 00000000..49c5da3a --- /dev/null +++ b/Src/Dlhis.Dh.Api/Clients/DhClientHandler.cs @@ -0,0 +1,22 @@ +using Kurisu.RemoteCall.Abstractions; +using Microsoft.Extensions.DependencyInjection; + +namespace Dlhis.Dh.Api.Clients; + +public class DhClientHandler : IHttpRemoteCallPolicyHandler +{ + /// + public IHttpClientBuilder ConfigureHttpClient(IHttpClientBuilder builder) + { + return builder.ConfigurePrimaryHttpMessageHandler(() => + { + var handler = new HttpClientHandler + { + ClientCertificateOptions = ClientCertificateOption.Manual, + ServerCertificateCustomValidationCallback = (_, _, _, _) => true + }; + + return handler; + }); + } +} \ No newline at end of file diff --git a/Src/Dlhis.Dh.Api/IDhApi.cs b/Src/Dlhis.Dh.Api/IDhApi.cs index b6f97acd..a0d53a0a 100644 --- a/Src/Dlhis.Dh.Api/IDhApi.cs +++ b/Src/Dlhis.Dh.Api/IDhApi.cs @@ -1,10 +1,11 @@ -using Dlhis.Dh.Api.Requests; +using Dlhis.Dh.Api.Clients; +using Dlhis.Dh.Api.Requests; using Dlhis.Dh.Api.ResultHandlers; using Kurisu.RemoteCall.Attributes; namespace Dlhis.Dh.Api; -[EnableRemoteClient(Name = "dh-service", BaseUrl = "https://10.32.0.100")] +[EnableRemoteClient(Name = "dh-service", BaseUrl = "https://10.32.0.100", PolicyHandler = typeof(DhClientHandler))] public interface IDhApi { [Post("/evo-apigw/evo-visitor/1.0.0/card/visitor/custom-face")]