| OLD | NEW |
| 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 "chromeos/login/auth/stub_authenticator.h" | 5 #include "chromeos/login/auth/stub_authenticator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 FROM_HERE, base::Bind(&StubAuthenticator::OnAuthFailure, this, | 49 FROM_HERE, base::Bind(&StubAuthenticator::OnAuthFailure, this, |
| 50 AuthFailure::FromNetworkAuthFailure(error))); | 50 AuthFailure::FromNetworkAuthFailure(error))); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void StubAuthenticator::AuthenticateToUnlock(const UserContext& user_context) { | 53 void StubAuthenticator::AuthenticateToUnlock(const UserContext& user_context) { |
| 54 AuthenticateToLogin(NULL /* not used */, user_context); | 54 AuthenticateToLogin(NULL /* not used */, user_context); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void StubAuthenticator::LoginAsSupervisedUser(const UserContext& user_context) { | 57 void StubAuthenticator::LoginAsSupervisedUser(const UserContext& user_context) { |
| 58 UserContext new_user_context = user_context; | 58 UserContext new_user_context = user_context; |
| 59 new_user_context.SetUserIDHash(user_context.GetUserID() + kUserIdHashSuffix); | 59 new_user_context.SetUserIDHash(user_context.GetUserID().GetUserEmail() + kUser
IdHashSuffix); |
| 60 consumer_->OnAuthSuccess(new_user_context); | 60 consumer_->OnAuthSuccess(new_user_context); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void StubAuthenticator::LoginOffTheRecord() { | 63 void StubAuthenticator::LoginOffTheRecord() { |
| 64 consumer_->OnOffTheRecordAuthSuccess(); | 64 consumer_->OnOffTheRecordAuthSuccess(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void StubAuthenticator::LoginAsPublicSession(const UserContext& user_context) { | 67 void StubAuthenticator::LoginAsPublicSession(const UserContext& user_context) { |
| 68 UserContext logged_in_user_context = user_context; | 68 UserContext logged_in_user_context = user_context; |
| 69 logged_in_user_context.SetIsUsingOAuth(false); | 69 logged_in_user_context.SetIsUsingOAuth(false); |
| 70 logged_in_user_context.SetUserIDHash(logged_in_user_context.GetUserID() + | 70 logged_in_user_context.SetUserIDHash(logged_in_user_context.GetUserID().GetUse
rEmail() + |
| 71 kUserIdHashSuffix); | 71 kUserIdHashSuffix); |
| 72 consumer_->OnAuthSuccess(logged_in_user_context); | 72 consumer_->OnAuthSuccess(logged_in_user_context); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void StubAuthenticator::LoginAsKioskAccount(const std::string& app_user_id, | 75 void StubAuthenticator::LoginAsKioskAccount(const user_manager::UserID& app_user
_id, |
| 76 bool use_guest_mount) { | 76 bool use_guest_mount) { |
| 77 UserContext user_context(expected_user_context_.GetUserID()); | 77 UserContext user_context(expected_user_context_.GetUserID()); |
| 78 user_context.SetIsUsingOAuth(false); | 78 user_context.SetIsUsingOAuth(false); |
| 79 user_context.SetUserIDHash(expected_user_context_.GetUserID() + | 79 user_context.SetUserIDHash(expected_user_context_.GetUserID().GetUserEmail() + |
| 80 kUserIdHashSuffix); | 80 kUserIdHashSuffix); |
| 81 consumer_->OnAuthSuccess(user_context); | 81 consumer_->OnAuthSuccess(user_context); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void StubAuthenticator::OnAuthSuccess() { | 84 void StubAuthenticator::OnAuthSuccess() { |
| 85 // If we want to be more like the real thing, we could save the user ID | 85 // If we want to be more like the real thing, we could save the user ID |
| 86 // in AuthenticateToLogin, but there's not much of a point. | 86 // in AuthenticateToLogin, but there's not much of a point. |
| 87 UserContext user_context(expected_user_context_); | 87 UserContext user_context(expected_user_context_); |
| 88 user_context.SetUserIDHash(expected_user_context_.GetUserID() + | 88 user_context.SetUserIDHash(expected_user_context_.GetUserID().GetUserEmail() + |
| 89 kUserIdHashSuffix); | 89 kUserIdHashSuffix); |
| 90 consumer_->OnAuthSuccess(user_context); | 90 consumer_->OnAuthSuccess(user_context); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void StubAuthenticator::OnAuthFailure(const AuthFailure& failure) { | 93 void StubAuthenticator::OnAuthFailure(const AuthFailure& failure) { |
| 94 consumer_->OnAuthFailure(failure); | 94 consumer_->OnAuthFailure(failure); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void StubAuthenticator::RecoverEncryptedData(const std::string& old_password) { | 97 void StubAuthenticator::RecoverEncryptedData(const std::string& old_password) { |
| 98 } | 98 } |
| 99 | 99 |
| 100 void StubAuthenticator::ResyncEncryptedData() { | 100 void StubAuthenticator::ResyncEncryptedData() { |
| 101 } | 101 } |
| 102 | 102 |
| 103 void StubAuthenticator::SetExpectedCredentials( | 103 void StubAuthenticator::SetExpectedCredentials( |
| 104 const UserContext& user_context) { | 104 const UserContext& user_context) { |
| 105 expected_user_context_ = user_context; | 105 expected_user_context_ = user_context; |
| 106 } | 106 } |
| 107 | 107 |
| 108 StubAuthenticator::~StubAuthenticator() { | 108 StubAuthenticator::~StubAuthenticator() { |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace chromeos | 111 } // namespace chromeos |
| OLD | NEW |