Voeg Api.AndreaSlopFotografie toe met setup-token, proxy-bewuste limiters en ASF-admin-thema

- Core: opt-in ForwardedHeaders:KnownProxies en rate limiters per clientadres
  (zonder configuratie ongewijzigd gedrag)
- Identity: optioneel setup-token (X-Setup-Token), beide setup-endpoints onder de
  login-limiter, beveiligingsgebeurtenis setup_token_rejected (5007)
- Nieuw client-project SlpModularCms.Api.AndreaSlopFotografie (Identity + Availability)
  met bijbehorende tests
- Frontend: thema asf (VITE_THEME), VITE_DEFAULT_LANGUAGE, tokenveld op de setup-pagina
- CI: jobs publish/deploy-asf-test achter ASF_TEST_DEPLOY_ENABLED
- Fix U1: 301-Location wordt nu percent-encoded (gevonden door de property-test)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 01:16:34 +01:00
co-authored by Claude Sonnet 5.5
parent e523e670ad
commit 88f5d20a78
55 changed files with 1828 additions and 67 deletions
@@ -0,0 +1,21 @@
using SlpModularCms.Core.Hosting;
var builder = WebApplication.CreateBuilder(args);
// Load local developer overrides
builder.Configuration.AddJsonFile("appsettings.local.json", optional: true, reloadOnChange: true);
// Andrea Slop Fotografie serves a prerendered website from wwwroot/web (nginx-equivalent behaviour)
// instead of the SPA-style website mount the other clients use.
var hostOptions = new CmsHostOptions { WebsiteMode = WebsiteMode.PrerenderedPages };
var orchestrator = CmsHost.ConfigureServices(builder, hostOptions);
var app = builder.Build();
CmsHost.ConfigurePipeline(app, orchestrator, hostOptions);
app.Run();
// Exposed so the host regression tests can start the real application in-memory.
public partial class Program;
@@ -0,0 +1,25 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5200",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"launchUrl": "scalar"
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7200;http://localhost:5200",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"launchUrl": "scalar"
}
}
}
@@ -0,0 +1,39 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Asp.Versioning.Mvc" Version="10.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.9" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.9">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Scalar.AspNetCore" Version="2.16.3" />
</ItemGroup>
<!--
Deliberately Identity + Availability only: this client serves one prerendered website and its
admin. No Master (it is not a master/slave setup) and no Offerings (a SlpSoftware-specific
feature), so /api/v1/System/capabilities does not list them. Availability is kept because the
admin SPA reads the availability status.
-->
<ItemGroup>
<ProjectReference Include="..\SlpModularCms.Core\SlpModularCms.Core.csproj" />
<ProjectReference Include="..\SlpModularCms.Modules.Availability\SlpModularCms.Modules.Availability.csproj" />
<ProjectReference Include="..\SlpModularCms.Modules.Identity\SlpModularCms.Modules.Identity.csproj" />
</ItemGroup>
<!--
The admin SPA (frontend/) is served at /admin from wwwroot/admin and the prerendered website
at / from wwwroot/web. Neither is built by an MSBuild target here — see
SlpModularCms.Api.csproj for why; the CI workflow builds the admin as its own step and the
website is delivered by its own repository.
-->
</Project>
@@ -0,0 +1,34 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
// Own, isolated local dev database, separate from the other clients' local databases.
"DefaultConnection": "Server=127.0.0.1;Port=3306;Database=AndreaSlopFotografieDev;Uid=root;Pwd=<your-local-mariadb-password>"
},
"JwtSettings": {
"Secret": "SuperSecretKeyForDevelopmentOnly_MustBeLongerThan32Bytes!",
"Issuer": "SlpModularCms",
"Audience": "SlpModularCmsPortal",
"ExpiryMinutes": 60,
"RefreshTokenExpiryDays": 7,
"CookieSameSite": "None"
},
"Cors": {
// The admin dev server (`pnpm dev:asf`, see frontend/.env.example).
"AllowedOrigins": [ "http://localhost:5176", "https://localhost:5176" ]
},
"RateLimiting": {
"Login": {
"PermitLimit": 500,
"WindowSeconds": 60
},
"Refresh": {
"PermitLimit": 500,
"WindowSeconds": 60
}
}
}
@@ -0,0 +1,101 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Information",
// Pinned at Warning deliberately. At Information, EF prints every SQL statement INCLUDING
// parameter values, and the login path passes a normalised email address through it.
"Microsoft.EntityFrameworkCore.Database.Command": "Warning"
}
},
"AllowedHosts": "*",
// Secrets and per-environment values are NEVER committed here; the deployed host receives them as
// environment variables (ConnectionStrings__DefaultConnection, JwtSettings__Secret, ...).
"ConnectionStrings": {
"DefaultConnection": "Server=<db-host>;Port=3306;Database=AndreaSlopFotografie<Env>;Uid=<db-user>;Pwd=<db-password>"
},
"JwtSettings": {
"Secret": "<secure-long-random-secret-key-from-env>",
"Issuer": "SlpModularCms",
"Audience": "SlpModularCmsPortal",
"ExpiryMinutes": 60,
"RefreshTokenExpiryDays": 7
},
"Availability": {
"CircuitBreakerSeconds": 30,
"StatusCacheSeconds": 1
},
"MasterPolling": {
"PollIntervalSeconds": 30,
"FailOpenAfterMinutes": 5,
"HttpTimeoutSeconds": 5
},
"Identity": {
"Setup": {
// Optional protection of the first-administrator setup. Supplied per environment as
// Identity__Setup__Token (at least 32 random characters) and removed once the first
// administrator exists. Empty = setup is not token-protected.
"Token": ""
}
},
// Opt-in trust in the reverse proxy in front of this host. Supplied per environment as
// ForwardedHeaders__KnownProxies__0 (the proxy IP address). Empty = forwarded headers are ignored.
"ForwardedHeaders": {
"KnownProxies": []
},
"Website": {
// Secure default: every website response carries noindex and /robots.txt disallows all. A
// production instance must set Website__NoIndex=false explicitly.
"NoIndex": true
},
"Cors": {
"AllowedOrigins": []
},
"RateLimiting": {
"Login": {
"PermitLimit": 5,
"WindowSeconds": 60
},
"Refresh": {
"PermitLimit": 20,
"WindowSeconds": 60
},
"SentryTunnel": {
"PermitLimit": 60,
"WindowSeconds": 60
},
"OfferingsPublic": {
"PermitLimit": 120,
"WindowSeconds": 60
}
},
"SecurityHeaders": {
"Enabled": true,
// The public website is the default; the CMS admin and API keep the strict policy.
"DefaultPolicy": "StrictSite",
"PathPolicies": [
{ "PathPrefix": "/admin", "Policy": "Strict" },
{ "PathPrefix": "/api/v1", "Policy": "Strict" },
{ "PathPrefix": "/health", "Policy": "Strict" }
],
"AllowedScriptOrigins": [],
"AllowedConnectOrigins": [],
// Origins the website itself calls (analytics script + beacon, Sentry error reporting). Only
// the StrictSite policy gets them; the admin policies are not widened. The host and admin set
// up no Umami: the admin reports errors through the same-origin /sentry-tunnel.
"AllowedSiteScriptOrigins": [ "https://analytics.slpsoftware.nl" ],
"AllowedSiteConnectOrigins": [
"https://analytics.slpsoftware.nl",
"https://o4511795618185216.ingest.de.sentry.io"
]
},
"Observability": {
// Supplied per environment as Observability__SentryDsn. Empty means Sentry is skipped
// entirely and console logging continues — a normal, supported state, not an error.
"SentryDsn": "",
// Falls back to ASPNETCORE_ENVIRONMENT when empty.
"Environment": "",
"TracesSampleRate": 0.1,
"TunnelMaxPayloadBytes": 204800
}
}