diff options
-rw-r--r-- | chrome/common/chrome_switches.cc | 10 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 2 | ||||
-rw-r--r-- | chrome/common/net/gaia/gaia_urls.cc | 29 |
3 files changed, 39 insertions, 2 deletions
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 308b85f..c47195f 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -693,6 +693,16 @@ const char kForceAppsPromoVisible[] = "force-apps-promo-visible"; // omitted. The default value is "www.google.com". const char kGaiaHost[] = "gaia-host"; +// Specifies the backend server used for OAuth authentication requests. +// The https:// prefix and the trailing slash should be +// omitted. The default value is "www.google.com". +const char kGaiaOAuthHost[] = "gaia-oauth-host"; + +// Specifies the path prefix for GAIA OAuth URLs. It should be used +// for testing in cases where authentication path prefix differs from the one +// used in production. +const char kGaiaOAuthUrlPath[] = "gaia-oauth-url-path"; + // Specifies the path prefix for GAIA authentication URL. It should be used // for testing in cases where authentication path prefix differs from the one // used in production. diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 91704a9..c2ccf9b 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -194,6 +194,8 @@ extern const char kFocusExistingTabOnOpen[]; extern const char kFirstRun[]; extern const char kForceAppsPromoVisible[]; extern const char kGaiaHost[]; +extern const char kGaiaOAuthHost[]; +extern const char kGaiaOAuthUrlPath[]; extern const char kGaiaUrlPath[]; extern const char kGaiaProfileInfo[]; extern const char kGoogleSearchDomainCheckURL[]; diff --git a/chrome/common/net/gaia/gaia_urls.cc b/chrome/common/net/gaia/gaia_urls.cc index 6580f37..f1ab109 100644 --- a/chrome/common/net/gaia/gaia_urls.cc +++ b/chrome/common/net/gaia/gaia_urls.cc @@ -12,6 +12,9 @@ namespace { // Gaia service constants const char kDefaultGaiaBaseUrl[] = "accounts.google.com"; +// Gaia service constants +const char kDefaultGaiaOAuthBaseUrl[] = "www.google.com"; + const char kCaptchaUrlPrefixSuffix[] = "/"; const char kClientLoginUrlSuffix[] = "/ClientLogin"; const char kServiceLoginUrlSuffix[] = "/ServiceLogin"; @@ -26,7 +29,8 @@ const char kOAuth1LoginUrlSuffix[] = "/OAuthLogin"; const char kOAuthRevokeTokenUrlSuffix[] = "/AuthSubRevokeToken"; // Federated login constants -const char kDefaultFederatedLoginBaseUrl[] = "https://www.google.com/accounts"; +const char kDefaultFederatedLoginHost[] = "www.google.com"; +const char kDefaultFederatedLoginPath[] = "/accounts"; const char kGetOAuthTokenUrlSuffix[] = "/o8/GetOAuthToken"; // OAuth2 client id for Google Chrome which is registered as an @@ -83,7 +87,28 @@ GaiaUrls::GaiaUrls() { merge_session_url_ = gaia_url_base + kMergeSessionUrlSuffix; // Federated login is not part of Gaia and has its own endpoints. - get_oauth_token_url_ = std::string(kDefaultFederatedLoginBaseUrl) + + std::string oauth_host_base; + if (command_line->HasSwitch(switches::kGaiaOAuthHost)) { + oauth_host_base = + command_line->GetSwitchValueASCII(switches::kGaiaOAuthHost); + } else { + oauth_host_base = kDefaultFederatedLoginHost; + } + + std::string gaia_oauth_url_base = "https://"+oauth_host_base; + if (command_line->HasSwitch(switches::kGaiaOAuthUrlPath)) { + std::string path = + command_line->GetSwitchValueASCII(switches::kGaiaOAuthUrlPath); + if (!path.empty()) { + if (path[0] != '/') + gaia_oauth_url_base.append("/"); + + gaia_oauth_url_base.append(path); + } + } else { + gaia_oauth_url_base.append(kDefaultFederatedLoginPath); + } + get_oauth_token_url_ = gaia_oauth_url_base + kGetOAuthTokenUrlSuffix; oauth_get_access_token_url_ = gaia_url_base + |