diff --git a/DeepDrftWeb.Client/Program.cs b/DeepDrftWeb.Client/Program.cs index 6edf5fa..b8afffb 100644 --- a/DeepDrftWeb.Client/Program.cs +++ b/DeepDrftWeb.Client/Program.cs @@ -15,6 +15,7 @@ Startup.ConfigureContentServices(builder.Services, contentApiUrl); Startup.ConfigureDomainServices(builder.Services); // AuthBlocks WASM: auth state deserialization bridge (prerender → WASM handoff). +// Registers AddAuthorizationCore, AddCascadingAuthenticationState, AddAuthenticationStateDeserialization. AuthBlocksWeb.Client.Startup.ConfigureServices(builder.Services); var app = builder.Build(); diff --git a/DeepDrftWeb.Client/Routes.razor b/DeepDrftWeb.Client/Routes.razor index 4d2d73b..8b95b94 100644 --- a/DeepDrftWeb.Client/Routes.razor +++ b/DeepDrftWeb.Client/Routes.razor @@ -1,5 +1,13 @@ - +@inject NavigationManager NavigationManager + + - + + + @{ + NavigationManager.NavigateTo($"account/login?returnUrl={Uri.EscapeDataString(NavigationManager.Uri)}", forceLoad: true); + } + + diff --git a/DeepDrftWeb.Services/Data/Configurations/TrackConfiguration.cs b/DeepDrftWeb.Services/Data/Configurations/TrackConfiguration.cs index a896df4..3f11d84 100644 --- a/DeepDrftWeb.Services/Data/Configurations/TrackConfiguration.cs +++ b/DeepDrftWeb.Services/Data/Configurations/TrackConfiguration.cs @@ -47,7 +47,6 @@ public class TrackConfiguration : IEntityTypeConfiguration .HasMaxLength(500); builder.Property(x => x.CreatedByUserId) - .HasColumnName("created_by_user_id") - .IsRequired(false); + .HasColumnName("created_by_user_id"); } } \ No newline at end of file diff --git a/DeepDrftWeb.Services/Data/DeepDrftContextFactory.cs b/DeepDrftWeb.Services/Data/DeepDrftContextFactory.cs index 02e57e5..bb846d4 100644 --- a/DeepDrftWeb.Services/Data/DeepDrftContextFactory.cs +++ b/DeepDrftWeb.Services/Data/DeepDrftContextFactory.cs @@ -10,9 +10,9 @@ public class DeepDrftContextFactory : IDesignTimeDbContextFactory(); optionsBuilder.UseNpgsql(connectionString); diff --git a/DeepDrftWeb/Program.cs b/DeepDrftWeb/Program.cs index 0a9a483..9308969 100644 --- a/DeepDrftWeb/Program.cs +++ b/DeepDrftWeb/Program.cs @@ -13,9 +13,6 @@ builder.Services.AddMudServices(); builder.Services.AddCmsServices(); -// Add AudioInteropService for both server and client rendering -// builder.Services.AddScoped(); - var baseUrl = builder.GetKestrelUrl(); var contentApiUrl = builder.Configuration["ApiUrls:ContentApi"] ?? throw new Exception("Content API URL is not configured"); @@ -23,26 +20,36 @@ var contentApiUrl = builder.Configuration["ApiUrls:ContentApi"] ?? throw new Exc // Auth schema runs in its own database (separate from DefaultConnection by design). builder.Services.AddAuthBlocks(options => { - options.ConnectionString = builder.Configuration.GetConnectionString("Auth")!; + options.ConnectionString = builder.Configuration.GetConnectionString("Auth") + ?? throw new InvalidOperationException("ConnectionStrings:Auth is required"); options.ApplicationName = "DeepDrft"; options.SupportEmail = builder.Configuration["AuthBlocks:SupportEmail"] ?? "admin@deepdrft.com"; - options.JwtSettings.Secret = builder.Configuration["AuthBlocks:Jwt:Secret"]!; - options.JwtSettings.Issuer = builder.Configuration["AuthBlocks:Jwt:Issuer"]!; - options.JwtSettings.Audience = builder.Configuration["AuthBlocks:Jwt:Audience"]!; + options.JwtSettings.Secret = builder.Configuration["AuthBlocks:Jwt:Secret"] + ?? throw new InvalidOperationException("AuthBlocks:Jwt:Secret is required"); + options.JwtSettings.Issuer = builder.Configuration["AuthBlocks:Jwt:Issuer"] + ?? throw new InvalidOperationException("AuthBlocks:Jwt:Issuer is required"); + options.JwtSettings.Audience = builder.Configuration["AuthBlocks:Jwt:Audience"] + ?? throw new InvalidOperationException("AuthBlocks:Jwt:Audience is required"); - options.EmailConnection.Host = builder.Configuration["AuthBlocks:Email:Host"]!; - options.EmailConnection.Token = builder.Configuration["AuthBlocks:Email:Token"]!; + options.EmailConnection.Host = builder.Configuration["AuthBlocks:Email:Host"] + ?? throw new InvalidOperationException("AuthBlocks:Email:Host is required"); + options.EmailConnection.Token = builder.Configuration["AuthBlocks:Email:Token"] + ?? throw new InvalidOperationException("AuthBlocks:Email:Token is required"); options.AdminUserSettings = new AdminUserSettings { - UserName = builder.Configuration["AuthBlocks:Admin:UserName"]!, - Email = builder.Configuration["AuthBlocks:Admin:Email"]!, - Password = builder.Configuration["AuthBlocks:Admin:Password"]! + UserName = builder.Configuration["AuthBlocks:Admin:UserName"] + ?? throw new InvalidOperationException("AuthBlocks:Admin:UserName is required"), + Email = builder.Configuration["AuthBlocks:Admin:Email"] + ?? throw new InvalidOperationException("AuthBlocks:Admin:Email is required"), + Password = builder.Configuration["AuthBlocks:Admin:Password"] + ?? throw new InvalidOperationException("AuthBlocks:Admin:Password is required") }; }); // AuthBlocksWeb: Blazor JWT client services (auth API is mounted on this same host via MapAuthBlocks). +// AuthBlocksWeb.Startup.ConfigureAuthServices registers AddCascadingAuthenticationState server-side. AuthBlocksWeb.Startup.ConfigureAuthServices(builder.Services, baseUrl); DeepDrftWeb.Client.Startup.ConfigureApiHttpClient(builder.Services, baseUrl); diff --git a/DeepDrftWeb/appsettings.json b/DeepDrftWeb/appsettings.json index 7b8bb3f..05224fc 100644 --- a/DeepDrftWeb/appsettings.json +++ b/DeepDrftWeb/appsettings.json @@ -7,7 +7,7 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "DefaultConnection": "Host=localhost;Database=deepdrft_dev;Username=postgres;Password=REPLACE_IN_ENV" + "DefaultConnection": "Host=localhost;Port=5433;Database=postgres;Username=postgres;Password=REPLACE_IN_ENV" }, "ApiUrls": { "ContentApi": "http://localhost:12777/" diff --git a/NuGet.Config b/NuGet.Config index 7a1970a..db26aa3 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -2,6 +2,7 @@ + diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 8abd963..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,14 +0,0 @@ -services: - postgres: - image: postgres:18 - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: deepdrft_dev - ports: - - "5432:5432" - volumes: - - deepdrft_postgres:/var/lib/postgresql/data - -volumes: - deepdrft_postgres: