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" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 KIOSK_ACCOUNT_LOGIN = 23, // Logged into a kiosk account. | 87 KIOSK_ACCOUNT_LOGIN = 23, // Logged into a kiosk account. |
88 REMOVED_DATA_AFTER_FAILURE = 24, // Successfully removed the user's | 88 REMOVED_DATA_AFTER_FAILURE = 24, // Successfully removed the user's |
89 // cryptohome after a login failure. | 89 // cryptohome after a login failure. |
90 }; | 90 }; |
91 | 91 |
92 CryptohomeAuthenticator(scoped_refptr<base::TaskRunner> task_runner, | 92 CryptohomeAuthenticator(scoped_refptr<base::TaskRunner> task_runner, |
93 AuthStatusConsumer* consumer); | 93 AuthStatusConsumer* consumer); |
94 | 94 |
95 // Authenticator overrides. | 95 // Authenticator overrides. |
96 virtual void CompleteLogin(Profile* profile, | 96 virtual void CompleteLogin(Profile* profile, |
97 const UserContext& user_context) OVERRIDE; | 97 const UserContext& user_context) override; |
98 | 98 |
99 // Given |user_context|, this method attempts to authenticate to your | 99 // Given |user_context|, this method attempts to authenticate to your |
100 // Chrome OS device. As soon as we have successfully mounted the encrypted | 100 // Chrome OS device. As soon as we have successfully mounted the encrypted |
101 // home directory for the user, we will call consumer_->OnAuthSuccess() | 101 // home directory for the user, we will call consumer_->OnAuthSuccess() |
102 // with the username. | 102 // with the username. |
103 // Upon failure to login consumer_->OnAuthFailure() is called | 103 // Upon failure to login consumer_->OnAuthFailure() is called |
104 // with an error message. | 104 // with an error message. |
105 // | 105 // |
106 // Uses |profile| when doing URL fetches. | 106 // Uses |profile| when doing URL fetches. |
107 virtual void AuthenticateToLogin(Profile* profile, | 107 virtual void AuthenticateToLogin(Profile* profile, |
108 const UserContext& user_context) OVERRIDE; | 108 const UserContext& user_context) override; |
109 | 109 |
110 // Given |user_context|, this method attempts to authenticate to the cached | 110 // 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. | 111 // 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 | 112 // The auth result is sent to AuthStatusConsumer in a same way as |
113 // AuthenticateToLogin does. | 113 // AuthenticateToLogin does. |
114 virtual void AuthenticateToUnlock(const UserContext& user_context) OVERRIDE; | 114 virtual void AuthenticateToUnlock(const UserContext& user_context) override; |
115 | 115 |
116 // Initiates supervised user login. | 116 // Initiates supervised user login. |
117 // Creates cryptohome if missing or mounts existing one and | 117 // Creates cryptohome if missing or mounts existing one and |
118 // notifies consumer on the success/failure. | 118 // notifies consumer on the success/failure. |
119 virtual void LoginAsSupervisedUser(const UserContext& user_context) OVERRIDE; | 119 virtual void LoginAsSupervisedUser(const UserContext& user_context) override; |
120 | 120 |
121 // Initiates retail mode login. | 121 // Initiates retail mode login. |
122 // Mounts tmpfs and notifies consumer on the success/failure. | 122 // Mounts tmpfs and notifies consumer on the success/failure. |
123 virtual void LoginRetailMode() OVERRIDE; | 123 virtual void LoginRetailMode() override; |
124 | 124 |
125 // Initiates incognito ("browse without signing in") login. | 125 // Initiates incognito ("browse without signing in") login. |
126 // Mounts tmpfs and notifies consumer on the success/failure. | 126 // Mounts tmpfs and notifies consumer on the success/failure. |
127 virtual void LoginOffTheRecord() OVERRIDE; | 127 virtual void LoginOffTheRecord() override; |
128 | 128 |
129 // Initiates login into a public session. | 129 // Initiates login into a public session. |
130 // Mounts an ephemeral cryptohome and notifies consumer on the | 130 // Mounts an ephemeral cryptohome and notifies consumer on the |
131 // success/failure. | 131 // success/failure. |
132 virtual void LoginAsPublicSession(const UserContext& user_context) OVERRIDE; | 132 virtual void LoginAsPublicSession(const UserContext& user_context) override; |
133 | 133 |
134 // Initiates login into the kiosk mode account identified by |app_user_id|. | 134 // Initiates login into the kiosk mode account identified by |app_user_id|. |
135 // Mounts an ephemeral guest cryptohome if |use_guest_mount| is |true|. | 135 // Mounts an ephemeral guest cryptohome if |use_guest_mount| is |true|. |
136 // Otherwise, mounts a public cryptohome, which will be ephemeral if the | 136 // Otherwise, mounts a public cryptohome, which will be ephemeral if the |
137 // |DeviceEphemeralUsersEnabled| policy is enabled and non-ephemeral | 137 // |DeviceEphemeralUsersEnabled| policy is enabled and non-ephemeral |
138 // otherwise. | 138 // otherwise. |
139 virtual void LoginAsKioskAccount(const std::string& app_user_id, | 139 virtual void LoginAsKioskAccount(const std::string& app_user_id, |
140 bool use_guest_mount) OVERRIDE; | 140 bool use_guest_mount) override; |
141 | 141 |
142 // These methods must be called on the UI thread, as they make DBus calls | 142 // These methods must be called on the UI thread, as they make DBus calls |
143 // and also call back to the login UI. | 143 // and also call back to the login UI. |
144 virtual void OnRetailModeAuthSuccess() OVERRIDE; | 144 virtual void OnRetailModeAuthSuccess() override; |
145 virtual void OnAuthSuccess() OVERRIDE; | 145 virtual void OnAuthSuccess() override; |
146 virtual void OnAuthFailure(const AuthFailure& error) OVERRIDE; | 146 virtual void OnAuthFailure(const AuthFailure& error) override; |
147 virtual void RecoverEncryptedData(const std::string& old_password) OVERRIDE; | 147 virtual void RecoverEncryptedData(const std::string& old_password) override; |
148 virtual void ResyncEncryptedData() OVERRIDE; | 148 virtual void ResyncEncryptedData() override; |
149 | 149 |
150 // AuthAttemptStateResolver overrides. | 150 // AuthAttemptStateResolver overrides. |
151 // Attempts to make a decision and call back |consumer_| based on | 151 // Attempts to make a decision and call back |consumer_| based on |
152 // the state we have gathered at the time of call. If a decision | 152 // the state we have gathered at the time of call. If a decision |
153 // can't be made, defers until the next time this is called. | 153 // can't be made, defers until the next time this is called. |
154 // When a decision is made, will call back to |consumer_| on the UI thread. | 154 // When a decision is made, will call back to |consumer_| on the UI thread. |
155 // | 155 // |
156 // Must be called on the UI thread. | 156 // Must be called on the UI thread. |
157 virtual void Resolve() OVERRIDE; | 157 virtual void Resolve() override; |
158 | 158 |
159 void OnOffTheRecordAuthSuccess(); | 159 void OnOffTheRecordAuthSuccess(); |
160 void OnPasswordChangeDetected(); | 160 void OnPasswordChangeDetected(); |
161 | 161 |
162 protected: | 162 protected: |
163 virtual ~CryptohomeAuthenticator(); | 163 virtual ~CryptohomeAuthenticator(); |
164 | 164 |
165 typedef base::Callback<void(bool is_owner)> IsOwnerCallback; | 165 typedef base::Callback<void(bool is_owner)> IsOwnerCallback; |
166 | 166 |
167 // Method to be implemented in child. Return |true| if user specified in | 167 // Method to be implemented in child. Return |true| if user specified in |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // When |remove_user_data_on_failure_| is set, we delay calling | 260 // When |remove_user_data_on_failure_| is set, we delay calling |
261 // consumer_->OnAuthFailure() until we removed the user cryptohome. | 261 // consumer_->OnAuthFailure() until we removed the user cryptohome. |
262 const AuthFailure* delayed_login_failure_; | 262 const AuthFailure* delayed_login_failure_; |
263 | 263 |
264 DISALLOW_COPY_AND_ASSIGN(CryptohomeAuthenticator); | 264 DISALLOW_COPY_AND_ASSIGN(CryptohomeAuthenticator); |
265 }; | 265 }; |
266 | 266 |
267 } // namespace chromeos | 267 } // namespace chromeos |
268 | 268 |
269 #endif // CHROMEOS_LOGIN_AUTH_CRYPTOHOME_AUTHENTICATOR_H_ | 269 #endif // CHROMEOS_LOGIN_AUTH_CRYPTOHOME_AUTHENTICATOR_H_ |
OLD | NEW |