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 17 matching lines...) Expand all Loading... |
28 const UserContext& user_context) { | 28 const UserContext& user_context) { |
29 authentication_context_ = context; | 29 authentication_context_ = context; |
30 if (expected_user_context_ != user_context) | 30 if (expected_user_context_ != user_context) |
31 NOTREACHED(); | 31 NOTREACHED(); |
32 OnAuthSuccess(); | 32 OnAuthSuccess(); |
33 } | 33 } |
34 | 34 |
35 void StubAuthenticator::AuthenticateToLogin(content::BrowserContext* context, | 35 void StubAuthenticator::AuthenticateToLogin(content::BrowserContext* context, |
36 const UserContext& user_context) { | 36 const UserContext& user_context) { |
37 authentication_context_ = context; | 37 authentication_context_ = context; |
38 if (user_context == expected_user_context_) { | 38 // Don't compare the entire |expected_user_context_| to |user_context| because |
| 39 // during non-online re-auth |user_context| does not have a gaia id. |
| 40 if (expected_user_context_.GetUserID() == user_context.GetUserID()) { |
39 message_loop_->PostTask( | 41 message_loop_->PostTask( |
40 FROM_HERE, base::Bind(&StubAuthenticator::OnAuthSuccess, this)); | 42 FROM_HERE, base::Bind(&StubAuthenticator::OnAuthSuccess, this)); |
41 return; | 43 return; |
42 } | 44 } |
43 GoogleServiceAuthError error( | 45 GoogleServiceAuthError error( |
44 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); | 46 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
45 message_loop_->PostTask( | 47 message_loop_->PostTask( |
46 FROM_HERE, base::Bind(&StubAuthenticator::OnAuthFailure, this, | 48 FROM_HERE, base::Bind(&StubAuthenticator::OnAuthFailure, this, |
47 AuthFailure::FromNetworkAuthFailure(error))); | 49 AuthFailure::FromNetworkAuthFailure(error))); |
48 } | 50 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 101 |
100 void StubAuthenticator::SetExpectedCredentials( | 102 void StubAuthenticator::SetExpectedCredentials( |
101 const UserContext& user_context) { | 103 const UserContext& user_context) { |
102 expected_user_context_ = user_context; | 104 expected_user_context_ = user_context; |
103 } | 105 } |
104 | 106 |
105 StubAuthenticator::~StubAuthenticator() { | 107 StubAuthenticator::~StubAuthenticator() { |
106 } | 108 } |
107 | 109 |
108 } // namespace chromeos | 110 } // namespace chromeos |
OLD | NEW |