feat(tenants): personalise seeded user credentials for a brand-new tenant

Adds TenantInitialUserProvisioner: right after the very first Liquibase
migration of a tenant that was never on Flyway, renames the three
seeded users (ids 1-3, otherwise shipping as mifos/system/interopUser
with the public default password) to <tenantIdentifier>_admin/_system/
_interop, with a password from fineract.tenant.initial-user-password
or a built-in default. An existing (Flyway-era) tenant already has its
real users and is left untouched. Wired through TenantDatabaseUpgradeService
and its two test configurations.

Also fixes the two pooled interest-posting services' system-user
lookup, which read username = 'system' — now wrong since that username
is personalised per tenant — to find the seeded system user by its
fixed id (2) instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 22:41:25 +05:30
co-authored by Claude Sonnet 5
parent 1a914a3de0
commit 3d3ce92e93
6 changed files with 104 additions and 6 deletions
@@ -159,7 +159,9 @@ public class TestConfiguration {
FineractProperties fineractProperties, Environment environment,
List<CustomTaskChange> customTaskChangesForDependencyInjection) {
return new TenantDatabaseUpgradeService(tenantDetailsService, tenantDataSource, fineractProperties, tenantDatabaseStateVerifier,
liquibaseFactory, tenantDataSourceFactory, environment, customTaskChangesForDependencyInjection);
liquibaseFactory, tenantDataSourceFactory, environment,
new org.apache.fineract.infrastructure.core.service.migration.TenantInitialUserProvisioner(environment),
customTaskChangesForDependencyInjection);
}
/**
@@ -189,6 +189,8 @@ public class LiquibaseStepDefinitions implements En {
.willReturn(tenantLiquibase);
tenantDatabaseUpgradeService = new TenantDatabaseUpgradeService(tenantDetailsService, tenantStoreDataSource, fineractProperties,
databaseStateVerifier, liquibaseFactory, tenantDataSourceFactory, environment, Arrays.asList(tenantPasswordEncryptor));
databaseStateVerifier, liquibaseFactory, tenantDataSourceFactory, environment,
new org.apache.fineract.infrastructure.core.service.migration.TenantInitialUserProvisioner(environment),
Arrays.asList(tenantPasswordEncryptor));
}
}