StorageClientProvider
Parameters
context
The Android application context, used to initialize the default org.forgerock.android.auth.DefaultStorageClient when no custom storageClient is provided.
storageClient
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)
}Content copied to clipboard
Example — custom StorageClient
lifecycleScope.launch {
AuthMigration.start(applicationContext) {
legacyStorageProvider = StorageClientProvider(
context = applicationContext,
storageClient = MyCustomStorageClient(applicationContext)
)
}
}Content copied to clipboard
Example — backup before cleanup (via LegacyAuthenticationConfig)
lifecycleScope.launch {
AuthMigration.start(applicationContext) {
backup = { ctx -> MyBackupHelper.backup(ctx) }
}
}Content copied to clipboard