StorageClientProvider
LegacyStorageProvider implementation that sources and cleans up legacy authenticator data via a ForgeRock StorageClient.
This is the default provider used by AuthMigration when no custom LegacyStorageProvider is configured in LegacyAuthenticationConfig. It delegates data reading to LegacyDataConverter.convertToLegacyExportedData and removes accounts and mechanisms directly through the StorageClient API during cleanup.
Parameters
The Android application context, used to initialize the default org.forgerock.android.auth.DefaultStorageClient when no custom storageClient is provided.
The ForgeRock StorageClient that holds legacy accounts and mechanisms. Defaults to DefaultStorageClient(context), which reads from the standard legacy encrypted SharedPreferences used by the FR Authenticator SDK.
Example — default usage (no configuration needed)
lifecycleScope.launch {
AuthMigration.start(applicationContext)
}Example — custom StorageClient
lifecycleScope.launch {
AuthMigration.start(applicationContext) {
legacyStorageProvider = StorageClientProvider(
context = applicationContext,
storageClient = MyCustomStorageClient(applicationContext)
)
}
}Example — backup before cleanup (via LegacyAuthenticationConfig)
lifecycleScope.launch {
AuthMigration.start(applicationContext) {
backup = { ctx -> MyBackupHelper.backup(ctx) }
}
}See also
Inheritors
Functions
Converts all accounts and mechanisms held by the storageClient into a LegacyExportedData object ready for the migration pipeline.
Returns true if the storageClient contains at least one legacy account, indicating that migration is required.