From 58f058f3e9b6c1ab3191722e2e5fd9111a406d2a Mon Sep 17 00:00:00 2001 From: Torgil Folger Date: Sat, 28 Oct 2023 14:29:38 +0200 Subject: [PATCH] [csharp] RemoteCertificateValidationCallback was not called on async methods; resolves #14608 (#16886) * Update ApiClient.mustache added missing line in config mapping * update samples --------- Co-authored-by: William Cheng --- .../src/main/resources/csharp/ApiClient.mustache | 3 ++- .../csharp-restsharp/src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++- .../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++- .../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++- .../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++- .../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++- .../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++- .../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++- .../OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++- .../OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++- .../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++- 11 files changed, 22 insertions(+), 11 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache index 34c2619edce..ee908eb8994 100644 --- a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache @@ -564,7 +564,8 @@ namespace {{packageName}}.Client MaxTimeout = configuration.Timeout, Proxy = configuration.Proxy, UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback }; {{#hasOAuthMethods}} diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiClient.cs index a52908ef5df..c569deebc53 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiClient.cs @@ -548,7 +548,8 @@ namespace Org.OpenAPITools.Client MaxTimeout = configuration.Timeout, Proxy = configuration.Proxy, UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback }; using (RestClient client = new RestClient(clientOptions, diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs index b7433a27b7a..a5389ded4f2 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs @@ -546,7 +546,8 @@ namespace Org.OpenAPITools.Client MaxTimeout = configuration.Timeout, Proxy = configuration.Proxy, UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback }; using (RestClient client = new RestClient(clientOptions, diff --git a/samples/client/petstore/csharp-restsharp-name-parameter-mappings/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-restsharp-name-parameter-mappings/src/Org.OpenAPITools/Client/ApiClient.cs index d5e70ad3cdc..6c224944b4c 100644 --- a/samples/client/petstore/csharp-restsharp-name-parameter-mappings/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp-restsharp-name-parameter-mappings/src/Org.OpenAPITools/Client/ApiClient.cs @@ -547,7 +547,8 @@ namespace Org.OpenAPITools.Client MaxTimeout = configuration.Timeout, Proxy = configuration.Proxy, UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback }; using (RestClient client = new RestClient(clientOptions, diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs index cb5abc941b1..3c0762f5539 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs @@ -561,7 +561,8 @@ namespace Org.OpenAPITools.Client MaxTimeout = configuration.Timeout, Proxy = configuration.Proxy, UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback }; if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) && diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Client/ApiClient.cs index b9c53cd6b62..b10e49166a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Client/ApiClient.cs @@ -562,7 +562,8 @@ namespace Org.OpenAPITools.Client MaxTimeout = configuration.Timeout, Proxy = configuration.Proxy, UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback }; if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) && diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Client/ApiClient.cs index b9c53cd6b62..b10e49166a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Client/ApiClient.cs @@ -562,7 +562,8 @@ namespace Org.OpenAPITools.Client MaxTimeout = configuration.Timeout, Proxy = configuration.Proxy, UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback }; if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) && diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiClient.cs index b9c53cd6b62..b10e49166a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiClient.cs @@ -562,7 +562,8 @@ namespace Org.OpenAPITools.Client MaxTimeout = configuration.Timeout, Proxy = configuration.Proxy, UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback }; if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) && diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs index cb5abc941b1..3c0762f5539 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs @@ -561,7 +561,8 @@ namespace Org.OpenAPITools.Client MaxTimeout = configuration.Timeout, Proxy = configuration.Proxy, UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback }; if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) && diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs index b9c53cd6b62..b10e49166a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -562,7 +562,8 @@ namespace Org.OpenAPITools.Client MaxTimeout = configuration.Timeout, Proxy = configuration.Proxy, UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback }; if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) && diff --git a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/ApiClient.cs index 7577a84df0f..4482bbdbfbc 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/ApiClient.cs @@ -561,7 +561,8 @@ namespace Org.OpenAPITools.Client MaxTimeout = configuration.Timeout, Proxy = configuration.Proxy, UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback }; if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) &&