Skip to main content

Feature flags

:::info Status Outline — expand with a full worked example (e.g. adding a new flag and gating a page behind it). :::

Feature flags use Microsoft.FeatureManagement, registered on both planes:

  • Server: Kandra.Application.ConfigureServices.AddKandraApplication() calls AddFeatureManagement(), config-driven via the "FeatureManagement" appsettings section.
  • Login-time: LoginService evaluates every enabled flag and stamps a feature claim per name into the JWT at login/refresh — optionally filtered by an unregistered-by-default IClientFeatureFilter hook, to keep server-only flags off the client token.
  • Client: JwtFeatureDefinitionProvider (Kandra.ClientLib.Common) reads those claims back off IAuthenticationContext, registered via services.Replace(...) — the same TryAdd-vs-order-independence reasoning as the localization chain.

There's no declarative UI-gating attribute yet — Blazor code calls IFeatureManager.IsEnabledAsync(...) directly wherever a page needs to check a flag.

See also