Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Unified Diff: components/password_manager/core/browser/test_password_store.cc

Issue 2816033002: Fix retrieving federated credentials for the password store for localhost. (Closed)
Patch Set: comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/test_password_store.cc
diff --git a/components/password_manager/core/browser/test_password_store.cc b/components/password_manager/core/browser/test_password_store.cc
index efd3aecd98e76b935d998da7c7bd84430f733e2e..6ab4b775e259608020544a71eca654bc80e4631d 100644
--- a/components/password_manager/core/browser/test_password_store.cc
+++ b/components/password_manager/core/browser/test_password_store.cc
@@ -86,17 +86,26 @@ std::vector<std::unique_ptr<autofill::PasswordForm>>
TestPasswordStore::FillMatchingLogins(const FormDigest& form) {
std::vector<std::unique_ptr<autofill::PasswordForm>> matched_forms;
for (const auto& elements : stored_passwords_) {
+ // The code below doesn't support PSL federated credential. It's doable but
+ // no test need it so far.
vabr (Chromium) 2017/04/13 18:12:09 minor nit: "no test needs" or "no tests need"
const bool realm_matches = elements.first == form.signon_realm;
const bool realm_psl_matches =
IsPublicSuffixDomainMatch(elements.first, form.signon_realm);
if (realm_matches || realm_psl_matches ||
(form.scheme == autofill::PasswordForm::SCHEME_HTML &&
- password_manager::IsFederatedMatch(elements.first, form.origin))) {
+ password_manager::IsFederatedRealm(elements.first, form.origin))) {
const bool is_psl = !realm_matches && realm_psl_matches;
for (const auto& stored_form : elements.second) {
- matched_forms.push_back(
- base::MakeUnique<autofill::PasswordForm>(stored_form));
- matched_forms.back()->is_public_suffix_match = is_psl;
+ // Repeat the condition above with an additional check for origin.
+ if (realm_matches || realm_psl_matches ||
+ (form.scheme == autofill::PasswordForm::SCHEME_HTML &&
+ stored_form.origin.GetOrigin() == form.origin.GetOrigin() &&
+ password_manager::IsFederatedRealm(stored_form.signon_realm,
+ form.origin))) {
+ matched_forms.push_back(
+ base::MakeUnique<autofill::PasswordForm>(stored_form));
+ matched_forms.back()->is_public_suffix_match = is_psl;
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698