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

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

Issue 10918027: Revert 154457 - Switch from SignedSettings to DeviceSettingsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 #include "chrome/browser/chromeos/login/login_performer.h" 5 #include "chrome/browser/chromeos/login/login_performer.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 screen_lock_requested_ = false; 251 screen_lock_requested_ = false;
252 ResolveScreenLocked(); 252 ResolveScreenLocked();
253 } 253 }
254 } else { 254 } else {
255 ResolveScreenUnlocked(); 255 ResolveScreenUnlocked();
256 } 256 }
257 } 257 }
258 258
259 //////////////////////////////////////////////////////////////////////////////// 259 ////////////////////////////////////////////////////////////////////////////////
260 // LoginPerformer, public: 260 // LoginPerformer, public:
261 void LoginPerformer::PerformLogin(const std::string& username, 261 void LoginPerformer::CompleteLogin(const std::string& username,
262 const std::string& password, 262 const std::string& password) {
263 AuthorizationMode auth_mode) { 263 auth_mode_ = AUTH_MODE_EXTENSION;
264 auth_mode_ = auth_mode;
265 username_ = username; 264 username_ = username;
266 password_ = password; 265 password_ = password;
267 266
268 CrosSettings* cros_settings = CrosSettings::Get(); 267 CrosSettings* cros_settings = CrosSettings::Get();
269 268
270 // Whitelist check is always performed during initial login and 269 // Whitelist check is always performed during initial login and
271 // should not be performed when ScreenLock is active (pending online auth). 270 // should not be performed when ScreenLock is active (pending online auth).
272 if (!ScreenLocker::default_screen_locker()) { 271 if (!ScreenLocker::default_screen_locker()) {
273 CrosSettingsProvider::TrustedStatus status = 272 CrosSettingsProvider::TrustedStatus status =
274 cros_settings->PrepareTrustedValues( 273 cros_settings->PrepareTrustedValues(
275 base::Bind(&LoginPerformer::PerformLogin, 274 base::Bind(&LoginPerformer::CompleteLogin,
276 weak_factory_.GetWeakPtr(), 275 weak_factory_.GetWeakPtr(),
277 username, password, auth_mode)); 276 username, password));
278 // Must not proceed without signature verification. 277 // Must not proceed without signature verification.
279 if (status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) { 278 if (status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) {
280 if (delegate_) 279 if (delegate_)
281 delegate_->PolicyLoadFailed(); 280 delegate_->PolicyLoadFailed();
282 else 281 else
283 NOTREACHED(); 282 NOTREACHED();
284 return; 283 return;
285 } else if (status != CrosSettingsProvider::TRUSTED) { 284 } else if (status != CrosSettingsProvider::TRUSTED) {
286 // Value of AllowNewUser setting is still not verified. 285 // Value of AllowNewUser setting is still not verified.
287 // Another attempt will be invoked after verification completion. 286 // Another attempt will be invoked after verification completion.
288 return; 287 return;
289 } 288 }
290 } 289 }
291 290
292 bool is_whitelisted = LoginUtils::IsWhitelisted( 291 bool is_whitelisted = LoginUtils::IsWhitelisted(
293 gaia::CanonicalizeEmail(username)); 292 gaia::CanonicalizeEmail(username));
294 if (ScreenLocker::default_screen_locker() || is_whitelisted) { 293 if (ScreenLocker::default_screen_locker() || is_whitelisted) {
295 switch (auth_mode_) { 294 // Starts authentication if guest login is allowed or online auth pending.
296 case AUTH_MODE_EXTENSION: 295 StartLoginCompletion();
297 StartLoginCompletion();
298 break;
299 case AUTH_MODE_INTERNAL:
300 StartAuthentication();
301 break;
302 }
303 } else { 296 } else {
304 if (delegate_) 297 if (delegate_)
305 delegate_->WhiteListCheckFailed(username); 298 delegate_->WhiteListCheckFailed(username);
299 else
300 NOTREACHED();
301 }
302 }
303
304 void LoginPerformer::Login(const std::string& username,
305 const std::string& password) {
306 auth_mode_ = AUTH_MODE_INTERNAL;
307 username_ = username;
308 password_ = password;
309
310 CrosSettings* cros_settings = CrosSettings::Get();
311
312 // Whitelist check is always performed during initial login and
313 // should not be performed when ScreenLock is active (pending online auth).
314 if (!ScreenLocker::default_screen_locker()) {
315 CrosSettingsProvider::TrustedStatus status =
316 cros_settings->PrepareTrustedValues(
317 base::Bind(&LoginPerformer::Login,
318 weak_factory_.GetWeakPtr(),
319 username, password));
320 // Must not proceed without signature verification.
321 if (status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) {
322 if (delegate_)
323 delegate_->PolicyLoadFailed();
324 else
325 NOTREACHED();
326 return;
327 } else if (status != CrosSettingsProvider::TRUSTED) {
328 // Value of AllowNewUser setting is still not verified.
329 // Another attempt will be invoked after verification completion.
330 return;
331 }
332 }
333
334 bool is_whitelisted = LoginUtils::IsWhitelisted(username);
335 if (ScreenLocker::default_screen_locker() || is_whitelisted) {
336 // Starts authentication if guest login is allowed or online auth pending.
337 StartAuthentication();
338 } else {
339 if (delegate_)
340 delegate_->WhiteListCheckFailed(username);
306 else 341 else
307 NOTREACHED(); 342 NOTREACHED();
308 } 343 }
309 } 344 }
310 345
311 void LoginPerformer::LoginDemoUser() { 346 void LoginPerformer::LoginDemoUser() {
312 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); 347 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this);
313 BrowserThread::PostTask( 348 BrowserThread::PostTask(
314 BrowserThread::UI, FROM_HERE, 349 BrowserThread::UI, FROM_HERE,
315 base::Bind(&Authenticator::LoginDemoUser, authenticator_.get())); 350 base::Bind(&Authenticator::LoginDemoUser, authenticator_.get()));
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 profile, 565 profile,
531 username_, 566 username_,
532 password_, 567 password_,
533 std::string(), 568 std::string(),
534 std::string())); 569 std::string()));
535 } 570 }
536 password_.clear(); 571 password_.clear();
537 } 572 }
538 573
539 } // namespace chromeos 574 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_performer.h ('k') | chrome/browser/chromeos/login/login_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698