Add CDN layer, harden admin unlock UI, scrub credentials from git
SOR.Cdn (new project):
- ICdnClient / HttpCdnClient — POST /upload?folder= + DELETE /files/{path}
- Typed HttpClient, X-Api-Key auth, 100 MB stream support
- CdnOptions: PublicBaseUrl, UploadBaseUrl, ApiKey (all via k8s env vars)
CardEditor (Assets tab):
- Upload button per asset/animation — streams file through Blazor Server SignalR
to CDN; auto-fills CdnUrl + MimeType on success
- SignalR MaximumReceiveMessageSize raised to 100 MB for large 3D model uploads
- accept="image/*" for Art2D, ".glb,.gltf,.fbx" for Model3D and animations
AccountDetail:
- Distinguish auto-lockout (≤ 1 h, yellow badge) from admin ban (> 1 h, red badge)
- "Force Unlock" clears lockout immediately + resets failed-attempt counter
- "Unban" for admin-set bans; both call SetLockoutEndDateAsync(null)
Auth lockout: 15 min → 30 min (SOR.Auth + SOR.Admin both updated)
Credentials:
- Removed hardcoded Postgres/Redis creds from all committed appsettings.json
- Production values come from k8s secret env vars (ASP.NET Core env override)
- Added appsettings.Development.json + appsettings.*.Local.json to .gitignore
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SOR.Admin;
|
||||
using SOR.Admin.Components;
|
||||
using SOR.Cdn;
|
||||
using SOR.Database;
|
||||
using SOR.Database.Contexts;
|
||||
using SOR.Database.Entities.Identity;
|
||||
@@ -15,6 +16,11 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddRazorComponents()
|
||||
.AddInteractiveServerComponents();
|
||||
|
||||
// Increase SignalR hub message size to support large file uploads (art, 3D models).
|
||||
// IBrowserFile.OpenReadStream streams through the SignalR hub in Blazor Server.
|
||||
builder.Services.AddSignalR(opts =>
|
||||
opts.MaximumReceiveMessageSize = 100 * 1024 * 1024); // 100 MB
|
||||
|
||||
// Required for <AuthorizeView> and [Authorize] in Blazor components.
|
||||
builder.Services.AddCascadingAuthenticationState();
|
||||
builder.Services.AddScoped<AuthenticationStateProvider,
|
||||
@@ -55,7 +61,7 @@ builder.Services.AddIdentityCore<Account>(options =>
|
||||
options.Password.RequireNonAlphanumeric = true;
|
||||
options.Password.RequiredLength = 12;
|
||||
options.Lockout.MaxFailedAccessAttempts = 5;
|
||||
options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(15);
|
||||
options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(30);
|
||||
})
|
||||
.AddRoles<IdentityRole<Guid>>()
|
||||
.AddEntityFrameworkStores<SorIdentityDbContext>()
|
||||
@@ -65,6 +71,9 @@ builder.Services.AddIdentityCore<Account>(options =>
|
||||
// ── Razor Pages (used for login/logout form posts) ─────────────────────────
|
||||
builder.Services.AddRazorPages();
|
||||
|
||||
// ── CDN client ────────────────────────────────────────────────────────────
|
||||
builder.Services.AddCdnClient(builder.Configuration);
|
||||
|
||||
// ── Databases ─────────────────────────────────────────────────────────────
|
||||
builder.Services.AddIdentityDatabase(builder.Configuration);
|
||||
builder.Services.AddCatalogDatabase(builder.Configuration);
|
||||
|
||||
Reference in New Issue
Block a user