summaryrefslogtreecommitdiffstats
path: root/chrome/common/net
diff options
context:
space:
mode:
authorjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-20 01:22:57 +0000
committerjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-20 01:22:57 +0000
commit4d69b8a5008aded9ac43d2861b63c379fdad461f (patch)
treec50aaae414cd7d1d891f0a167701cad2ee95b05d /chrome/common/net
parent6a498ea5ce42dac982a317d07c6f08c15ab70b73 (diff)
downloadchromium_src-4d69b8a5008aded9ac43d2861b63c379fdad461f.zip
chromium_src-4d69b8a5008aded9ac43d2861b63c379fdad461f.tar.gz
chromium_src-4d69b8a5008aded9ac43d2861b63c379fdad461f.tar.bz2
Moved static Gaia OAuth URLs to GaiaUrls.
The 'gaiaOrigin' parameter is used by a chromium-os extension. The corresponding CL is at http://gerrit.chromium.org/gerrit/#change,7909 BUG=chromium-os:20491 TEST=Everything still works; --gaia-host also applies to oauth urls Review URL: http://codereview.chromium.org/7931009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101886 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/net')
-rw-r--r--chrome/common/net/gaia/gaia_urls.cc70
-rw-r--r--chrome/common/net/gaia/gaia_urls.h21
2 files changed, 82 insertions, 9 deletions
diff --git a/chrome/common/net/gaia/gaia_urls.cc b/chrome/common/net/gaia/gaia_urls.cc
index ca06741..70409ad 100644
--- a/chrome/common/net/gaia/gaia_urls.cc
+++ b/chrome/common/net/gaia/gaia_urls.cc
@@ -10,6 +10,7 @@
namespace {
const char kDefaultGaiaBaseUrl[] = "www.google.com";
+
const char kCaptchaUrlPrefixSuffix[] = "/accounts/";
const char kClientLoginUrlSuffix[] = "/accounts/ClientLogin";
const char kIssueAuthTokenUrlSuffix[] = "/accounts/IssueAuthToken";
@@ -17,6 +18,11 @@ const char kGetUserInfoUrlSuffix[] = "/accounts/GetUserInfo";
const char kTokenAuthUrlSuffix[] = "/accounts/TokenAuth";
const char kMergeSessionUrlSuffix[] = "/accounts/MergeSession";
+const char kGetOAuthTokenUrlSuffix[] = "/accounts/o8/GetOAuthToken";
+const char kOAuthGetAccessTokenUrlSuffix[] = "/accounts/OAuthGetAccessToken";
+const char kOAuthWrapBridgeUrlSuffix[] = "/accounts/OAuthWrapBridge";
+const char kOAuth1LoginUrlSuffix[] = "/accounts/OAuthLogin";
+
} // namespacce
GaiaUrls* GaiaUrls::GetInstance() {
@@ -25,18 +31,34 @@ GaiaUrls* GaiaUrls::GetInstance() {
GaiaUrls::GaiaUrls() {
CommandLine* command_line = CommandLine::ForCurrentProcess();
+ std::string host_base;
if (command_line->HasSwitch(switches::kGaiaHost)) {
- host_base_ = command_line->GetSwitchValueASCII(switches::kGaiaHost);
+ host_base = command_line->GetSwitchValueASCII(switches::kGaiaHost);
} else {
- host_base_ = kDefaultGaiaBaseUrl;
+ host_base = kDefaultGaiaBaseUrl;
}
- captcha_url_prefix_ = "http://" + host_base_ + kCaptchaUrlPrefixSuffix;
- client_login_url_ = "https://" + host_base_ + kClientLoginUrlSuffix;
- issue_auth_token_url_ = "https://" + host_base_ + kIssueAuthTokenUrlSuffix;
- get_user_info_url_ = "https://" + host_base_ + kGetUserInfoUrlSuffix;
- token_auth_url_ = "https://" + host_base_ + kTokenAuthUrlSuffix;
- merge_session_url_ = "https://" + host_base_ + kMergeSessionUrlSuffix;
+ captcha_url_prefix_ = "http://" + host_base + kCaptchaUrlPrefixSuffix;
+ gaia_origin_url_ = "https://" + host_base;
+ client_login_url_ = gaia_origin_url_ + kClientLoginUrlSuffix;
+ issue_auth_token_url_ = gaia_origin_url_ + kIssueAuthTokenUrlSuffix;
+ get_user_info_url_ = gaia_origin_url_ + kGetUserInfoUrlSuffix;
+ token_auth_url_ = gaia_origin_url_ + kTokenAuthUrlSuffix;
+ merge_session_url_ = gaia_origin_url_ + kMergeSessionUrlSuffix;
+
+ get_oauth_token_url_ = gaia_origin_url_ + kGetOAuthTokenUrlSuffix;
+ oauth_get_access_token_url_ = gaia_origin_url_ +
+ kOAuthGetAccessTokenUrlSuffix;
+ oauth_wrap_bridge_url_ = gaia_origin_url_ + kOAuthWrapBridgeUrlSuffix;
+ oauth1_login_url_ = gaia_origin_url_ + kOAuth1LoginUrlSuffix;
+
+ // TODO(joaodasilva): these aren't configurable for now, but are managed here
+ // so that users of Gaia URLs don't have to use static constants.
+ // http://crbug.com/97126
+ oauth1_login_scope_ = "https://www.google.com/accounts/OAuthLogin";
+ oauth_user_info_url_ = "https://www.googleapis.com/oauth2/v1/userinfo";
+ oauth_wrap_bridge_user_info_scope_ =
+ "https://www.googleapis.com/auth/userinfo.email";
}
GaiaUrls::~GaiaUrls() {
@@ -46,6 +68,10 @@ const std::string& GaiaUrls::captcha_url_prefix() {
return captcha_url_prefix_;
}
+const std::string& GaiaUrls::gaia_origin_url() {
+ return gaia_origin_url_;
+}
+
const std::string& GaiaUrls::client_login_url() {
return client_login_url_;
}
@@ -65,3 +91,31 @@ const std::string& GaiaUrls::token_auth_url() {
const std::string& GaiaUrls::merge_session_url() {
return merge_session_url_;
}
+
+const std::string& GaiaUrls::get_oauth_token_url() {
+ return get_oauth_token_url_;
+}
+
+const std::string& GaiaUrls::oauth_get_access_token_url() {
+ return oauth_get_access_token_url_;
+}
+
+const std::string& GaiaUrls::oauth_wrap_bridge_url() {
+ return oauth_wrap_bridge_url_;
+}
+
+const std::string& GaiaUrls::oauth_user_info_url() {
+ return oauth_user_info_url_;
+}
+
+const std::string& GaiaUrls::oauth1_login_url() {
+ return oauth1_login_url_;
+}
+
+const std::string& GaiaUrls::oauth1_login_scope() {
+ return oauth1_login_scope_;
+}
+
+const std::string& GaiaUrls::oauth_wrap_bridge_user_info_scope() {
+ return oauth_wrap_bridge_user_info_scope_;
+}
diff --git a/chrome/common/net/gaia/gaia_urls.h b/chrome/common/net/gaia/gaia_urls.h
index c82823a..50cf05e 100644
--- a/chrome/common/net/gaia/gaia_urls.h
+++ b/chrome/common/net/gaia/gaia_urls.h
@@ -17,11 +17,21 @@ class GaiaUrls {
// The URLs for different calls in the Google Accounts programmatic login API.
const std::string& captcha_url_prefix();
+
+ const std::string& gaia_origin_url();
const std::string& client_login_url();
const std::string& issue_auth_token_url();
const std::string& get_user_info_url();
const std::string& token_auth_url();
const std::string& merge_session_url();
+ const std::string& get_oauth_token_url();
+ const std::string& oauth_get_access_token_url();
+ const std::string& oauth_wrap_bridge_url();
+ const std::string& oauth_user_info_url();
+ const std::string& oauth1_login_url();
+
+ const std::string& oauth1_login_scope();
+ const std::string& oauth_wrap_bridge_user_info_scope();
private:
GaiaUrls();
@@ -29,13 +39,22 @@ class GaiaUrls {
friend struct DefaultSingletonTraits<GaiaUrls>;
- std::string host_base_;
std::string captcha_url_prefix_;
+
+ std::string gaia_origin_url_;
std::string client_login_url_;
std::string issue_auth_token_url_;
std::string get_user_info_url_;
std::string token_auth_url_;
std::string merge_session_url_;
+ std::string get_oauth_token_url_;
+ std::string oauth_get_access_token_url_;
+ std::string oauth_wrap_bridge_url_;
+ std::string oauth_user_info_url_;
+ std::string oauth1_login_url_;
+
+ std::string oauth1_login_scope_;
+ std::string oauth_wrap_bridge_user_info_scope_;
DISALLOW_COPY_AND_ASSIGN(GaiaUrls);
};