diff --git a/Core/Resgrid.Config/ApiConfig.cs b/Core/Resgrid.Config/ApiConfig.cs
index eeed8370..4adc192c 100644
--- a/Core/Resgrid.Config/ApiConfig.cs
+++ b/Core/Resgrid.Config/ApiConfig.cs
@@ -19,5 +19,10 @@ public static class ApiConfig
/// Key used for authing with the backend internal apis
///
public static string BackendInternalApikey = "";
+
+ ///
+ /// Used to bypass SSL checks, which is needed for self-signed certs
+ ///
+ public static bool BypassSslChecks = false;
}
}
diff --git a/Web/Resgrid.Web.Eventing/Startup.cs b/Web/Resgrid.Web.Eventing/Startup.cs
index a7505c15..1e7c36ee 100644
--- a/Web/Resgrid.Web.Eventing/Startup.cs
+++ b/Web/Resgrid.Web.Eventing/Startup.cs
@@ -49,6 +49,7 @@
using Microsoft.IdentityModel.Tokens;
using Org.BouncyCastle.Asn1.Ess;
using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork;
+using System.Net.Http;
namespace Resgrid.Web.Eventing
{
@@ -79,8 +80,6 @@ public void ConfigureServices(IServiceCollection services)
bool configResult = ConfigProcessor.LoadAndProcessConfig(Configuration["AppOptions:ConfigPath"]);
bool envConfigResult = ConfigProcessor.LoadAndProcessEnvVariables(Configuration.AsEnumerable());
- Framework.Logging.Initialize(ExternalErrorConfig.ExternalErrorServiceUrlForEventing);
-
var settings = System.Configuration.ConfigurationManager.ConnectionStrings;
var element = typeof(ConfigurationElement).GetField("_readOnly", BindingFlags.Instance | BindingFlags.NonPublic);
var collection = typeof(ConfigurationElementCollection).GetField("_readOnly", BindingFlags.Instance | BindingFlags.NonPublic);
@@ -98,6 +97,25 @@ public void ConfigureServices(IServiceCollection services)
collection.SetValue(settings, true);
element.SetValue(settings, true);
+ Framework.Logging.Initialize(ExternalErrorConfig.ExternalErrorServiceUrlForEventing);
+
+ if (Config.ApiConfig.BypassSslChecks)
+ {
+ services.AddHttpClient("Name")
+ .ConfigurePrimaryHttpMessageHandler(() =>
+ {
+ var handler = new HttpClientHandler
+ {
+ AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
+ ServerCertificateCustomValidationCallback = (sender, certificate, chain, errors) =>
+ {
+ return true;
+ }
+ };
+ return handler;
+ });
+ }
+
services.AddCors();
services.AddControllers().AddNewtonsoftJson(options =>
diff --git a/Web/Resgrid.Web.ServicesCore/Startup.cs b/Web/Resgrid.Web.ServicesCore/Startup.cs
index 3a5b6476..f2ba07aa 100644
--- a/Web/Resgrid.Web.ServicesCore/Startup.cs
+++ b/Web/Resgrid.Web.ServicesCore/Startup.cs
@@ -62,6 +62,7 @@
using Resgrid.Web.ServicesCore.Middleware;
using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork;
using OpenTelemetry.Metrics;
+using System.Net.Http;
namespace Resgrid.Web.ServicesCore
{
@@ -121,6 +122,23 @@ public void ConfigureServices(IServiceCollection services)
collection.SetValue(settings, true);
element.SetValue(settings, true);
+ if (Config.ApiConfig.BypassSslChecks)
+ {
+ services.AddHttpClient("Name")
+ .ConfigurePrimaryHttpMessageHandler(() =>
+ {
+ var handler = new HttpClientHandler
+ {
+ AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
+ ServerCertificateCustomValidationCallback = (sender, certificate, chain, errors) =>
+ {
+ return true;
+ }
+ };
+ return handler;
+ });
+ }
+
services.AddScoped, IdentityUserStore>();
services.AddScoped, IdentityRoleStore>();
services.AddScoped, ClaimsPrincipalFactory>();
diff --git a/Web/Resgrid.WebCore/Startup.cs b/Web/Resgrid.WebCore/Startup.cs
index 03fec74f..935afc5f 100644
--- a/Web/Resgrid.WebCore/Startup.cs
+++ b/Web/Resgrid.WebCore/Startup.cs
@@ -3,6 +3,7 @@
using System.Configuration;
using System.Globalization;
using System.Net;
+using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
using Audit.Core;
@@ -56,8 +57,8 @@ namespace Resgrid.Web
{
public class Startup
{
- //public IConfiguration Configuration { get; }
- public IConfigurationRoot Configuration { get; private set; }
+ //public IConfiguration Configuration { get; }
+ public IConfigurationRoot Configuration { get; private set; }
public ILifetimeScope AutofacContainer { get; private set; }
public AutofacServiceLocator Locator { get; private set; }
public IServiceCollection Services { get; private set; }
@@ -102,6 +103,24 @@ public void ConfigureServices(IServiceCollection services)
Logging.Initialize(ExternalErrorConfig.ExternalErrorServiceUrlForWebsite);
+
+ if (Config.ApiConfig.BypassSslChecks)
+ {
+ services.AddHttpClient("Name")
+ .ConfigurePrimaryHttpMessageHandler(() =>
+ {
+ var handler = new HttpClientHandler
+ {
+ AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
+ ServerCertificateCustomValidationCallback = (sender, certificate, chain, errors) =>
+ {
+ return true;
+ }
+ };
+ return handler;
+ });
+ }
+
services.AddScoped, IdentityUserStore>();
services.AddScoped, IdentityRoleStore>();
services.AddScoped, ClaimsPrincipalFactory>();