Class PlatformAdminBootstrap
- Namespace
- KadicAuth.Api.Infrastructure
- Assembly
- KadicAuth.Api.dll
One-time bootstrap of the very first platform admin at application startup.
Rules:
- Reads
Platform:BootstrapAdminUserIdfrom configuration. - Runs ONLY when
Platform:EnableBootstrapis true (false by default). In production, leave it false and grant the first admin manually via SQL on the day of deployment. - Idempotent: if ANY active platform admin already exists, it does nothing. You cannot use this to add a second admin — that's what the controller is for.
- Never throws on misconfiguration. Logs and moves on, so a missing or invalid value cannot take down the API.
public sealed class PlatformAdminBootstrap
- Inheritance
-
objectPlatformAdminBootstrap
Constructors
PlatformAdminBootstrap(IPlatformAdminService, IConfiguration, ILogger<PlatformAdminBootstrap>)
public PlatformAdminBootstrap(IPlatformAdminService service, IConfiguration configuration, ILogger<PlatformAdminBootstrap> logger)
Parameters
serviceIPlatformAdminServiceconfigurationIConfigurationloggerILogger<PlatformAdminBootstrap>
Methods
EnsureBootstrapAdminAsync(CancellationToken)
public Task EnsureBootstrapAdminAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
- Task