diff --git a/mobile/android/geckoview/build.gradle b/mobile/android/geckoview/build.gradle index c47f4cfe6e47..b7b3d68701fc 100644 --- a/mobile/android/geckoview/build.gradle +++ b/mobile/android/geckoview/build.gradle @@ -220,7 +220,7 @@ dependencies { implementation libs.androidx.core implementation libs.androidx.lifecycle.common implementation libs.androidx.lifecycle.process - implementation libs.play.services.fido + implementation "org.microg.gms:play-services-fido:0.3.13.250932" implementation "org.yaml:snakeyaml:2.2" if (mozconfig.substs.MOZ_ANDROID_HLS_SUPPORT) { diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebAuthnTokenManager.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebAuthnTokenManager.java index 2eea4c6af176..7cf1f3a3e1ff 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebAuthnTokenManager.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebAuthnTokenManager.java @@ -195,27 +195,14 @@ import org.mozilla.gecko.util.WebAuthnUtils; final Task intentTask; - if (BuildConfig.MOZILLA_OFFICIAL) { - // Certain Fenix builds and signing keys are whitelisted for Web Authentication. - // See https://wiki.mozilla.org/Security/Web_Authentication - // - // Third party apps will need to get whitelisted themselves. - final Fido2PrivilegedApiClient fidoClient = - Fido.getFido2PrivilegedApiClient(GeckoAppShell.getApplicationContext()); - - intentTask = fidoClient.getRegisterPendingIntent(browserOptions); - } else { - // For non-official builds, websites have to opt-in to permit the - // particular version of Gecko to perform WebAuthn operations on - // them. See https://developers.google.com/digital-asset-links - // for the general form, and Step 1 of - // https://developers.google.com/identity/fido/android/native-apps - // for details about doing this correctly for the FIDO2 API. - final Fido2ApiClient fidoClient = - Fido.getFido2ApiClient(GeckoAppShell.getApplicationContext()); - - intentTask = fidoClient.getRegisterPendingIntent(requestOptions); - } + // The privileged FIDO2 API normally is restricted to apps with package + // names and signatures that Google knows to be a browser. microG does not + // have such a list, instead it asks the user to confirm that the app doing + // the request is indeed a browser app (only for the first request from + // that app). + final Fido2PrivilegedApiClient fidoClient = + Fido.getFido2PrivilegedApiClient(GeckoAppShell.getApplicationContext()); + intentTask = fidoClient.getRegisterPendingIntent(browserOptions); intentTask.addOnSuccessListener( pendingIntent -> { @@ -428,19 +415,12 @@ import org.mozilla.gecko.util.WebAuthnUtils; .build(); final Task intentTask; - // See the makeCredential method for documentation about this - // conditional. - if (BuildConfig.MOZILLA_OFFICIAL) { - final Fido2PrivilegedApiClient fidoClient = - Fido.getFido2PrivilegedApiClient(GeckoAppShell.getApplicationContext()); - - intentTask = fidoClient.getSignPendingIntent(browserOptions); - } else { - final Fido2ApiClient fidoClient = - Fido.getFido2ApiClient(GeckoAppShell.getApplicationContext()); + // See the makeCredential method for documentation about the FIDO2 API and + // microG. + final Fido2PrivilegedApiClient fidoClient = + Fido.getFido2PrivilegedApiClient(GeckoAppShell.getApplicationContext()); - intentTask = fidoClient.getSignPendingIntent(requestOptions); - } + intentTask = fidoClient.getSignPendingIntent(browserOptions); intentTask.addOnSuccessListener( pendingIntent -> { @@ -574,15 +554,9 @@ import org.mozilla.gecko.util.WebAuthnUtils; @WrapForJNI(calledFrom = "gecko") private static GeckoResult webAuthnIsUserVerifyingPlatformAuthenticatorAvailable() { final Task task; - if (BuildConfig.MOZILLA_OFFICIAL) { - final Fido2PrivilegedApiClient fidoClient = - Fido.getFido2PrivilegedApiClient(GeckoAppShell.getApplicationContext()); - task = fidoClient.isUserVerifyingPlatformAuthenticatorAvailable(); - } else { - final Fido2ApiClient fidoClient = - Fido.getFido2ApiClient(GeckoAppShell.getApplicationContext()); - task = fidoClient.isUserVerifyingPlatformAuthenticatorAvailable(); - } + final Fido2PrivilegedApiClient fidoClient = + Fido.getFido2PrivilegedApiClient(GeckoAppShell.getApplicationContext()); + task = fidoClient.isUserVerifyingPlatformAuthenticatorAvailable(); final GeckoResult res = new GeckoResult<>(); task.addOnSuccessListener(