Class SeedAdminPasswordHostedService

Assembly: redb.Identity.Core.dll

Startup seeder that ensures the well-known admin user from the base
redb SQL seed (_users.id = 1, login = "admin", empty password)
has a usable password on a fresh install. Behaviour:
Resolves through a transient scope.Looks up user by .If the user is missing → no-op.If the user has a stored password other than the documented default
admin → no-op with one log line: that password belongs to the operator
(set via the Tsak dashboard, bootstrap-admin or the management API).If the stored password is empty, or is still the default admin
(a Tsak dashboard sharing the database writes admin/admin before this
listener runs), hashes via the
configured chain and
persists it via .
Always logs a loud WARNING on startup when the configured password is
the documented default admin, regardless of whether a write was needed.

Implemented as an hooked into
rather than an
IHostedService because Tsak hosts modules without a generic IHost;
route-context lifecycle hooks are the canonical startup extension point and
fire on every cold-start AND on every hot-reload of the .tpkg module.

public sealed class SeedAdminPasswordHostedService : IRouteLifecycleListener

Inheritance

Object→SeedAdminPasswordHostedService

Implements

Methods

OnContextStarting(IRouteContext, CancellationToken)

Fired before the context starts compiling and starting routes.

public Task OnContextStarting(IRouteContext context, CancellationToken cancellationToken)

Constructors