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

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

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } else if (status == CrosSettingsProvider::TEMPORARILY_UNTRUSTED) { 79 } else if (status == CrosSettingsProvider::TEMPORARILY_UNTRUSTED) {
80 // Value of AllowNewUser setting is still not verified. 80 // Value of AllowNewUser setting is still not verified.
81 // Another attempt will be invoked after verification completion. 81 // Another attempt will be invoked after verification completion.
82 return; 82 return;
83 } else { 83 } else {
84 DCHECK(status == CrosSettingsProvider::TRUSTED); 84 DCHECK(status == CrosSettingsProvider::TRUSTED);
85 callback.Run(); 85 callback.Run();
86 } 86 }
87 } 87 }
88 88
89 bool ChromeLoginPerformer::IsUserWhitelisted(const std::string& user_id, 89 bool ChromeLoginPerformer::IsUserWhitelisted(const user_manager::UserID& user_id ,
90 bool* wildcard_match) { 90 bool* wildcard_match) {
91 return CrosSettings::IsWhitelisted(user_id, wildcard_match); 91 return CrosSettings::IsWhitelisted(user_id, wildcard_match);
92 } 92 }
93 93
94 void ChromeLoginPerformer::RunOnlineWhitelistCheck( 94 void ChromeLoginPerformer::RunOnlineWhitelistCheck(
95 const std::string& user_id, 95 const user_manager::UserID& user_id,
96 bool wildcard_match, 96 bool wildcard_match,
97 const std::string& refresh_token, 97 const std::string& refresh_token,
98 const base::Closure& success_callback, 98 const base::Closure& success_callback,
99 const base::Closure& failure_callback) { 99 const base::Closure& failure_callback) {
100 // On enterprise devices, reconfirm login permission with the server. 100 // On enterprise devices, reconfirm login permission with the server.
101 policy::BrowserPolicyConnectorChromeOS* connector = 101 policy::BrowserPolicyConnectorChromeOS* connector =
102 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 102 g_browser_process->platform_part()->browser_policy_connector_chromeos();
103 if (connector->IsEnterpriseManaged() && wildcard_match && 103 if (connector->IsEnterpriseManaged() && wildcard_match &&
104 !connector->IsNonEnterpriseUser(user_id)) { 104 !connector->IsNonEnterpriseUser(user_id)) {
105 wildcard_login_checker_.reset(new policy::WildcardLoginChecker()); 105 wildcard_login_checker_.reset(new policy::WildcardLoginChecker());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 SupervisedUserAuthentication::SCHEMA_SALT_HASHED; 137 SupervisedUserAuthentication::SCHEMA_SALT_HASHED;
138 } 138 }
139 139
140 UserContext ChromeLoginPerformer::TransformSupervisedKey( 140 UserContext ChromeLoginPerformer::TransformSupervisedKey(
141 const UserContext& context) { 141 const UserContext& context) {
142 SupervisedUserAuthentication* authentication = 142 SupervisedUserAuthentication* authentication =
143 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); 143 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication();
144 return authentication->TransformKey(context); 144 return authentication->TransformKey(context);
145 } 145 }
146 146
147 void ChromeLoginPerformer::SetupSupervisedUserFlow(const std::string& user_id) { 147 void ChromeLoginPerformer::SetupSupervisedUserFlow(const user_manager::UserID& u ser_id) {
148 SupervisedUserLoginFlow* new_flow = new SupervisedUserLoginFlow(user_id); 148 SupervisedUserLoginFlow* new_flow = new SupervisedUserLoginFlow(user_id);
149 new_flow->SetHost(ChromeUserManager::Get()->GetUserFlow(user_id)->host()); 149 new_flow->SetHost(ChromeUserManager::Get()->GetUserFlow(user_id)->host());
150 ChromeUserManager::Get()->SetUserFlow(user_id, new_flow); 150 ChromeUserManager::Get()->SetUserFlow(user_id, new_flow);
151 } 151 }
152 152
153 void ChromeLoginPerformer::SetupEasyUnlockUserFlow(const std::string& user_id) { 153 void ChromeLoginPerformer::SetupEasyUnlockUserFlow(const user_manager::UserID& u ser_id) {
154 ChromeUserManager::Get()->SetUserFlow(user_id, 154 ChromeUserManager::Get()->SetUserFlow(user_id,
155 new EasyUnlockUserLoginFlow(user_id)); 155 new EasyUnlockUserLoginFlow(user_id));
156 } 156 }
157 157
158 bool ChromeLoginPerformer::CheckPolicyForUser(const std::string& user_id) { 158 bool ChromeLoginPerformer::CheckPolicyForUser(const user_manager::UserID& user_i d) {
159 // Login is not allowed if policy could not be loaded for the account. 159 // Login is not allowed if policy could not be loaded for the account.
160 policy::BrowserPolicyConnectorChromeOS* connector = 160 policy::BrowserPolicyConnectorChromeOS* connector =
161 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 161 g_browser_process->platform_part()->browser_policy_connector_chromeos();
162 policy::DeviceLocalAccountPolicyService* policy_service = 162 policy::DeviceLocalAccountPolicyService* policy_service =
163 connector->GetDeviceLocalAccountPolicyService(); 163 connector->GetDeviceLocalAccountPolicyService();
164 return policy_service && policy_service->IsPolicyAvailableForUser(user_id); 164 return policy_service && policy_service->IsPolicyAvailableForUser(user_id);
165 } 165 }
166 //////////////////////////////////////////////////////////////////////////////// 166 ////////////////////////////////////////////////////////////////////////////////
167 // ChromeLoginPerformer, private: 167 // ChromeLoginPerformer, private:
168 168
(...skipping 10 matching lines...) Expand all
179 const base::Closure& failure_callback, 179 const base::Closure& failure_callback,
180 policy::WildcardLoginChecker::Result result) { 180 policy::WildcardLoginChecker::Result result) {
181 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { 181 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) {
182 success_callback.Run(); 182 success_callback.Run();
183 } else { 183 } else {
184 failure_callback.Run(); 184 failure_callback.Run();
185 } 185 }
186 } 186 }
187 187
188 } // namespace chromeos 188 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698