postit: allow self-signed OIDC TLS in Development #9

Merged
notazof merged 7 commits from fix/OIDC-debugging into main 2026-08-02 21:32:53 +01:00
Showing only changes of commit eba44b46e2 - Show all commits

postit: allow self-signed OIDC TLS in Development
Some checks failed
Dotnet build and test / log-the-inputs (pull_request) Has been cancelled
Dotnet build and test / build (pull_request) Has been cancelled

Paul Schneider 2026-07-12 15:51:55 +01:00

View file

@ -6,6 +6,7 @@ using Microsoft.Extensions.DependencyInjection;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Net.Http;
using System.Text.Json; using System.Text.Json;
using System.Threading; using System.Threading;
@ -182,6 +183,16 @@ public partial class Settings : ViewModelBase
// PKCE is enabled by default when no client_secret is provided. // PKCE is enabled by default when no client_secret is provided.
}; };
if (IsDevelopmentEnvironment())
{
// Dev only: allow local/self-signed TLS for discovery/token
// endpoints when the machine does not trust a custom root.
options.BackchannelHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (_, _, _, _) => true
};
}
if (browser is not null) if (browser is not null)
options.Browser = browser; options.Browser = browser;
@ -231,6 +242,14 @@ public partial class Settings : ViewModelBase
} }
} }
private static bool IsDevelopmentEnvironment()
{
return string.Equals(
Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"),
"Development",
StringComparison.OrdinalIgnoreCase);
}
internal void Load() internal void Load()
{ {
if (Loaded) return; if (Loaded) return;