OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "google_apis/gaia/gaia_urls.h" | 5 #include "google_apis/gaia/gaia_urls.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "google_apis/gaia/gaia_switches.h" | 9 #include "google_apis/gaia/gaia_switches.h" |
10 #include "google_apis/google_api_keys.h" | 10 #include "google_apis/google_api_keys.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // API calls from accounts.google.com (LSO) | 32 // API calls from accounts.google.com (LSO) |
33 const char kGetOAuthTokenUrlSuffix[] = "/o/oauth/GetOAuthToken/"; | 33 const char kGetOAuthTokenUrlSuffix[] = "/o/oauth/GetOAuthToken/"; |
34 const char kClientLoginToOAuth2UrlSuffix[] = "/o/oauth2/programmatic_auth"; | 34 const char kClientLoginToOAuth2UrlSuffix[] = "/o/oauth2/programmatic_auth"; |
35 const char kOAuth2AuthUrlSuffix[] = "/o/oauth2/auth"; | 35 const char kOAuth2AuthUrlSuffix[] = "/o/oauth2/auth"; |
36 const char kOAuth2RevokeUrlSuffix[] = "/o/oauth2/revoke"; | 36 const char kOAuth2RevokeUrlSuffix[] = "/o/oauth2/revoke"; |
37 const char kOAuth2TokenUrlSuffix[] = "/o/oauth2/token"; | 37 const char kOAuth2TokenUrlSuffix[] = "/o/oauth2/token"; |
38 const char kClientOAuthUrlSuffix[] = "/ClientOAuth"; | 38 const char kClientOAuthUrlSuffix[] = "/ClientOAuth"; |
39 | 39 |
40 // API calls from www.googleapis.com | 40 // API calls from www.googleapis.com |
41 const char kOAuth2IssueTokenUrlSuffix[] = "/oauth2/v2/IssueToken"; | 41 const char kOAuth2IssueTokenUrlSuffix[] = "/oauth2/v2/IssueToken"; |
| 42 const char kOAuth2TokenInfoUrlSuffix[] = "/oauth2/v2/tokeninfo"; |
42 const char kOAuthUserInfoUrlSuffix[] = "/oauth2/v1/userinfo"; | 43 const char kOAuthUserInfoUrlSuffix[] = "/oauth2/v1/userinfo"; |
43 const char kOAuthWrapBridgeUserInfoScopeUrlSuffix[] = "/auth/userinfo.email"; | 44 const char kOAuthWrapBridgeUserInfoScopeUrlSuffix[] = "/auth/userinfo.email"; |
44 | 45 |
45 const char kOAuth1LoginScope[] = | 46 const char kOAuth1LoginScope[] = |
46 "https://www.google.com/accounts/OAuthLogin"; | 47 "https://www.google.com/accounts/OAuthLogin"; |
47 | 48 |
48 void GetSwitchValueWithDefault(const char* switch_value, | 49 void GetSwitchValueWithDefault(const char* switch_value, |
49 const char* default_value, | 50 const char* default_value, |
50 std::string* output_value) { | 51 std::string* output_value) { |
51 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 52 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 kClientLoginToOAuth2UrlSuffix; | 111 kClientLoginToOAuth2UrlSuffix; |
111 oauth2_auth_url_ = lso_origin_url_ + kOAuth2AuthUrlSuffix; | 112 oauth2_auth_url_ = lso_origin_url_ + kOAuth2AuthUrlSuffix; |
112 std::string oauth2_token_url = lso_origin_url_ + kOAuth2TokenUrlSuffix; | 113 std::string oauth2_token_url = lso_origin_url_ + kOAuth2TokenUrlSuffix; |
113 oauth2_revoke_url_ = lso_origin_url_ + kOAuth2RevokeUrlSuffix; | 114 oauth2_revoke_url_ = lso_origin_url_ + kOAuth2RevokeUrlSuffix; |
114 | 115 |
115 // URLs from www.googleapis.com. | 116 // URLs from www.googleapis.com. |
116 oauth_wrap_bridge_user_info_scope_ = google_apis_origin_url_ + | 117 oauth_wrap_bridge_user_info_scope_ = google_apis_origin_url_ + |
117 kOAuthWrapBridgeUserInfoScopeUrlSuffix; | 118 kOAuthWrapBridgeUserInfoScopeUrlSuffix; |
118 std::string oauth2_issue_token_url = google_apis_origin_url_ + | 119 std::string oauth2_issue_token_url = google_apis_origin_url_ + |
119 kOAuth2IssueTokenUrlSuffix; | 120 kOAuth2IssueTokenUrlSuffix; |
| 121 oauth2_token_info_url_ = google_apis_origin_url_ + kOAuth2TokenInfoUrlSuffix; |
120 std::string oauth_user_info_url = google_apis_origin_url_ + | 122 std::string oauth_user_info_url = google_apis_origin_url_ + |
121 kOAuthUserInfoUrlSuffix; | 123 kOAuthUserInfoUrlSuffix; |
122 | 124 |
123 // TODO(zelidrag): Get rid of all these switches since all URLs should be | 125 // TODO(zelidrag): Get rid of all these switches since all URLs should be |
124 // controlled only with --gaia-url, --lso-url and --google-apis-host. | 126 // controlled only with --gaia-url, --lso-url and --google-apis-host. |
125 GetSwitchValueWithDefault(switches::kOAuth1LoginScope, | 127 GetSwitchValueWithDefault(switches::kOAuth1LoginScope, |
126 kOAuth1LoginScope, | 128 kOAuth1LoginScope, |
127 &oauth1_login_scope_); | 129 &oauth1_login_scope_); |
128 GetSwitchValueWithDefault(switches::kClientLoginToOAuth2Url, | 130 GetSwitchValueWithDefault(switches::kClientLoginToOAuth2Url, |
129 client_login_to_oauth2_url.c_str(), | 131 client_login_to_oauth2_url.c_str(), |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 229 } |
228 | 230 |
229 const std::string& GaiaUrls::oauth2_token_url() const { | 231 const std::string& GaiaUrls::oauth2_token_url() const { |
230 return oauth2_token_url_; | 232 return oauth2_token_url_; |
231 } | 233 } |
232 | 234 |
233 const std::string& GaiaUrls::oauth2_issue_token_url() const { | 235 const std::string& GaiaUrls::oauth2_issue_token_url() const { |
234 return oauth2_issue_token_url_; | 236 return oauth2_issue_token_url_; |
235 } | 237 } |
236 | 238 |
| 239 const std::string& GaiaUrls::oauth2_token_info_url() const { |
| 240 return oauth2_token_info_url_; |
| 241 } |
| 242 |
237 const std::string& GaiaUrls::oauth2_revoke_url() const { | 243 const std::string& GaiaUrls::oauth2_revoke_url() const { |
238 return oauth2_revoke_url_; | 244 return oauth2_revoke_url_; |
239 } | 245 } |
240 | 246 |
241 const std::string& GaiaUrls::gaia_login_form_realm() const { | 247 const std::string& GaiaUrls::gaia_login_form_realm() const { |
242 return gaia_login_form_realm_; | 248 return gaia_login_form_realm_; |
243 } | 249 } |
OLD | NEW |