TokenCredentialManager
Java-friendly token credential manager for JVM applications.
Provides blocking CRUD operations for credentials, wrapping the cross-platform KmpCredentialManager with AuthFoundationResult for Java interop.
Warning: All public methods use runBlocking internally. Do not call them from a coroutine or a thread that is part of a coroutine dispatcher — this will deadlock. For coroutine-based callers, use KmpCredentialManager directly.
Event listeners can be registered via addEventListener to receive credential lifecycle events.
Parameters
The OAuth2Client used for token operations.
The TokenStorage for persisting tokens.
Store for the default credential ID.
Optional predicate invoked when a storage operation throws. Return true to retry the failed operation once; return false (or omit) to rethrow. Example: e -> e instanceof java.sql.SQLException
Constructors
Functions
Registers a listener that is notified whenever a credential lifecycle event occurs.
Returns all stored credential IDs.
Deletes a credential by ID.
Returns all credentials whose TokenMetadata matches the given predicate.
Returns all credentials matching the given predicate.
Retrieves a credential by its ID.
Returns the default credential, or null if no default has been set.
Returns metadata for the credential with the specified ID.
Sets the default credential.
Updates metadata for an existing credential.
Stores a new credential with the given token data and optional tags.