Commit 205f0e16 authored by Rakesh Soma's avatar Rakesh Soma Committed by Commit Bot

Make gcpw default cred provider

Bug: 1066560
Change-Id: Icb6ae8ffc1cd5e4c7884e1984b584aa1f301433d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2130180
Commit-Queue: Rakesh Soma <rakeshsoma@google.com>
Reviewed-by: default avatarYusuf Sengul <yusufsn@google.com>
Cr-Commit-Position: refs/heads/master@{#755422}
parent 2b4e5746
......@@ -35,6 +35,7 @@ source_set("common") {
public_configs = [ ":common_config" ]
public_deps = [ "//chrome/credential_provider/common:common_constants" ]
deps = [
":gaia_credential_provider_idl",
":string_resources",
"//base",
"//build:branding_buildflags",
......
......@@ -14,6 +14,7 @@
#include "base/win/win_util.h"
#include "build/branding_buildflags.h"
#include "chrome/credential_provider/common/gcp_strings.h"
#include "chrome/credential_provider/gaiacp/gaia_credential_provider_i.h"
#include "chrome/credential_provider/gaiacp/logging.h"
namespace credential_provider {
......@@ -48,6 +49,15 @@ constexpr wchar_t kAccountPicturesRootRegKey[] =
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AccountPicture\\Users";
constexpr wchar_t kImageRegKey[] = L"Image";
// Registry entry that controls whether GCPW is the default
// Credential Provider or not.
constexpr wchar_t kMakeGcpwDefaultCredProvider[] = L"set_gcpw_as_default_cp";
// Windows OS defined registry entry used to configure the
// default credential provider CLSID.
constexpr wchar_t kDefaultCredProviderPath[] =
L"Software\\Policies\\Microsoft\\Windows\\System";
constexpr wchar_t kDefaultCredProviderKey[] = L"DefaultCredentialProvider";
HRESULT SetMachineRegDWORD(const base::string16& key_name,
const base::string16& name,
DWORD value) {
......@@ -96,6 +106,15 @@ base::string16 GetAccountPictureRegPathForUSer(const base::string16& user_sid) {
} // namespace
HRESULT MakeGcpwDefaultCP() {
if (GetGlobalFlagOrDefault(kMakeGcpwDefaultCredProvider, 1))
return SetMachineRegString(
kDefaultCredProviderPath, kDefaultCredProviderKey,
base::win::String16FromGUID(CLSID_GaiaCredentialProvider));
return S_OK;
}
HRESULT GetMachineRegDWORD(const base::string16& key_name,
const base::string16& name,
DWORD* value) {
......
......@@ -156,6 +156,9 @@ HRESULT GetMachineGuid(base::string16* machine_guid);
// Sets HKLM\SOFTWARE\Microsoft\Cryptography\MachineGuid registry for testing.
HRESULT SetMachineGuidForTesting(const base::string16& machine_guid);
// Set corresponding registry entry that would make GCPW as the default
// credential provider.
HRESULT MakeGcpwDefaultCP();
} // namespace credential_provider
#endif // CHROME_CREDENTIAL_PROVIDER_GAIACP_REG_UTILS_H_
......@@ -45,6 +45,7 @@
using credential_provider::GetGlobalFlagOrDefault;
using credential_provider::kRegEnableVerboseLogging;
using credential_provider::MakeGcpwDefaultCP;
using credential_provider::putHR;
namespace {
......@@ -101,6 +102,9 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
if (GetGlobalFlagOrDefault(kRegEnableVerboseLogging, 1))
logging::SetMinLogLevel(logging::LOG_VERBOSE);
// Set GCPW as the default credential provider for the end user.
MakeGcpwDefaultCP();
if (cmdline->HasSwitch(switches::kLoggingLevel)) {
std::string log_level =
cmdline->GetSwitchValueASCII(switches::kLoggingLevel);
......
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