WIP PostIt login

This commit is contained in:
Paul Schneider 2026-06-25 00:08:25 +01:00
commit f3a3b63595
13 changed files with 103 additions and 160 deletions

View file

@ -44,7 +44,7 @@ public sealed class OidcStubAuthority : IAsyncDisposable, IDisposable
// Pick a free loopback port.
var port = GetFreePort();
var prefix = $"http://127.0.0.1:{port}/";
var loopback = "http://127.0.0.1:7890/"; // matches PostIt.Settings.DefaultLoopbackRedirectUri
var loopback = "postit://callback"; // matches PostIt.Settings.DefaultLoopbackRedirectUri
var listener = new HttpListener();
listener.Prefixes.Add(prefix);
@ -251,4 +251,4 @@ internal static class Base64UrlEncoder
.Replace('+', '-')
.Replace('/', '_');
}
}
}

View file

@ -1,6 +1,5 @@
using System;
using System.IO;
using System.Threading.Tasks;
using Xunit;
namespace PostIt.Tests;
@ -14,7 +13,7 @@ public class SettingsLoadTests
/// PostIt.dll.
/// </summary>
[Fact]
public async Task Load_falls_back_to_embedded_resource_when_user_file_missing()
public void Load_falls_back_to_embedded_resource_when_user_file_missing()
{
// Skip if a user-level file exists (CI / different dev machines).
var userConfigPath = Path.Combine(
@ -27,7 +26,7 @@ public class SettingsLoadTests
}
var settings = new PostIt.Settings();
await settings.Load();
settings.Load();
// The bundled postit-settings.json points at yavsc.pschneider.fr.
Assert.False(string.IsNullOrWhiteSpace(settings.Authentication?.Authority));

View file

@ -115,12 +115,12 @@ public class YavscApiClientTests
{
Authentication = new AuthenticationSettings
{
Authority = "http://127.0.0.1:1",
Authority = "https://127.0.0.1:5001",
ClientId = "postit-tests",
},
RedirectUri = "http://127.0.0.1:7890/",
RedirectUri = "postit://callback",
Scopes = new[] { "openid" },
ApiUrl = "http://127.0.0.1:1/",
ApiUrl = "https://127.0.0.1:5003/api/v1",
};
var client = new YavscApiClient(settings, new TokenStore(Path.Combine(
Path.GetTempPath(), $"postit-tests-noop-{Guid.NewGuid():N}.json")));