From 6b62f2b05afb333bd66ceb3a2a6512bd84be5b47 Mon Sep 17 00:00:00 2001
From: Daniel Lange <60003126+dlange-hima@users.noreply.github.com>
Date: Thu, 6 Jul 2023 05:48:10 +0200
Subject: [PATCH] [csharp-netcore] Enable setting of
RemoteCertificateValidationCallback through IReadableConfiguration (#15979)
* Fix for [BUG][C#][csharp] Use RestClient.RemoteCertificateValidationCallback for SSL validation #11497
* Fixed modification of wrong files through merging to master and applied the changes to the correct files
* Updated examples
* Forget some examples
* Updates branch to reflect master changes and published changed example files yet again to solve conflicts
* Fixed examples
---
.../src/main/resources/csharp/ApiClient.mustache | 3 ++-
.../src/main/resources/csharp/Configuration.mustache | 9 ++++++++-
.../resources/csharp/IReadableConfiguration.mustache | 7 +++++++
.../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++-
.../src/Org.OpenAPITools/Client/Configuration.cs | 9 ++++++++-
.../Org.OpenAPITools/Client/IReadableConfiguration.cs | 7 +++++++
.../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++-
.../src/Org.OpenAPITools/Client/Configuration.cs | 9 ++++++++-
.../Org.OpenAPITools/Client/IReadableConfiguration.cs | 7 +++++++
.../src/Org.OpenAPITools/Client/Configuration.cs | 9 ++++++++-
.../Org.OpenAPITools/Client/IReadableConfiguration.cs | 7 +++++++
.../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++-
.../src/Org.OpenAPITools/Client/Configuration.cs | 9 ++++++++-
.../Org.OpenAPITools/Client/IReadableConfiguration.cs | 7 +++++++
.../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++-
.../src/Org.OpenAPITools/Client/Configuration.cs | 9 ++++++++-
.../Org.OpenAPITools/Client/IReadableConfiguration.cs | 7 +++++++
.../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++-
.../src/Org.OpenAPITools/Client/Configuration.cs | 9 ++++++++-
.../Org.OpenAPITools/Client/IReadableConfiguration.cs | 7 +++++++
.../src/Org.OpenAPITools/Client/Configuration.cs | 9 ++++++++-
.../Org.OpenAPITools/Client/IReadableConfiguration.cs | 7 +++++++
.../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++-
.../src/Org.OpenAPITools/Client/Configuration.cs | 9 ++++++++-
.../Org.OpenAPITools/Client/IReadableConfiguration.cs | 7 +++++++
.../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++-
.../src/Org.OpenAPITools/Client/Configuration.cs | 9 ++++++++-
.../Org.OpenAPITools/Client/IReadableConfiguration.cs | 7 +++++++
.../src/Org.OpenAPITools/Client/ApiClient.cs | 3 ++-
.../src/Org.OpenAPITools/Client/Configuration.cs | 9 ++++++++-
.../Org.OpenAPITools/Client/IReadableConfiguration.cs | 7 +++++++
31 files changed, 183 insertions(+), 20 deletions(-)
diff --git a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache
index a7e61ede4d5..87e572f9bd7 100644
--- a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache
@@ -455,7 +455,8 @@ namespace {{packageName}}.Client
MaxTimeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
- UseDefaultCredentials = configuration.UseDefaultCredentials
+ UseDefaultCredentials = configuration.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
RestClient client = new RestClient(clientOptions)
diff --git a/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache b/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache
index df392bfafa2..a765ebf138d 100644
--- a/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache
+++ b/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache
@@ -12,6 +12,7 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
+using System.Net.Security;
{{#useRestSharp}}
{{#hasOAuthMethods}}using {{packageName}}.Client.Auth;
{{/hasOAuthMethods}}
@@ -627,6 +628,11 @@ namespace {{packageName}}.Client
set { _HttpSigningConfiguration = value; }
}
{{/hasHttpSignatureMethods}}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -714,7 +720,8 @@ namespace {{packageName}}.Client
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
- UseDefaultCredentials = second.UseDefaultCredentials
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
diff --git a/modules/openapi-generator/src/main/resources/csharp/IReadableConfiguration.mustache b/modules/openapi-generator/src/main/resources/csharp/IReadableConfiguration.mustache
index 7402c7bb07c..78c998b3458 100644
--- a/modules/openapi-generator/src/main/resources/csharp/IReadableConfiguration.mustache
+++ b/modules/openapi-generator/src/main/resources/csharp/IReadableConfiguration.mustache
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
{{#useRestSharp}}
{{#hasOAuthMethods}}using {{packageName}}.Client.Auth;
@@ -161,5 +162,11 @@ namespace {{packageName}}.Client
///
HttpSigningConfiguration HttpSigningConfiguration { get; }
{{/hasHttpSignatureMethods}}
+
+ ///
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
+ /// overriding certificate errors in the scope of a request.
+ ///
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}
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 891f0c97b13..41fb8ad2630 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
@@ -454,7 +454,8 @@ namespace Org.OpenAPITools.Client
MaxTimeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
- UseDefaultCredentials = configuration.UseDefaultCredentials
+ UseDefaultCredentials = configuration.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
RestClient client = new RestClient(clientOptions)
diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs
index ec5b2271426..2aed4af8cc5 100644
--- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs
+++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/Configuration.cs
@@ -18,6 +18,7 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
+using System.Net.Security;
namespace Org.OpenAPITools.Client
{
@@ -515,6 +516,11 @@ namespace Org.OpenAPITools.Client
return url;
}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -591,7 +597,8 @@ namespace Org.OpenAPITools.Client
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
- UseDefaultCredentials = second.UseDefaultCredentials
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
index a21807ea0ba..c04a6f3a013 100644
--- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
+++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace Org.OpenAPITools.Client
@@ -130,5 +131,11 @@ namespace Org.OpenAPITools.Client
///
/// X509 Certificate collection.
X509CertificateCollection ClientCertificates { get; }
+
+ ///
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
+ /// overriding certificate errors in the scope of a request.
+ ///
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}
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 288b0f1dd8c..93ace54a151 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
@@ -455,7 +455,8 @@ namespace Org.OpenAPITools.Client
MaxTimeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
- UseDefaultCredentials = configuration.UseDefaultCredentials
+ UseDefaultCredentials = configuration.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
RestClient client = new RestClient(clientOptions)
diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs
index 33f5ea156b3..672bff291b8 100644
--- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs
@@ -18,6 +18,7 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
+using System.Net.Security;
using Org.OpenAPITools.Client.Auth;
namespace Org.OpenAPITools.Client
@@ -649,6 +650,11 @@ namespace Org.OpenAPITools.Client
get { return _HttpSigningConfiguration; }
set { _HttpSigningConfiguration = value; }
}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -730,7 +736,8 @@ namespace Org.OpenAPITools.Client
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
- UseDefaultCredentials = second.UseDefaultCredentials
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
index 731589d5772..90ec4a6f193 100644
--- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Org.OpenAPITools.Client.Auth;
@@ -160,5 +161,11 @@ namespace Org.OpenAPITools.Client
/// Gets the HttpSigning configuration
///
HttpSigningConfiguration HttpSigningConfiguration { get; }
+
+ ///
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
+ /// overriding certificate errors in the scope of a request.
+ ///
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}
diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/Configuration.cs
index 64032c82021..d505689b605 100644
--- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/Configuration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/Configuration.cs
@@ -18,6 +18,7 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
+using System.Net.Security;
namespace Org.OpenAPITools.Client
{
@@ -624,6 +625,11 @@ namespace Org.OpenAPITools.Client
get { return _HttpSigningConfiguration; }
set { _HttpSigningConfiguration = value; }
}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -701,7 +707,8 @@ namespace Org.OpenAPITools.Client
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
- UseDefaultCredentials = second.UseDefaultCredentials
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
index 2f15d38d1fc..b3a84bc5bda 100644
--- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace Org.OpenAPITools.Client
@@ -135,5 +136,11 @@ namespace Org.OpenAPITools.Client
/// Gets the HttpSigning configuration
///
HttpSigningConfiguration HttpSigningConfiguration { get; }
+
+ ///
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
+ /// overriding certificate errors in the scope of a request.
+ ///
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}
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 2defdd5b1f6..0530baabc98 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
@@ -456,7 +456,8 @@ namespace Org.OpenAPITools.Client
MaxTimeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
- UseDefaultCredentials = configuration.UseDefaultCredentials
+ UseDefaultCredentials = configuration.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
RestClient client = new RestClient(clientOptions)
diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Client/Configuration.cs
index 00b52bc32e0..f27abb3d78b 100644
--- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Client/Configuration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Client/Configuration.cs
@@ -18,6 +18,7 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
+using System.Net.Security;
using Org.OpenAPITools.Client.Auth;
namespace Org.OpenAPITools.Client
@@ -654,6 +655,11 @@ namespace Org.OpenAPITools.Client
get { return _HttpSigningConfiguration; }
set { _HttpSigningConfiguration = value; }
}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -735,7 +741,8 @@ namespace Org.OpenAPITools.Client
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
- UseDefaultCredentials = second.UseDefaultCredentials
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
index 731589d5772..90ec4a6f193 100644
--- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Org.OpenAPITools.Client.Auth;
@@ -160,5 +161,11 @@ namespace Org.OpenAPITools.Client
/// Gets the HttpSigning configuration
///
HttpSigningConfiguration HttpSigningConfiguration { get; }
+
+ ///
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
+ /// overriding certificate errors in the scope of a request.
+ ///
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}
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 2defdd5b1f6..0530baabc98 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
@@ -456,7 +456,8 @@ namespace Org.OpenAPITools.Client
MaxTimeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
- UseDefaultCredentials = configuration.UseDefaultCredentials
+ UseDefaultCredentials = configuration.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
RestClient client = new RestClient(clientOptions)
diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Client/Configuration.cs
index 00b52bc32e0..f27abb3d78b 100644
--- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Client/Configuration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Client/Configuration.cs
@@ -18,6 +18,7 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
+using System.Net.Security;
using Org.OpenAPITools.Client.Auth;
namespace Org.OpenAPITools.Client
@@ -654,6 +655,11 @@ namespace Org.OpenAPITools.Client
get { return _HttpSigningConfiguration; }
set { _HttpSigningConfiguration = value; }
}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -735,7 +741,8 @@ namespace Org.OpenAPITools.Client
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
- UseDefaultCredentials = second.UseDefaultCredentials
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
index 731589d5772..90ec4a6f193 100644
--- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Org.OpenAPITools.Client.Auth;
@@ -160,5 +161,11 @@ namespace Org.OpenAPITools.Client
/// Gets the HttpSigning configuration
///
HttpSigningConfiguration HttpSigningConfiguration { get; }
+
+ ///
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
+ /// overriding certificate errors in the scope of a request.
+ ///
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}
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 2defdd5b1f6..0530baabc98 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
@@ -456,7 +456,8 @@ namespace Org.OpenAPITools.Client
MaxTimeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
- UseDefaultCredentials = configuration.UseDefaultCredentials
+ UseDefaultCredentials = configuration.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
RestClient client = new RestClient(clientOptions)
diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/Configuration.cs
index 00b52bc32e0..f27abb3d78b 100644
--- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/Configuration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/Configuration.cs
@@ -18,6 +18,7 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
+using System.Net.Security;
using Org.OpenAPITools.Client.Auth;
namespace Org.OpenAPITools.Client
@@ -654,6 +655,11 @@ namespace Org.OpenAPITools.Client
get { return _HttpSigningConfiguration; }
set { _HttpSigningConfiguration = value; }
}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -735,7 +741,8 @@ namespace Org.OpenAPITools.Client
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
- UseDefaultCredentials = second.UseDefaultCredentials
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
index 731589d5772..90ec4a6f193 100644
--- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Org.OpenAPITools.Client.Auth;
@@ -160,5 +161,11 @@ namespace Org.OpenAPITools.Client
/// Gets the HttpSigning configuration
///
HttpSigningConfiguration HttpSigningConfiguration { get; }
+
+ ///
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
+ /// overriding certificate errors in the scope of a request.
+ ///
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}
diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Client/Configuration.cs
index 64032c82021..d505689b605 100644
--- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Client/Configuration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Client/Configuration.cs
@@ -18,6 +18,7 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
+using System.Net.Security;
namespace Org.OpenAPITools.Client
{
@@ -624,6 +625,11 @@ namespace Org.OpenAPITools.Client
get { return _HttpSigningConfiguration; }
set { _HttpSigningConfiguration = value; }
}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -701,7 +707,8 @@ namespace Org.OpenAPITools.Client
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
- UseDefaultCredentials = second.UseDefaultCredentials
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
index 2f15d38d1fc..b3a84bc5bda 100644
--- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace Org.OpenAPITools.Client
@@ -135,5 +136,11 @@ namespace Org.OpenAPITools.Client
/// Gets the HttpSigning configuration
///
HttpSigningConfiguration HttpSigningConfiguration { get; }
+
+ ///
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
+ /// overriding certificate errors in the scope of a request.
+ ///
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}
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 288b0f1dd8c..93ace54a151 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
@@ -455,7 +455,8 @@ namespace Org.OpenAPITools.Client
MaxTimeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
- UseDefaultCredentials = configuration.UseDefaultCredentials
+ UseDefaultCredentials = configuration.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
RestClient client = new RestClient(clientOptions)
diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/Configuration.cs
index 33f5ea156b3..672bff291b8 100644
--- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/Configuration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/Configuration.cs
@@ -18,6 +18,7 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
+using System.Net.Security;
using Org.OpenAPITools.Client.Auth;
namespace Org.OpenAPITools.Client
@@ -649,6 +650,11 @@ namespace Org.OpenAPITools.Client
get { return _HttpSigningConfiguration; }
set { _HttpSigningConfiguration = value; }
}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -730,7 +736,8 @@ namespace Org.OpenAPITools.Client
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
- UseDefaultCredentials = second.UseDefaultCredentials
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
index 731589d5772..90ec4a6f193 100644
--- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Org.OpenAPITools.Client.Auth;
@@ -160,5 +161,11 @@ namespace Org.OpenAPITools.Client
/// Gets the HttpSigning configuration
///
HttpSigningConfiguration HttpSigningConfiguration { get; }
+
+ ///
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
+ /// overriding certificate errors in the scope of a request.
+ ///
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}
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 2defdd5b1f6..0530baabc98 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
@@ -456,7 +456,8 @@ namespace Org.OpenAPITools.Client
MaxTimeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
- UseDefaultCredentials = configuration.UseDefaultCredentials
+ UseDefaultCredentials = configuration.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
RestClient client = new RestClient(clientOptions)
diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Client/Configuration.cs
index 00b52bc32e0..f27abb3d78b 100644
--- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Client/Configuration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Client/Configuration.cs
@@ -18,6 +18,7 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
+using System.Net.Security;
using Org.OpenAPITools.Client.Auth;
namespace Org.OpenAPITools.Client
@@ -654,6 +655,11 @@ namespace Org.OpenAPITools.Client
get { return _HttpSigningConfiguration; }
set { _HttpSigningConfiguration = value; }
}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -735,7 +741,8 @@ namespace Org.OpenAPITools.Client
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
- UseDefaultCredentials = second.UseDefaultCredentials
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
index 731589d5772..90ec4a6f193 100644
--- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Org.OpenAPITools.Client.Auth;
@@ -160,5 +161,11 @@ namespace Org.OpenAPITools.Client
/// Gets the HttpSigning configuration
///
HttpSigningConfiguration HttpSigningConfiguration { get; }
+
+ ///
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
+ /// overriding certificate errors in the scope of a request.
+ ///
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}
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 4a8d8db7e22..9632c42a5d7 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
@@ -455,7 +455,8 @@ namespace Org.OpenAPITools.Client
MaxTimeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
- UseDefaultCredentials = configuration.UseDefaultCredentials
+ UseDefaultCredentials = configuration.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
RestClient client = new RestClient(clientOptions)
diff --git a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/Configuration.cs
index 91f5496b31d..b79f1a1a38c 100644
--- a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/Configuration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/Configuration.cs
@@ -18,6 +18,7 @@ using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
+using System.Net.Security;
using Org.OpenAPITools.Client.Auth;
namespace Org.OpenAPITools.Client
@@ -540,6 +541,11 @@ namespace Org.OpenAPITools.Client
return url;
}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -620,7 +626,8 @@ namespace Org.OpenAPITools.Client
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
- UseDefaultCredentials = second.UseDefaultCredentials
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
diff --git a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
index bd78e6a567e..cc6fc6c592c 100644
--- a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
+++ b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/IReadableConfiguration.cs
@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Org.OpenAPITools.Client.Auth;
@@ -155,5 +156,11 @@ namespace Org.OpenAPITools.Client
///
/// X509 Certificate collection.
X509CertificateCollection ClientCertificates { get; }
+
+ ///
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
+ /// overriding certificate errors in the scope of a request.
+ ///
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}