From e90086a767650cd80da1b2c64b672249a66b6b66 Mon Sep 17 00:00:00 2001 From: Sai Venkat Desu Date: Mon, 22 Jul 2024 14:48:35 +0530 Subject: [PATCH] chore: added support for enabling biometrics even after initializing secure credentials manager --- .../storage/SecureCredentialsManager.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/auth0/src/main/java/com/auth0/android/authentication/storage/SecureCredentialsManager.kt b/auth0/src/main/java/com/auth0/android/authentication/storage/SecureCredentialsManager.kt index 51854633..a04d4ef1 100644 --- a/auth0/src/main/java/com/auth0/android/authentication/storage/SecureCredentialsManager.kt +++ b/auth0/src/main/java/com/auth0/android/authentication/storage/SecureCredentialsManager.kt @@ -31,8 +31,8 @@ public class SecureCredentialsManager @VisibleForTesting(otherwise = VisibleForT private val crypto: CryptoUtil, jwtDecoder: JWTDecoder, private val serialExecutor: Executor, - private val fragmentActivity: WeakReference? = null, - private val localAuthenticationOptions: LocalAuthenticationOptions? = null, + private var fragmentActivity: WeakReference? = null, + private var localAuthenticationOptions: LocalAuthenticationOptions? = null, private val localAuthenticationManagerFactory: LocalAuthenticationManagerFactory? = null, ) : BaseCredentialsManager(apiClient, storage, jwtDecoder) { private val gson: Gson = GsonProvider.gson @@ -59,7 +59,7 @@ public class SecureCredentialsManager @VisibleForTesting(otherwise = VisibleForT /** - * Creates a new SecureCredentialsManager to handle Credentials with Authentication + * Creates a new SecureCredentialsManager to handle Credentials with biometrics Authentication * * @param context a valid context * @param apiClient the Auth0 Authentication API Client to handle token refreshment when needed. @@ -84,6 +84,11 @@ public class SecureCredentialsManager @VisibleForTesting(otherwise = VisibleForT DefaultLocalAuthenticationManagerFactory() ) + public fun enableBiometrics(fragmentActivity: FragmentActivity, localAuthenticationOptions: LocalAuthenticationOptions) { + this.fragmentActivity = WeakReference(fragmentActivity) + this.localAuthenticationOptions = localAuthenticationOptions + } + /** * Saves the given credentials in the Storage. *