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 #ifndef CHROMEOS_LOGIN_AUTH_CRYPTOHOME_AUTHENTICATOR_H_ | 5 #ifndef CHROMEOS_LOGIN_AUTH_CRYPTOHOME_AUTHENTICATOR_H_ |
6 #define CHROMEOS_LOGIN_AUTH_CRYPTOHOME_AUTHENTICATOR_H_ | 6 #define CHROMEOS_LOGIN_AUTH_CRYPTOHOME_AUTHENTICATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "base/task_runner.h" | 15 #include "base/task_runner.h" |
16 #include "chromeos/chromeos_export.h" | 16 #include "chromeos/chromeos_export.h" |
17 #include "chromeos/login/auth/auth_attempt_state.h" | 17 #include "chromeos/login/auth/auth_attempt_state.h" |
18 #include "chromeos/login/auth/auth_attempt_state_resolver.h" | 18 #include "chromeos/login/auth/auth_attempt_state_resolver.h" |
19 #include "chromeos/login/auth/authenticator.h" | 19 #include "chromeos/login/auth/authenticator.h" |
20 #include "chromeos/login/auth/test_attempt_state.h" | 20 #include "chromeos/login/auth/test_attempt_state.h" |
21 #include "google_apis/gaia/gaia_auth_consumer.h" | 21 #include "google_apis/gaia/gaia_auth_consumer.h" |
22 | 22 |
23 class AuthFailure; | 23 class AuthFailure; |
24 class Profile; | 24 |
| 25 namespace content { |
| 26 class BrowserContext; |
| 27 } |
25 | 28 |
26 namespace chromeos { | 29 namespace chromeos { |
27 | 30 |
28 class AuthStatusConsumer; | 31 class AuthStatusConsumer; |
29 | 32 |
30 // Authenticates a Chromium OS user against cryptohome. | 33 // Authenticates a Chromium OS user against cryptohome. |
31 // Relies on the fact that online authentications has been already performed | 34 // Relies on the fact that online authentications has been already performed |
32 // (i.e. using_oauth_ is true). | 35 // (i.e. using_oauth_ is true). |
33 // | 36 // |
34 // At a high, level, here's what happens: | 37 // At a high, level, here's what happens: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 FAILED_USERNAME_HASH = 22, // Failed GetSanitizedUsername request. | 89 FAILED_USERNAME_HASH = 22, // Failed GetSanitizedUsername request. |
87 KIOSK_ACCOUNT_LOGIN = 23, // Logged into a kiosk account. | 90 KIOSK_ACCOUNT_LOGIN = 23, // Logged into a kiosk account. |
88 REMOVED_DATA_AFTER_FAILURE = 24, // Successfully removed the user's | 91 REMOVED_DATA_AFTER_FAILURE = 24, // Successfully removed the user's |
89 // cryptohome after a login failure. | 92 // cryptohome after a login failure. |
90 }; | 93 }; |
91 | 94 |
92 CryptohomeAuthenticator(scoped_refptr<base::TaskRunner> task_runner, | 95 CryptohomeAuthenticator(scoped_refptr<base::TaskRunner> task_runner, |
93 AuthStatusConsumer* consumer); | 96 AuthStatusConsumer* consumer); |
94 | 97 |
95 // Authenticator overrides. | 98 // Authenticator overrides. |
96 virtual void CompleteLogin(Profile* profile, | 99 virtual void CompleteLogin(content::BrowserContext* context, |
97 const UserContext& user_context) override; | 100 const UserContext& user_context) override; |
98 | 101 |
99 // Given |user_context|, this method attempts to authenticate to your | 102 // Given |user_context|, this method attempts to authenticate to your |
100 // Chrome OS device. As soon as we have successfully mounted the encrypted | 103 // Chrome OS device. As soon as we have successfully mounted the encrypted |
101 // home directory for the user, we will call consumer_->OnAuthSuccess() | 104 // home directory for the user, we will call consumer_->OnAuthSuccess() |
102 // with the username. | 105 // with the username. |
103 // Upon failure to login consumer_->OnAuthFailure() is called | 106 // Upon failure to login consumer_->OnAuthFailure() is called |
104 // with an error message. | 107 // with an error message. |
105 // | 108 // |
106 // Uses |profile| when doing URL fetches. | 109 // Uses |context| when doing URL fetches. |
107 virtual void AuthenticateToLogin(Profile* profile, | 110 virtual void AuthenticateToLogin(content::BrowserContext* context, |
108 const UserContext& user_context) override; | 111 const UserContext& user_context) override; |
109 | 112 |
110 // Given |user_context|, this method attempts to authenticate to the cached | 113 // Given |user_context|, this method attempts to authenticate to the cached |
111 // user_context. This will never contact the server even if it's online. | 114 // user_context. This will never contact the server even if it's online. |
112 // The auth result is sent to AuthStatusConsumer in a same way as | 115 // The auth result is sent to AuthStatusConsumer in a same way as |
113 // AuthenticateToLogin does. | 116 // AuthenticateToLogin does. |
114 virtual void AuthenticateToUnlock(const UserContext& user_context) override; | 117 virtual void AuthenticateToUnlock(const UserContext& user_context) override; |
115 | 118 |
116 // Initiates supervised user login. | 119 // Initiates supervised user login. |
117 // Creates cryptohome if missing or mounts existing one and | 120 // Creates cryptohome if missing or mounts existing one and |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // When |remove_user_data_on_failure_| is set, we delay calling | 263 // When |remove_user_data_on_failure_| is set, we delay calling |
261 // consumer_->OnAuthFailure() until we removed the user cryptohome. | 264 // consumer_->OnAuthFailure() until we removed the user cryptohome. |
262 const AuthFailure* delayed_login_failure_; | 265 const AuthFailure* delayed_login_failure_; |
263 | 266 |
264 DISALLOW_COPY_AND_ASSIGN(CryptohomeAuthenticator); | 267 DISALLOW_COPY_AND_ASSIGN(CryptohomeAuthenticator); |
265 }; | 268 }; |
266 | 269 |
267 } // namespace chromeos | 270 } // namespace chromeos |
268 | 271 |
269 #endif // CHROMEOS_LOGIN_AUTH_CRYPTOHOME_AUTHENTICATOR_H_ | 272 #endif // CHROMEOS_LOGIN_AUTH_CRYPTOHOME_AUTHENTICATOR_H_ |
OLD | NEW |