feat: let consuming apps configure the login features (2FA / passkey / registration)#67
Merged
Merged
Conversation
Surface marten-identity's registration / 2FA / passkey feature flags to AppFoundation hosts: - New AppFoundationOptions.ConfigureIdentity forwards to AddMartenIdentityBlazor, so a host can toggle EnableUserRegistration / EnableTwoFactor / EnablePasskey (and any other MartenIdentityBlazorOptions). - UseAppFoundation now wires UseMartenIdentityFeatureGate, so a disabled feature's pages/endpoints are unreachable by direct URL, not just hidden. - The management NavMenu hides the Two-factor and Passkeys entries when those features are disabled. Bumps AndreGoepel.Marten.Identity.Blazor to 1.2.0-preview1, which introduces the feature-flag API.
Make the registration / 2FA / passkey flags admin-editable at runtime, persisted, on top of the ConfigureIdentity baseline: - IdentityFeatureSettingsDocument (Marten) + IIdentityFeatureSettingsStore persist the flags; MartenIdentityFeatureProvider replaces the identity package's options-only IIdentityFeatureProvider so the feature gate and nav menu honour the saved values (falling back to the configured baseline when no record exists yet). - New Administration > Login Features page (Administrator only) to toggle each feature. - AddAppFoundationIdentityFeatures wires it, registered after AddMartenIdentityBlazor so the database-backed provider takes precedence.
Owner
Author
|
Extended this PR to make the flags admin-editable at runtime (persisted), not just config-time:
So the model is: Tests: bUnit page test (load/save/route/authorize) + provider mapping test. 87/87 passing, locked restore + csharpier clean. |
andregoepel
added a commit
that referenced
this pull request
Jul 5, 2026
andregoepel
added a commit
that referenced
this pull request
Jul 5, 2026
andregoepel
added a commit
that referenced
this pull request
Jul 5, 2026
…#68) * feat: add an Aspire sample host for local testing and as a setup demo Add a runnable example under samples/: - AndreGoepel.AppFoundation.Sample — a minimal Blazor Server host that wires the packages exactly as the README describes (AddAppFoundation / UseAppFoundation, App.razor, Routes.razor, MapAdditionalIdentityEndpoints). - AndreGoepel.AppFoundation.AppHost — a .NET Aspire orchestrator that starts PostgreSQL (with a data volume) and the web app, wiring the appfoundation-database connection string. Run with: dotnet run --project samples/AndreGoepel.AppFoundation.AppHost. The AppHost opts out of central package management and lock files because the Aspire SDK injects RID-specific packages that aren't portable across OSes (would break CI locked-mode restore); the sample keeps a portable lock file. Both are IsPackable=false. Adds a "Try it locally" README section and points .aspire/settings.json at the in-repo AppHost. * fix(sample): enable global interactivity so the shell menus work The management layout (MainLayout) carries interactive click handlers — the sidebar toggle, profile menu, and the RadzenPanelMenu in NavMenu. A layout is rendered statically under per-page interactivity, so those handlers never wired up and the menus appeared dead ("js not working"). Apply the render mode globally on <Routes> and <HeadOutlet> so the layout is interactive. Verified this does not conflict with the foundation's per-page @rendermode InteractiveServer pages (a matching descendant render mode is allowed). * chore(sample): sync lockfile to identity 1.2.0-preview1 (stacked on #67) * update aspire packages * fix(sample): align Aspire.Hosting.AppHost to 13.4.6 with the SDK * fix(sample): opt the web sample out of lock files (runtime-tied asset drift) * style(sample): apply csharpier formatting to the sample csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Surfaces
marten-identity's new registration / two-factor / passkey feature flags to AppFoundation host apps.What
AppFoundationOptions.ConfigureIdentity— a passthroughAction<MartenIdentityBlazorOptions>forwarded toAddMartenIdentityBlazor. A consuming app toggles the login features (and any other identity UI option) fromAddAppFoundation:Enforcement:
UseAppFoundationnow wiresUseMartenIdentityFeatureGate(), so a disabled feature's pages and endpoints return 404 / redirect — unreachable by direct URL, not merely hidden.Shell UI: the management
NavMenuhides the Two-factor authentication and Passkeys entries when those features are disabled (registration has no app-foundation menu entry — the identity Login page owns that link).Defaults are unchanged: all three features remain enabled unless a host opts out.
Dependency
Bumps
AndreGoepel.Marten.Identity.Blazorto 1.2.0-preview1, which introduces the feature-flag API (MartenIdentityBlazorOptions.Enable*,IIdentityFeatureProvider,UseMartenIdentityFeatureGate). Continues @andregoepel's in-progress version bump onmain.marten-identity1.2.0 final is published and this is bumped off the preview.Tests
AddAppFoundationIdentityTests:ConfigureIdentityflows through to the resolvedMartenIdentityBlazorOptions; without it, the full feature set stays enabled.Verification
dotnet restore --locked-mode— clean (lock files updated to 1.2.0-preview1).dotnet build -c Release— 0 errors;dotnet test -c Release— 82/82.Note for the host (andregoepel.dev)
A host that wants a persistent, admin-editable toggle (rather than config-time) can register its own
IIdentityFeatureProvider— the defaultOptionsIdentityFeatureProviderisTryAdd-registered, so a host implementation takes precedence.