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

Side by Side Diff: chrome/browser/chromeos/login/auth/chrome_login_performer.cc

Issue 1494153002: This CL replaces e-mail with AccountId in easy signin code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bugfix in original easy unlock code' Created 5 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/auth/chrome_login_performer.h" 5 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_user_login_flow. h" 10 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_user_login_flow. h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } else if (status == CrosSettingsProvider::TEMPORARILY_UNTRUSTED) { 77 } else if (status == CrosSettingsProvider::TEMPORARILY_UNTRUSTED) {
78 // Value of AllowNewUser setting is still not verified. 78 // Value of AllowNewUser setting is still not verified.
79 // Another attempt will be invoked after verification completion. 79 // Another attempt will be invoked after verification completion.
80 return; 80 return;
81 } else { 81 } else {
82 DCHECK(status == CrosSettingsProvider::TRUSTED); 82 DCHECK(status == CrosSettingsProvider::TRUSTED);
83 callback.Run(); 83 callback.Run();
84 } 84 }
85 } 85 }
86 86
87 bool ChromeLoginPerformer::IsUserWhitelisted(const std::string& user_id, 87 bool ChromeLoginPerformer::IsUserWhitelisted(const AccountId& account_id,
88 bool* wildcard_match) { 88 bool* wildcard_match) {
89 return CrosSettings::IsWhitelisted(user_id, wildcard_match); 89 return CrosSettings::IsWhitelisted(account_id.GetUserEmail(), wildcard_match);
90 } 90 }
91 91
92 void ChromeLoginPerformer::RunOnlineWhitelistCheck( 92 void ChromeLoginPerformer::RunOnlineWhitelistCheck(
93 const std::string& user_id, 93 const AccountId& account_id,
94 bool wildcard_match, 94 bool wildcard_match,
95 const std::string& refresh_token, 95 const std::string& refresh_token,
96 const base::Closure& success_callback, 96 const base::Closure& success_callback,
97 const base::Closure& failure_callback) { 97 const base::Closure& failure_callback) {
98 // On enterprise devices, reconfirm login permission with the server. 98 // On enterprise devices, reconfirm login permission with the server.
99 policy::BrowserPolicyConnectorChromeOS* connector = 99 policy::BrowserPolicyConnectorChromeOS* connector =
100 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 100 g_browser_process->platform_part()->browser_policy_connector_chromeos();
101 if (connector->IsEnterpriseManaged() && wildcard_match && 101 if (connector->IsEnterpriseManaged() && wildcard_match &&
102 !connector->IsNonEnterpriseUser(user_id)) { 102 !connector->IsNonEnterpriseUser(account_id.GetUserEmail())) {
103 wildcard_login_checker_.reset(new policy::WildcardLoginChecker()); 103 wildcard_login_checker_.reset(new policy::WildcardLoginChecker());
104 if (refresh_token.empty()) { 104 if (refresh_token.empty()) {
105 wildcard_login_checker_->StartWithSigninContext( 105 wildcard_login_checker_->StartWithSigninContext(
106 GetSigninRequestContext(), 106 GetSigninRequestContext(),
107 base::Bind(&ChromeLoginPerformer::OnlineWildcardLoginCheckCompleted, 107 base::Bind(&ChromeLoginPerformer::OnlineWildcardLoginCheckCompleted,
108 weak_factory_.GetWeakPtr(), success_callback, 108 weak_factory_.GetWeakPtr(), success_callback,
109 failure_callback)); 109 failure_callback));
110 } else { 110 } else {
111 wildcard_login_checker_->StartWithRefreshToken( 111 wildcard_login_checker_->StartWithRefreshToken(
112 refresh_token, 112 refresh_token,
(...skipping 23 matching lines...) Expand all
136 SupervisedUserAuthentication::SCHEMA_SALT_HASHED; 136 SupervisedUserAuthentication::SCHEMA_SALT_HASHED;
137 } 137 }
138 138
139 UserContext ChromeLoginPerformer::TransformSupervisedKey( 139 UserContext ChromeLoginPerformer::TransformSupervisedKey(
140 const UserContext& context) { 140 const UserContext& context) {
141 SupervisedUserAuthentication* authentication = 141 SupervisedUserAuthentication* authentication =
142 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); 142 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication();
143 return authentication->TransformKey(context); 143 return authentication->TransformKey(context);
144 } 144 }
145 145
146 void ChromeLoginPerformer::SetupSupervisedUserFlow(const std::string& user_id) { 146 void ChromeLoginPerformer::SetupSupervisedUserFlow(
147 SupervisedUserLoginFlow* new_flow = new SupervisedUserLoginFlow(user_id); 147 const AccountId& account_id) {
148 new_flow->SetHost(ChromeUserManager::Get() 148 SupervisedUserLoginFlow* new_flow = new SupervisedUserLoginFlow(account_id);
149 ->GetUserFlow(AccountId::FromUserEmail(user_id)) 149 new_flow->SetHost(ChromeUserManager::Get()->GetUserFlow(account_id)->host());
150 ->host()); 150 ChromeUserManager::Get()->SetUserFlow(account_id, new_flow);
151 ChromeUserManager::Get()->SetUserFlow(AccountId::FromUserEmail(user_id),
152 new_flow);
153 } 151 }
154 152
155 void ChromeLoginPerformer::SetupEasyUnlockUserFlow(const std::string& user_id) { 153 void ChromeLoginPerformer::SetupEasyUnlockUserFlow(
156 ChromeUserManager::Get()->SetUserFlow(AccountId::FromUserEmail(user_id), 154 const AccountId& account_id) {
157 new EasyUnlockUserLoginFlow(user_id)); 155 ChromeUserManager::Get()->SetUserFlow(
156 account_id, new EasyUnlockUserLoginFlow(account_id));
158 } 157 }
159 158
160 bool ChromeLoginPerformer::CheckPolicyForUser(const std::string& user_id) { 159 bool ChromeLoginPerformer::CheckPolicyForUser(const AccountId& account_id) {
161 // Login is not allowed if policy could not be loaded for the account. 160 // Login is not allowed if policy could not be loaded for the account.
162 policy::BrowserPolicyConnectorChromeOS* connector = 161 policy::BrowserPolicyConnectorChromeOS* connector =
163 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 162 g_browser_process->platform_part()->browser_policy_connector_chromeos();
164 policy::DeviceLocalAccountPolicyService* policy_service = 163 policy::DeviceLocalAccountPolicyService* policy_service =
165 connector->GetDeviceLocalAccountPolicyService(); 164 connector->GetDeviceLocalAccountPolicyService();
166 return policy_service && policy_service->IsPolicyAvailableForUser(user_id); 165 return policy_service &&
166 policy_service->IsPolicyAvailableForUser(account_id.GetUserEmail());
167 } 167 }
168 //////////////////////////////////////////////////////////////////////////////// 168 ////////////////////////////////////////////////////////////////////////////////
169 // ChromeLoginPerformer, private: 169 // ChromeLoginPerformer, private:
170 170
171 content::BrowserContext* ChromeLoginPerformer::GetSigninContext() { 171 content::BrowserContext* ChromeLoginPerformer::GetSigninContext() {
172 return ProfileHelper::GetSigninProfile(); 172 return ProfileHelper::GetSigninProfile();
173 } 173 }
174 174
175 net::URLRequestContextGetter* ChromeLoginPerformer::GetSigninRequestContext() { 175 net::URLRequestContextGetter* ChromeLoginPerformer::GetSigninRequestContext() {
176 return login::GetSigninContext(); 176 return login::GetSigninContext();
177 } 177 }
178 178
179 void ChromeLoginPerformer::OnlineWildcardLoginCheckCompleted( 179 void ChromeLoginPerformer::OnlineWildcardLoginCheckCompleted(
180 const base::Closure& success_callback, 180 const base::Closure& success_callback,
181 const base::Closure& failure_callback, 181 const base::Closure& failure_callback,
182 policy::WildcardLoginChecker::Result result) { 182 policy::WildcardLoginChecker::Result result) {
183 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { 183 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) {
184 success_callback.Run(); 184 success_callback.Run();
185 } else { 185 } else {
186 failure_callback.Run(); 186 failure_callback.Run();
187 } 187 }
188 } 188 }
189 189
190 } // namespace chromeos 190 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698