Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: google_apis/gaia/gaia_auth_fetcher.h

Issue 11649055: OAuth2 sign-in flow for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Either OnClientLoginSuccess or OnClientLoginFailure will be 62 // Either OnClientLoginSuccess or OnClientLoginFailure will be
63 // called on the consumer on the original thread. 63 // called on the consumer on the original thread.
64 void StartClientLogin(const std::string& username, 64 void StartClientLogin(const std::string& username,
65 const std::string& password, 65 const std::string& password,
66 const char* const service, 66 const char* const service,
67 const std::string& login_token, 67 const std::string& login_token,
68 const std::string& login_captcha, 68 const std::string& login_captcha,
69 HostedAccountsSetting allow_hosted_accounts); 69 HostedAccountsSetting allow_hosted_accounts);
70 70
71 // Start a request to obtain service token for the the account identified by 71 // Start a request to obtain service token for the the account identified by
72 // |sid| and |lsid| and the service|service|. 72 // |sid| and |lsid| and the |service|.
73 // 73 //
74 // Either OnIssueAuthTokenSuccess or OnIssueAuthTokenFailure will be 74 // Either OnIssueAuthTokenSuccess or OnIssueAuthTokenFailure will be
75 // called on the consumer on the original thread. 75 // called on the consumer on the original thread.
76 void StartIssueAuthToken(const std::string& sid, 76 void StartIssueAuthToken(const std::string& sid,
77 const std::string& lsid, 77 const std::string& lsid,
78 const char* const service); 78 const char* const service);
79 // Start a request to obtain service token for the the account identified by
80 // |oauth2_access_token| and the |service|.
81 //
82 // Either OnIssueAuthTokenSuccess or OnIssueAuthTokenFailure will be
83 // called on the consumer on the original thread.
84 void StartIssueAuthTokenForOAuth2(const std::string& oauth2_access_token,
85 const char* const service);
79 86
80 // Start a request to exchange an "lso" service token given by |auth_token| 87 // Start a request to exchange an "lso" service token given by |auth_token|
81 // for an OAuthLogin-scoped oauth2 token. 88 // for an OAuthLogin-scoped oauth2 token.
82 // 89 //
83 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be 90 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be
84 // called on the consumer on the original thread. 91 // called on the consumer on the original thread.
85 void StartLsoForOAuthLoginTokenExchange(const std::string& auth_token); 92 void StartLsoForOAuthLoginTokenExchange(const std::string& auth_token);
86 93
87 // Start a request to exchange the cookies of a signed-in user session 94 // Start a request to exchange the cookies of a signed-in user session
88 // for an OAuthLogin-scoped oauth2 token. In the case of a session with 95 // for an OAuthLogin-scoped oauth2 token. In the case of a session with
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 static const char kCookiePersistence[]; 188 static const char kCookiePersistence[];
182 static const char kAccountTypeHostedOrGoogle[]; 189 static const char kAccountTypeHostedOrGoogle[];
183 static const char kAccountTypeGoogle[]; 190 static const char kAccountTypeGoogle[];
184 191
185 // The format of the POST body for ClientLogin. 192 // The format of the POST body for ClientLogin.
186 static const char kClientLoginFormat[]; 193 static const char kClientLoginFormat[];
187 // The format of said POST body when CAPTCHA token & answer are specified. 194 // The format of said POST body when CAPTCHA token & answer are specified.
188 static const char kClientLoginCaptchaFormat[]; 195 static const char kClientLoginCaptchaFormat[];
189 // The format of the POST body for IssueAuthToken. 196 // The format of the POST body for IssueAuthToken.
190 static const char kIssueAuthTokenFormat[]; 197 static const char kIssueAuthTokenFormat[];
198 // The format of the POST body for IssueAuthToken with OAuth2 access token.
199 static const char kIssueAuthTokenFormatForOAuth2[];
191 // The format of the POST body to get OAuth2 auth code from auth token. 200 // The format of the POST body to get OAuth2 auth code from auth token.
192 static const char kClientLoginToOAuth2BodyFormat[]; 201 static const char kClientLoginToOAuth2BodyFormat[];
193 // The format of the POST body to get OAuth2 token pair from auth code. 202 // The format of the POST body to get OAuth2 token pair from auth code.
194 static const char kOAuth2CodeToTokenPairBodyFormat[]; 203 static const char kOAuth2CodeToTokenPairBodyFormat[];
195 // The format of the POST body for GetUserInfo. 204 // The format of the POST body for GetUserInfo.
196 static const char kGetUserInfoFormat[]; 205 static const char kGetUserInfoFormat[];
197 // The format of the POST body for MergeSession. 206 // The format of the POST body for MergeSession.
198 static const char kMergeSessionFormat[]; 207 static const char kMergeSessionFormat[];
199 // The format of the URL for UberAuthToken. 208 // The format of the URL for UberAuthToken.
200 static const char kUberAuthTokenURLFormat[]; 209 static const char kUberAuthTokenURLFormat[];
(...skipping 17 matching lines...) Expand all
218 static const char kCaptchaTokenParam[]; 227 static const char kCaptchaTokenParam[];
219 228
220 // Constants for parsing ClientOAuth errors. 229 // Constants for parsing ClientOAuth errors.
221 static const char kNeedsAdditional[]; 230 static const char kNeedsAdditional[];
222 static const char kCaptcha[]; 231 static const char kCaptcha[];
223 static const char kTwoFactor[]; 232 static const char kTwoFactor[];
224 233
225 // Constants for request/response for OAuth2 requests. 234 // Constants for request/response for OAuth2 requests.
226 static const char kAuthHeaderFormat[]; 235 static const char kAuthHeaderFormat[];
227 static const char kOAuthHeaderFormat[]; 236 static const char kOAuthHeaderFormat[];
237 static const char kOAuth2BearerHeaderFormat[];
228 static const char kClientLoginToOAuth2CookiePartSecure[]; 238 static const char kClientLoginToOAuth2CookiePartSecure[];
229 static const char kClientLoginToOAuth2CookiePartHttpOnly[]; 239 static const char kClientLoginToOAuth2CookiePartHttpOnly[];
230 static const char kClientLoginToOAuth2CookiePartCodePrefix[]; 240 static const char kClientLoginToOAuth2CookiePartCodePrefix[];
231 static const int kClientLoginToOAuth2CookiePartCodePrefixLength; 241 static const int kClientLoginToOAuth2CookiePartCodePrefixLength;
232 242
233 // Process the results of a ClientLogin fetch. 243 // Process the results of a ClientLogin fetch.
234 void OnClientLoginFetched(const std::string& data, 244 void OnClientLoginFetched(const std::string& data,
235 const net::URLRequestStatus& status, 245 const net::URLRequestStatus& status,
236 int response_code); 246 int response_code);
237 247
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 const std::string& source, 312 const std::string& source,
303 const char* const service, 313 const char* const service,
304 const std::string& login_token, 314 const std::string& login_token,
305 const std::string& login_captcha, 315 const std::string& login_captcha,
306 HostedAccountsSetting allow_hosted_accounts); 316 HostedAccountsSetting allow_hosted_accounts);
307 // Supply the sid / lsid returned from ClientLogin in order to 317 // Supply the sid / lsid returned from ClientLogin in order to
308 // request a long lived auth token for a service. 318 // request a long lived auth token for a service.
309 static std::string MakeIssueAuthTokenBody(const std::string& sid, 319 static std::string MakeIssueAuthTokenBody(const std::string& sid,
310 const std::string& lsid, 320 const std::string& lsid,
311 const char* const service); 321 const char* const service);
322 // Request a long lived auth token for a service when authentication is based
323 // on OAuth2 access token.
324 static std::string MakeIssueAuthTokenBodyForOAuth2(const char* const service);
325 // Supply the OAuth2 access token in order to request a long lived
326 // auth token for a service.
327 static std::string StartIssueAuthTokenForOAuth2(const char* const service);
312 // Create body to get OAuth2 auth code. 328 // Create body to get OAuth2 auth code.
313 static std::string MakeGetAuthCodeBody(); 329 static std::string MakeGetAuthCodeBody();
314 // Given auth code, create body to get OAuth2 token pair. 330 // Given auth code, create body to get OAuth2 token pair.
315 static std::string MakeGetTokenPairBody(const std::string& auth_code); 331 static std::string MakeGetTokenPairBody(const std::string& auth_code);
316 // Supply the lsid returned from ClientLogin in order to fetch 332 // Supply the lsid returned from ClientLogin in order to fetch
317 // user information. 333 // user information.
318 static std::string MakeGetUserInfoBody(const std::string& lsid); 334 static std::string MakeGetUserInfoBody(const std::string& lsid);
319 335
320 // Supply the authentication token returned from StartIssueAuthToken. 336 // Supply the authentication token returned from StartIssueAuthToken.
321 static std::string MakeMergeSessionBody(const std::string& auth_token, 337 static std::string MakeMergeSessionBody(const std::string& auth_token,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); 413 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse);
398 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); 414 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess);
399 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); 415 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote);
400 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); 416 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess);
401 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); 417 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote);
402 418
403 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); 419 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher);
404 }; 420 };
405 421
406 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ 422 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698