Compare commits

..

View file

@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Net.Http; using System.Net.Http;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization;
[assembly: InternalsVisibleTo("PostIt.Tests")] [assembly: InternalsVisibleTo("PostIt.Tests")]
@ -33,7 +32,6 @@ public partial class Settings : ViewModelBase
public partial string SearchText { get; set; } = string.Empty; public partial string SearchText { get; set; } = string.Empty;
[ObservableProperty] [ObservableProperty]
[JsonIgnore]
public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret."); public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret.");
public void SetActionStatus(string message, StatusSeverity severity = StatusSeverity.Info) public void SetActionStatus(string message, StatusSeverity severity = StatusSeverity.Info)
@ -125,8 +123,6 @@ public partial class Settings : ViewModelBase
// build options from a torn read. // build options from a torn read.
lock (_mutationGate) lock (_mutationGate)
{ {
EnsureAuthenticationDefaultsLocked();
var options = new OidcClientOptions var options = new OidcClientOptions
{ {
Authority = Authentication.Authority, Authority = Authentication.Authority,
@ -155,25 +151,6 @@ public partial class Settings : ViewModelBase
} }
} }
private void EnsureAuthenticationDefaultsLocked()
{
Authentication ??= new AuthenticationSettings();
if (string.IsNullOrWhiteSpace(Authentication.Authority))
Authentication.Authority = AuthenticationSettings.DefaultAuthority;
if (string.IsNullOrWhiteSpace(Authentication.ClientId))
Authentication.ClientId = AuthenticationSettings.DefaultClientId;
if (string.IsNullOrWhiteSpace(Authentication.RedirectUri))
Authentication.RedirectUri = AuthenticationSettings.DesktopRedirectUri;
if (Authentication.Scopes is null || Authentication.Scopes.Length == 0)
Authentication.Scopes = AuthenticationSettings.DefaultScopes;
Authentication.RefreshScopeListText();
}
/// <summary> /// <summary>
/// Scopes the PostIt client always requires from the OIDC provider, /// Scopes the PostIt client always requires from the OIDC provider,
/// regardless of what the user has in their settings file. /// regardless of what the user has in their settings file.
@ -357,13 +334,11 @@ public partial class Settings : ViewModelBase
AuthenticationSettings.DesktopRedirectUri : settings.Authentication.RedirectUri; AuthenticationSettings.DesktopRedirectUri : settings.Authentication.RedirectUri;
if (settings.Authentication.Scopes is null || settings.Authentication.Scopes.Length == 0) if (settings.Authentication.Scopes is null || settings.Authentication.Scopes.Length == 0)
{ {
this.Authentication.Scopes = AuthenticationSettings.DefaultScopes; settings.Authentication.Scopes = AuthenticationSettings.DefaultScopes;
} }
else else
this.Authentication.Scopes = settings.Authentication.Scopes; this.Authentication.Scopes = settings.Authentication.Scopes;
} }
EnsureAuthenticationDefaultsLocked();
} }
// A disk load (or an embedded-resource fallback) is the // A disk load (or an embedded-resource fallback) is the
// baseline, not a user edit. Clear the dirty flag last // baseline, not a user edit. Clear the dirty flag last