| 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 #ifndef GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 5 #ifndef GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
| 6 #define GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 6 #define GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 const std::string& session_index, | 132 const std::string& session_index, |
| 133 const std::string& device_id); | 133 const std::string& device_id); |
| 134 | 134 |
| 135 // Start a request to exchange the authorization code for an OAuthLogin-scoped | 135 // Start a request to exchange the authorization code for an OAuthLogin-scoped |
| 136 // oauth2 token. | 136 // oauth2 token. |
| 137 // | 137 // |
| 138 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be | 138 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be |
| 139 // called on the consumer on the original thread. | 139 // called on the consumer on the original thread. |
| 140 void StartAuthCodeForOAuth2TokenExchange(const std::string& auth_code); | 140 void StartAuthCodeForOAuth2TokenExchange(const std::string& auth_code); |
| 141 | 141 |
| 142 // Start a request to exchange the authorization code for an OAuthLogin-scoped |
| 143 // oauth2 token. |
| 144 // Resulting refresh token is annotated on the server with |device_id|. Format |
| 145 // of device_id on the server is at most 64 unicode characters. |
| 146 // |
| 147 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be |
| 148 // called on the consumer on the original thread. |
| 149 void StartAuthCodeForOAuth2TokenExchangeWithDeviceId( |
| 150 const std::string& auth_code, |
| 151 const std::string& device_id); |
| 152 |
| 142 // Start a request to get user info for the account identified by |lsid|. | 153 // Start a request to get user info for the account identified by |lsid|. |
| 143 // | 154 // |
| 144 // Either OnGetUserInfoSuccess or OnGetUserInfoFailure will be | 155 // Either OnGetUserInfoSuccess or OnGetUserInfoFailure will be |
| 145 // called on the consumer on the original thread. | 156 // called on the consumer on the original thread. |
| 146 void StartGetUserInfo(const std::string& lsid); | 157 void StartGetUserInfo(const std::string& lsid); |
| 147 | 158 |
| 148 // Start a MergeSession request to pre-login the user with the given | 159 // Start a MergeSession request to pre-login the user with the given |
| 149 // credentials. | 160 // credentials. |
| 150 // | 161 // |
| 151 // Start a MergeSession request to fill the browsing cookie jar with | 162 // Start a MergeSession request to fill the browsing cookie jar with |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 static const char kClientLoginCaptchaFormat[]; | 242 static const char kClientLoginCaptchaFormat[]; |
| 232 // The format of the POST body for IssueAuthToken. | 243 // The format of the POST body for IssueAuthToken. |
| 233 static const char kIssueAuthTokenFormat[]; | 244 static const char kIssueAuthTokenFormat[]; |
| 234 // The format of the POST body to get OAuth2 auth code from auth token. | 245 // The format of the POST body to get OAuth2 auth code from auth token. |
| 235 static const char kClientLoginToOAuth2BodyFormat[]; | 246 static const char kClientLoginToOAuth2BodyFormat[]; |
| 236 // The format of the POST body to get OAuth2 auth code from auth token. This | 247 // The format of the POST body to get OAuth2 auth code from auth token. This |
| 237 // format is used for request annotated with device_id. | 248 // format is used for request annotated with device_id. |
| 238 static const char kClientLoginToOAuth2WithDeviceTypeBodyFormat[]; | 249 static const char kClientLoginToOAuth2WithDeviceTypeBodyFormat[]; |
| 239 // The format of the POST body to get OAuth2 token pair from auth code. | 250 // The format of the POST body to get OAuth2 token pair from auth code. |
| 240 static const char kOAuth2CodeToTokenPairBodyFormat[]; | 251 static const char kOAuth2CodeToTokenPairBodyFormat[]; |
| 252 // Additional param for the POST body to get OAuth2 token pair from auth code. |
| 253 static const char kOAuth2CodeToTokenPairDeviceIdParam[]; |
| 241 // The format of the POST body to revoke an OAuth2 token. | 254 // The format of the POST body to revoke an OAuth2 token. |
| 242 static const char kOAuth2RevokeTokenBodyFormat[]; | 255 static const char kOAuth2RevokeTokenBodyFormat[]; |
| 243 // The format of the POST body for GetUserInfo. | 256 // The format of the POST body for GetUserInfo. |
| 244 static const char kGetUserInfoFormat[]; | 257 static const char kGetUserInfoFormat[]; |
| 245 // The format of the POST body for MergeSession. | 258 // The format of the POST body for MergeSession. |
| 246 static const char kMergeSessionFormat[]; | 259 static const char kMergeSessionFormat[]; |
| 247 // The format of the URL for UberAuthToken. | 260 // The format of the URL for UberAuthToken. |
| 248 static const char kUberAuthTokenURLFormat[]; | 261 static const char kUberAuthTokenURLFormat[]; |
| 249 // The format of the body for OAuthLogin. | 262 // The format of the body for OAuthLogin. |
| 250 static const char kOAuthLoginFormat[]; | 263 static const char kOAuthLoginFormat[]; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 const std::string& login_token, | 385 const std::string& login_token, |
| 373 const std::string& login_captcha, | 386 const std::string& login_captcha, |
| 374 HostedAccountsSetting allow_hosted_accounts); | 387 HostedAccountsSetting allow_hosted_accounts); |
| 375 // Supply the sid / lsid returned from ClientLogin in order to | 388 // Supply the sid / lsid returned from ClientLogin in order to |
| 376 // request a long lived auth token for a service. | 389 // request a long lived auth token for a service. |
| 377 static std::string MakeIssueAuthTokenBody(const std::string& sid, | 390 static std::string MakeIssueAuthTokenBody(const std::string& sid, |
| 378 const std::string& lsid, | 391 const std::string& lsid, |
| 379 const char* const service); | 392 const char* const service); |
| 380 // Create body to get OAuth2 auth code. | 393 // Create body to get OAuth2 auth code. |
| 381 static std::string MakeGetAuthCodeBody(bool include_device_type); | 394 static std::string MakeGetAuthCodeBody(bool include_device_type); |
| 382 // Given auth code, create body to get OAuth2 token pair. | 395 // Given auth code and device ID (optional), create body to get OAuth2 token |
| 383 static std::string MakeGetTokenPairBody(const std::string& auth_code); | 396 // pair. |
| 397 static std::string MakeGetTokenPairBody(const std::string& auth_code, |
| 398 const std::string& device_id); |
| 384 // Given an OAuth2 token, create body to revoke the token. | 399 // Given an OAuth2 token, create body to revoke the token. |
| 385 std::string MakeRevokeTokenBody(const std::string& auth_token); | 400 std::string MakeRevokeTokenBody(const std::string& auth_token); |
| 386 // Supply the lsid returned from ClientLogin in order to fetch | 401 // Supply the lsid returned from ClientLogin in order to fetch |
| 387 // user information. | 402 // user information. |
| 388 static std::string MakeGetUserInfoBody(const std::string& lsid); | 403 static std::string MakeGetUserInfoBody(const std::string& lsid); |
| 389 | 404 |
| 390 // Supply the authentication token returned from StartIssueAuthToken. | 405 // Supply the authentication token returned from StartIssueAuthToken. |
| 391 static std::string MakeMergeSessionBody(const std::string& auth_token, | 406 static std::string MakeMergeSessionBody(const std::string& auth_token, |
| 392 const std::string& external_cc_result, | 407 const std::string& external_cc_result, |
| 393 const std::string& continue_url, | 408 const std::string& continue_url, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); | 479 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); |
| 465 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); | 480 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); |
| 466 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); | 481 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); |
| 467 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); | 482 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); |
| 468 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); | 483 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); |
| 469 | 484 |
| 470 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); | 485 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); |
| 471 }; | 486 }; |
| 472 | 487 |
| 473 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 488 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
| OLD | NEW |