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

Side by Side Diff: chrome/browser/chromeos/login/google_authenticator.cc

Issue 3024002: Add IssueAuthToken support to the TokenService. (Closed)
Patch Set: Code review fixes Created 10 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/login_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/chromeos/login/google_authenticator.h" 5 #include "chrome/browser/chromeos/login/google_authenticator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/lock.h" 12 #include "base/lock.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/sha2.h" 15 #include "base/sha2.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/third_party/nss/blapi.h" 17 #include "base/third_party/nss/blapi.h"
18 #include "base/third_party/nss/sha256.h" 18 #include "base/third_party/nss/sha256.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/chrome_thread.h" 20 #include "chrome/browser/chrome_thread.h"
21 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 21 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
22 #include "chrome/browser/chromeos/login/auth_response_handler.h" 22 #include "chrome/browser/chromeos/login/auth_response_handler.h"
23 #include "chrome/browser/chromeos/login/authentication_notification_details.h" 23 #include "chrome/browser/chromeos/login/authentication_notification_details.h"
24 #include "chrome/browser/chromeos/login/login_status_consumer.h" 24 #include "chrome/browser/chromeos/login/login_status_consumer.h"
25 #include "chrome/browser/profile.h" 25 #include "chrome/browser/profile.h"
26 #include "chrome/browser/profile_manager.h" 26 #include "chrome/browser/profile_manager.h"
27 #include "chrome/common/chrome_paths.h" 27 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/net/gaia/gaia_authenticator2.h" 28 #include "chrome/common/net/gaia/gaia_authenticator2.h"
29 #include "chrome/common/net/gaia/gaia_constants.h"
29 #include "chrome/common/notification_service.h" 30 #include "chrome/common/notification_service.h"
30 #include "net/base/load_flags.h" 31 #include "net/base/load_flags.h"
31 #include "net/base/net_errors.h" 32 #include "net/base/net_errors.h"
32 #include "net/url_request/url_request_status.h" 33 #include "net/url_request/url_request_status.h"
33 #include "third_party/libjingle/source/talk/base/urlencode.h" 34 #include "third_party/libjingle/source/talk/base/urlencode.h"
34 35
35 using base::Time; 36 using base::Time;
36 using base::TimeDelta; 37 using base::TimeDelta;
37 using file_util::GetFileSize; 38 using file_util::GetFileSize;
38 using file_util::PathExists; 39 using file_util::PathExists;
(...skipping 25 matching lines...) Expand all
64 void GoogleAuthenticator::CancelClientLogin() { 65 void GoogleAuthenticator::CancelClientLogin() {
65 if (gaia_authenticator_->HasPendingFetch()) { 66 if (gaia_authenticator_->HasPendingFetch()) {
66 gaia_authenticator_->CancelRequest(); 67 gaia_authenticator_->CancelRequest();
67 OnLoginFailure("Login has timed out; please try again!"); 68 OnLoginFailure("Login has timed out; please try again!");
68 } 69 }
69 } 70 }
70 71
71 void GoogleAuthenticator::TryClientLogin() { 72 void GoogleAuthenticator::TryClientLogin() {
72 gaia_authenticator_->StartClientLogin(username_, 73 gaia_authenticator_->StartClientLogin(username_,
73 password_, 74 password_,
74 GaiaAuthenticator2::kContactsService, 75 GaiaConstants::kContactsService,
75 login_token_, 76 login_token_,
76 login_captcha_); 77 login_captcha_);
77 ChromeThread::PostDelayedTask( 78 ChromeThread::PostDelayedTask(
78 ChromeThread::UI, 79 ChromeThread::UI,
79 FROM_HERE, 80 FROM_HERE,
80 NewRunnableMethod(this, 81 NewRunnableMethod(this,
81 &GoogleAuthenticator::CancelClientLogin), 82 &GoogleAuthenticator::CancelClientLogin),
82 kClientLoginTimeoutMs); 83 kClientLoginTimeoutMs);
83 } 84 }
84 85
(...skipping 22 matching lines...) Expand all
107 const std::string& login_captcha) { 108 const std::string& login_captcha) {
108 unlock_ = false; 109 unlock_ = false;
109 110
110 // TODO(cmasone): Figure out how to parallelize fetch, username/password 111 // TODO(cmasone): Figure out how to parallelize fetch, username/password
111 // processing without impacting testability. 112 // processing without impacting testability.
112 username_.assign(Canonicalize(username)); 113 username_.assign(Canonicalize(username));
113 ascii_hash_.assign(HashPassword(password)); 114 ascii_hash_.assign(HashPassword(password));
114 115
115 gaia_authenticator_.reset( 116 gaia_authenticator_.reset(
116 new GaiaAuthenticator2(this, 117 new GaiaAuthenticator2(this,
117 GaiaAuthenticator2::kChromeOSSource, 118 GaiaConstants::kChromeOSSource,
118 profile->GetRequestContext())); 119 profile->GetRequestContext()));
119 // Will be used for retries. 120 // Will be used for retries.
120 PrepareClientLoginAttempt(password, login_token, login_captcha); 121 PrepareClientLoginAttempt(password, login_token, login_captcha);
121 TryClientLogin(); 122 TryClientLogin();
122 return true; 123 return true;
123 } 124 }
124 125
125 bool GoogleAuthenticator::AuthenticateToUnlock(const std::string& username, 126 bool GoogleAuthenticator::AuthenticateToUnlock(const std::string& username,
126 const std::string& password) { 127 const std::string& password) {
127 username_.assign(Canonicalize(username)); 128 username_.assign(Canonicalize(username));
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 DCHECK_EQ(parts.size(), 2U) << "email_address should have only one @"; 423 DCHECK_EQ(parts.size(), 2U) << "email_address should have only one @";
423 RemoveChars(parts[0], ".", &parts[0]); 424 RemoveChars(parts[0], ".", &parts[0]);
424 if (parts[0].find('+') != std::string::npos) 425 if (parts[0].find('+') != std::string::npos)
425 parts[0].erase(parts[0].find('+')); 426 parts[0].erase(parts[0].find('+'));
426 std::string new_email = StringToLowerASCII(JoinString(parts, at)); 427 std::string new_email = StringToLowerASCII(JoinString(parts, at));
427 LOG(INFO) << "Canonicalized " << email_address << " to " << new_email; 428 LOG(INFO) << "Canonicalized " << email_address << " to " << new_email;
428 return new_email; 429 return new_email;
429 } 430 }
430 431
431 } // namespace chromeos 432 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/login_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698