Hide inserted estimates from client list; redirect anon to /signin

Estimates with status Inserted (provider hasn't worked on them yet)
were showing up in the client's "Mes devis à valider" list. The
asclient endpoint now requires ProviderValidationDate to be set, so
only estimates the provider has actually established and submitted
are visible to the client. The asprovider endpoint is unchanged
(providers still need to see incoming unprocessed requests).

Also fix the anonymous-access redirect on Yavsc.Org: the application
cookie's LoginPath defaulted to /Account/Login, which has no
controller. Anonymous hits to a restricted page now redirect to the
real /signin endpoint (with /signout and /Account/AccessDenied set
to match the existing controller routes).

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Paul Schneider 2026-09-21 14:38:49 +01:00
commit 22c33c5388
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
4 changed files with 70 additions and 3 deletions

View file

@ -1,4 +1,7 @@
using System.Net;
using System.Net.Http;
using IdentityServer8.Stores;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
@ -40,4 +43,26 @@ public class AccountSmokeTests : IClassFixture<TestWebApplicationFactory>
Assert.Null(exception);
}
// Regression: anonymous access to a restricted page used to redirect to
// the ASP.NET Identity default LoginPath "/Account/Login", which has no
// controller here. The application cookie must redirect to the real
// sign-in endpoint at /signin instead.
[Fact]
public async Task Anonymous_access_to_protected_page_redirects_to_signin()
{
var client = _factory.CreateClient(new WebApplicationFactoryClientOptions
{
AllowAutoRedirect = false,
});
// EstimateController is [Authorize]; GET /Estimate hits Index().
var response = await client.GetAsync("/Estimate", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
var location = response.Headers.Location;
Assert.NotNull(location);
Assert.Equal("/signin", location.AbsolutePath);
Assert.Contains("ReturnUrl=%2FEstimate", location.Query);
}
}