BaseMfaClient

abstract class BaseMfaClient(val config: MfaConfiguration, val storage: MfaStorage? = null) : MfaClient

Base abstract class for MFA client implementations. This class provides common functionality for all MFA clients.

Parameters

config

The configuration for this MFA client.

storage

The storage implementation to use. If null, no storage will be used.

Constructors

Link copied to clipboard
constructor(config: MfaConfiguration, storage: MfaStorage? = null)

Properties

Link copied to clipboard
override val config: MfaConfiguration
Link copied to clipboard
lateinit var httpClient: HttpClient

HTTP client for making network requests.

Link copied to clipboard
protected var isInitialized: Boolean

Flag indicating whether this client has been initialized.

Link copied to clipboard

Logger instance for logging messages. This can be overridden by subclasses to use a different logger.

Link copied to clipboard
protected val storage: MfaStorage? = null

Functions

Link copied to clipboard
protected fun checkInitialized()

Check if the client is initialized and throw an exception if it's not.

Link copied to clipboard
open suspend override fun close()

Clean up resources used by the MFA client. This method closes the storage client, http client, and performs any additional cleanup.

Link copied to clipboard
protected fun initHttp(timeout: Duration)

Initializes the HTTP client for making network requests. This method is called by initializeClient of the client implementation.

Link copied to clipboard
open suspend override fun initialize()

Initialize the MFA client with the given configuration. This method initializes the storage client if one is provided.

Link copied to clipboard
protected abstract suspend fun initializeClient()

Additional initialization for specific client implementations. This method is called by initialize after the storage client is initialized. Subclasses should override this method to perform additional initialization.