StorageClientProvider

constructor(context: Context, storageClient: StorageClient = DefaultStorageClient(context))

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)
}

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) }
}
}