Commit graph yavsc/src/Yavsc.Server/Settings/SiteSettings.cs
Author SHA1 Message Date
0ba44c21e7 server: enable nullable annotations in legacy files 2026-09-06 16:11:37 +01:00
138467496f Fix set-avatar auth flow and API avatar upload stability 2026-09-04 19:03:08 +01:00
b679707b83 using clauses cleanup 2026-08-22 03:34:48 +01:00
dcf2a93ad0 Split Site:Audience into Site:ExternalUrl + Site:CorsAllowedOrigins
The Site:Audience setting was conflating two distinct concepts: an OAuth
JWT audience (a single resource identifier) and a CORS allow-list (an
array of origins). Collapsing them caused several latent bugs:
- OAuth/JWT validation expected a single string while CORS WithOrigins
  accepts an array.
- Password-reset callback URLs and OAuth client RedirectUri/Origin were
  being built from what was meant to be an audience identifier, not a
  base URL.
- Yavsc.Org's main CORS policy was hardcoded to '*', with no way to
  restrict it without code changes.

Changes:
- SiteSettings.Audience (string) replaced with CorsAllowedOrigins
  (IList<string>).
- OAuth JWT Authority still reads Site:Authority; Audience now reads
  Site:ExternalUrl (Org only; Api/Blogs use ValidateAudience=false).
- MailSender and AccountController build reset-callback URLs from
  Site:ExternalUrl.
- ClientController uses Site:ExternalUrl for OAuth RedirectUri/Origin
  defaults on newly created clients.
- Yavsc.Api and Yavsc.Blogs now read CORS origins from
  Site:CorsAllowedOrigins instead of hardcoded URLs.

Add shared AddYavscCors / AddYavscJwtBearer extension methods in
Yavsc.Server/Helpers/ServiceExtensions.cs to enforce a single
configuration contract across all runtime services (Api, Blogs, Org).
Fails closed when CorsAllowedOrigins is empty; fails fast at startup
when Site:Authority is missing.

Remove obsolete ConfigurationHelpers.GetAudience (no remaining callers).

Local appsettings-*.json files (which carry deployment-specific values
and are gitignored) must be updated to add Site:CorsAllowedOrigins.
2026-06-19 13:15:21 +01:00
Paul Schneider
40e8e08690 reorg 2026-02-28 21:17:54 +00:00
Paul Schneider
45514010f2 REORG 2026-02-14 16:54:27 +00:00
Paul Schneider
714b2e0efb Passwor re-init 2025-09-07 17:43:13 +01:00
Paul Schneider
c51f11c7dc Blog post create 2025-07-09 13:16:01 +01:00
Paul Schneider
409528b8d4 MEF 2025-07-09 11:17:16 +01:00
Paul Schneider
380f2314dc Code cleanup 2025-03-04 18:05:21 +00:00
Paul Schneider
8132db37d0 Local Passwords validation 2024-11-06 13:00:34 +00:00
Paul Schneider
53bca59c18 migration applied 2023-03-26 20:41:42 +01:00
492427f4b8 code guidelines 2020-10-09 20:27:44 +01:00
20072f0d03 use the logo when available 2019-08-09 13:44:16 +01:00
ab65ccac4e banner settings 2019-05-08 04:42:14 +01:00
02160f1eaf [reorg] 2019-05-07 14:01:23 +01:00
ccc91bbf19 files tree made better. 2019-01-01 16:29:36 +00:00
Renamed from Yavsc.Server/Settings/SiteSettings.cs (Browse further)