0

[gaia] Read OAuth2 client secret and ID from gaia config

This CL adds an option of overriding OAauth2 client secret and ID via
gaia config that was introduced in https://crrev.com/c/2166197.

Gaia config makes switching between different Gaia environments easier.
Changing OAuth2 client secret and ID should be a part of this.

OAuth2 client parameters are set in google_api_keys.cc. In order to
access the gaia config from that file, gaia config has been moved into
a separate singleton class GaiaConfig. This class is used by both
google_api_keys.cc and gaia_urls.cc.

Skipping presubmit because google_api_keys_unittest.cc includes
non-header files. This triggers a presubmit error.

NOPRESUBMIT=true

Bug: 1072731
Change-Id: Iaf7e1342d1d4c31f627ff62fe3422059d9593642
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2245486
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
Commit-Queue: Alex Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785368}
This commit is contained in:
Alex Ilin
2020-07-06 14:28:55 +00:00
committed by Commit Bot
parent f73405748c
commit 9ac2a9c49b
11 changed files with 378 additions and 146 deletions

@ -24,11 +24,17 @@
// https://developers.google.com/console/help/ and
// https://developers.google.com/console/.
//
// The keys must either be provided using preprocessor variables (set
// via e.g. ~/.gyp/include.gypi). Alternatively, in Chromium builds, they can be
// overridden at runtime using environment variables of the same name.
// Environment variable overrides will be ignored for official Google Chrome
// builds.
// The keys must either be provided using preprocessor variables (set via e.g.
// GN args). Alternatively, they can be overridden at runtime using one of the
// following methods (in priority order):
// - Command line parameters (only for GOOGLE_CLIENT_ID_MAIN and
// GOOGLE_CLIENT_SECRET_MAIN values). The command-line parameters are
// --oauth2-client-id and --oauth2-client-secret.
// - Config file entry of the same name. Path to a config file is set via the
// --gaia-config command line parameter. See google_apis/gaia/gaia_config.h
// for syntax reference.
// - Environment variables of the same name. Environment variable overrides will
// be ignored for official Google Chrome builds.
//
// The names of the preprocessor variables (or environment variables
// to override them at runtime in Chromium builds) are as follows:
@ -45,11 +51,6 @@
// (e.g. GOOGLE_CLIENT_SECRET_CLOUD_PRINT, i.e. one for each item in
// the OAuth2Client enumeration below)
//
// The GOOGLE_CLIENT_ID_MAIN and GOOGLE_CLIENT_SECRET_MAIN values can
// also be set via the command line (this overrides any other
// setting). The command-line parameters are --oauth2-client-id and
// --oauth2-client-secret.
//
// If some of the parameters mentioned above are not provided,
// Chromium will still build and run, but services that require them
// may fail to work without warning. They should do so gracefully,