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

Unified Diff: components/password_manager/core/browser/affiliation_utils.h

Issue 767163005: Add AffiliationFetcher to fetch authoritative affiliation information regarding facets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/affiliation_utils.h
diff --git a/components/password_manager/core/browser/affiliation_utils.h b/components/password_manager/core/browser/affiliation_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..ce7b6d139aae4682e7f3cdbb06d7a43f692afc88
--- /dev/null
+++ b/components/password_manager/core/browser/affiliation_utils.h
@@ -0,0 +1,64 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file contains utility functions related to working with "facets".
+//
+// A "facet" is defined as the manifestation of a logical application on a given
+// platform. For example, "My Bank" may have released an Android application,
+// and a Web application accessible from a browser. These are all facets of the
+// "My Bank" logical application.
+//
+// Facets that belong to the same logical application are said to be affiliated
+// with each other. Conceptually, "affiliations" can be seen as an equivalence
+// relation defined over the set of all facets. Each equivalence class contains
+// facets that belong to the same logical application, and therefore should be
+// treated as synonymous for certain purposes, e.g., sharing credentials.
+//
+// A valid facet identifier will be of the form:
+//
+// * https://<host>[:<port>]/
+// For web sites. Only HTTPS sites are supported, and URI must not contain
+// components other than the scheme, host, and a port (which is optional).
+//
+// * android://<cert_hash>@<package_name>/
+// For Android applications. The <cert_hash> is the hash of the certificate
+// used to sign the APK, normally calculated as:
+// echo -n -e "$PEM_KEY" | \
+// openssl x509 -outform DER | \
+// openssl sha -sha512 -binary | base64 | tr '+/' '-_'
+
+#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_
+#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_
+
+#include <string>
+#include <vector>
+
+namespace password_manager {
+
+// A collection of facets affiliated with each other, i.e. an equivalence class.
+typedef std::vector<std::string> AffiliatedFacets;
+
+// The scheme used for identifying Android applications.
+extern const char kAndroidAppScheme[];
+
+// Returns whether or not the supplied |uri| is a valid facet identifier.
+bool IsValidFacetURI(const std::string& uri);
+
+// Returns whether or not the supplied |uri| is a valid facet identifier that
+// refers to a web site.
+bool IsValidWebFacetURI(const std::string& uri);
+
+// Returns whether or not the supplied |uri| is a valid facet identifier that
+// refers to an Android app. Note that Chrome currently does not need to parse
+// these URIs, so this function only checks that the expected components are
+// present and will not actually verify their inner format.
+bool IsValidAndroidFacetURI(const std::string& uri);
+
+// Returns whether or not equivalence classes |a| and |b| are equal.
+bool AreEquivalenceClassesEqual(const AffiliatedFacets& a,
+ const AffiliatedFacets& b);
+
+} // namespace password_manager
+
+#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698