Commit 6f93f843 authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

[iOS][Biometric-Auth] Don't prefill passwords when reauth is required

Adds a new WaitForUsernameReason to stop prefilling passwords when
EnableAutofillPasswordReauthIOS is enabled. The decision is made on
PasswordManagerClient::RequiresReauthToFill and overridden in
IOSChromePasswordManagerClient.

Bug: 1113119
Change-Id: Ic8cd1f1cc6e544502e2b6c1c5d9e9b10027bedb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339746
Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795881}
parent 0c7f2b4e
...@@ -170,7 +170,9 @@ LikelyFormFilling SendFillInformationToRenderer( ...@@ -170,7 +170,9 @@ LikelyFormFilling SendFillInformationToRenderer(
PasswordFormMetricsRecorder::WaitForUsernameReason; PasswordFormMetricsRecorder::WaitForUsernameReason;
WaitForUsernameReason wait_for_username_reason = WaitForUsernameReason wait_for_username_reason =
WaitForUsernameReason::kDontWait; WaitForUsernameReason::kDontWait;
if (client->IsIncognito()) { if (client->RequiresReauthToFill()) {
wait_for_username_reason = WaitForUsernameReason::kReauthRequired;
} else if (client->IsIncognito()) {
wait_for_username_reason = WaitForUsernameReason::kIncognitoMode; wait_for_username_reason = WaitForUsernameReason::kIncognitoMode;
} else if (preferred_match->is_public_suffix_match) { } else if (preferred_match->is_public_suffix_match) {
wait_for_username_reason = WaitForUsernameReason::kPublicSuffixMatch; wait_for_username_reason = WaitForUsernameReason::kPublicSuffixMatch;
......
...@@ -204,6 +204,9 @@ class PasswordFormMetricsRecorder ...@@ -204,6 +204,9 @@ class PasswordFormMetricsRecorder
// credentials on page load but to wait for the user to confirm the credential // credentials on page load but to wait for the user to confirm the credential
// to be filled. This decision is only recorded for the first time, the // to be filled. This decision is only recorded for the first time, the
// browser informs the renderer about credentials for a given form. // browser informs the renderer about credentials for a given form.
//
// Needs to stay in sync with PasswordManagerFirstWaitForUsernameReason in
// enums.xml.
enum class WaitForUsernameReason { enum class WaitForUsernameReason {
// Credentials may be filled on page load. // Credentials may be filled on page load.
kDontWait = 0, kDontWait = 0,
...@@ -221,7 +224,9 @@ class PasswordFormMetricsRecorder ...@@ -221,7 +224,9 @@ class PasswordFormMetricsRecorder
kTouchToFill = 5, kTouchToFill = 5,
// Show suggestion on account selection feature is enabled. // Show suggestion on account selection feature is enabled.
kFoasFeature = 6, kFoasFeature = 6,
kMaxValue = kFoasFeature, // Re-authenticaion for filling passwords is required.
kReauthRequired = 7,
kMaxValue = kReauthRequired,
}; };
// This metric records the user experience with the passwords filling. The // This metric records the user experience with the passwords filling. The
......
...@@ -25,6 +25,10 @@ bool PasswordManagerClient::IsFillingFallbackEnabled(const GURL& url) const { ...@@ -25,6 +25,10 @@ bool PasswordManagerClient::IsFillingFallbackEnabled(const GURL& url) const {
return true; return true;
} }
bool PasswordManagerClient::RequiresReauthToFill() {
return false;
}
void PasswordManagerClient::ShowTouchToFill(PasswordManagerDriver* driver) {} void PasswordManagerClient::ShowTouchToFill(PasswordManagerDriver* driver) {}
BiometricAuthenticator* PasswordManagerClient::GetBiometricAuthenticator() { BiometricAuthenticator* PasswordManagerClient::GetBiometricAuthenticator() {
......
...@@ -173,6 +173,10 @@ class PasswordManagerClient { ...@@ -173,6 +173,10 @@ class PasswordManagerClient {
const url::Origin& origin, const url::Origin& origin,
const CredentialsCallback& callback) = 0; const CredentialsCallback& callback) = 0;
// Indicates if re-auth with the device is needed before filling passwords.
// Currently only used by iOS.
virtual bool RequiresReauthToFill();
// Instructs the client to show the Touch To Fill UI. // Instructs the client to show the Touch To Fill UI.
virtual void ShowTouchToFill(PasswordManagerDriver* driver); virtual void ShowTouchToFill(PasswordManagerDriver* driver);
......
...@@ -85,6 +85,7 @@ source_set("passwords") { ...@@ -85,6 +85,7 @@ source_set("passwords") {
"//ios/chrome/browser/ssl", "//ios/chrome/browser/ssl",
"//ios/chrome/browser/sync/glue", "//ios/chrome/browser/sync/glue",
"//ios/chrome/browser/translate:translate", "//ios/chrome/browser/translate:translate",
"//ios/chrome/browser/ui:feature_flags",
"//ios/chrome/browser/ui/alert_coordinator", "//ios/chrome/browser/ui/alert_coordinator",
"//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/elements", "//ios/chrome/browser/ui/elements",
......
...@@ -58,6 +58,7 @@ class IOSChromePasswordManagerClient ...@@ -58,6 +58,7 @@ class IOSChromePasswordManagerClient
void PromptUserToMovePasswordToAccount( void PromptUserToMovePasswordToAccount(
std::unique_ptr<password_manager::PasswordFormManagerForUI> form_to_move) std::unique_ptr<password_manager::PasswordFormManagerForUI> form_to_move)
override; override;
bool RequiresReauthToFill() override;
bool ShowOnboarding( bool ShowOnboarding(
std::unique_ptr<password_manager::PasswordFormManagerForUI> form_to_save) std::unique_ptr<password_manager::PasswordFormManagerForUI> form_to_save)
override; override;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "ios/chrome/browser/sync/profile_sync_service_factory.h" #include "ios/chrome/browser/sync/profile_sync_service_factory.h"
#include "ios/chrome/browser/system_flags.h" #include "ios/chrome/browser/system_flags.h"
#include "ios/chrome/browser/translate/chrome_ios_translate_client.h" #include "ios/chrome/browser/translate/chrome_ios_translate_client.h"
#import "ios/chrome/browser/ui/ui_feature_flags.h"
#include "net/cert/cert_status_flags.h" #include "net/cert/cert_status_flags.h"
#include "services/metrics/public/cpp/ukm_recorder.h" #include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
...@@ -114,6 +115,10 @@ void IOSChromePasswordManagerClient::PromptUserToMovePasswordToAccount( ...@@ -114,6 +115,10 @@ void IOSChromePasswordManagerClient::PromptUserToMovePasswordToAccount(
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
bool IOSChromePasswordManagerClient::RequiresReauthToFill() {
return base::FeatureList::IsEnabled(kEnableAutofillPasswordReauthIOS);
}
bool IOSChromePasswordManagerClient::ShowOnboarding( bool IOSChromePasswordManagerClient::ShowOnboarding(
std::unique_ptr<password_manager::PasswordFormManagerForUI> form_to_save) { std::unique_ptr<password_manager::PasswordFormManagerForUI> form_to_save) {
return false; return false;
......
...@@ -54326,6 +54326,9 @@ Called by update_net_trust_anchors.py.--> ...@@ -54326,6 +54326,9 @@ Called by update_net_trust_anchors.py.-->
<int value="6" label="Fill On Select"> <int value="6" label="Fill On Select">
User is browsing with the Fill On Select feature enabled. User is browsing with the Fill On Select feature enabled.
</int> </int>
<int value="7" label="Reauth required">
Re-authenticaion for filling passwords is required.
</int>
</enum> </enum>
<enum name="PasswordManagerHttpCredentialType"> <enum name="PasswordManagerHttpCredentialType">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment