DpopMigrationManager
Headless helper that upgrades a user's Bearer refresh token to a DPoP-bound one when needed.
This class has no UI. It decides whether a migration is needed, runs upgradeToDPoP and reports an Outcome. Note that the SDK itself presents TokenMigrationActivity while the upgrade runs. Apps that want their own "securing your session" screen can use isMigrationNeeded to decide whether to show it.
The account's token type (DPoPKeyManager.isDPoPTokenType) is the single source of truth: nothing is persisted by this class. On failure the user is left on their existing session and the next call retries.
Contract:
Every call completes exactly once, on the main thread (the SDK's own callbacks may arrive on a background thread).
Concurrent calls for the same user share a single upgrade. This matters because an activity's
onResumefires again whenTokenMigrationActivityfinishes.Outcome.Migrated is reported only if the upgraded account's token type is DPoP; otherwise Outcome.Failed with REASON_NOT_DPOP_BOUND.
If the SDK never reports back (for example the user backs out of
TokenMigrationActivity), all waiting callers get Outcome.Failed once the timeout elapses and the next call may start a new upgrade. A late success from the timed-out upgrade is still honored: it completes any upgrade that was started since for the same user.
Logcat: adb logcat -s DPoPMigration
Types
Properties
Default time to wait for the SDK to report a result, in milliseconds.
Reason carried by Outcome.Failed when the upgrade completed without a DPoP-bound token.
Reason carried by Outcome.Failed when the timeout elapses.
Functions
Cheap, side-effect free check: would migrateIfNeeded start (or join) an upgrade now? Returns true while an upgrade is already in flight for user, so UI shown for it stays up. Safe to call from any thread; the result is only a snapshot.
Upgrades user (default: the current user) to a DPoP-bound refresh token if needed.
Callback flavor of migrateIfNeeded for Java callers. callback is invoked once on the main thread.