| 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 CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CONTRO
LLER_NEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CONTRO
LLER_NEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CONTRO
LLER_NEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CONTRO
LLER_NEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller.h" | 16 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller.h" |
| 17 #include "chrome/browser/supervised_user/legacy/supervised_user_registration_uti
lity.h" | 17 #include "chrome/browser/supervised_user/legacy/supervised_user_registration_uti
lity.h" |
| 18 #include "chromeos/login/auth/extended_authenticator.h" | 18 #include "chromeos/login/auth/extended_authenticator.h" |
| 19 #include "components/signin/core/account_id/account_id.h" |
| 19 | 20 |
| 20 class Profile; | 21 class Profile; |
| 21 | 22 |
| 22 namespace chromeos { | 23 namespace chromeos { |
| 23 | 24 |
| 24 class UserContext; | 25 class UserContext; |
| 25 | 26 |
| 26 // Supervised user creation process: | 27 // Supervised user creation process: |
| 27 // 0. Manager is logged in | 28 // 0. Manager is logged in |
| 28 // 1. Generate ID for new supervised user | 29 // 1. Generate ID for new supervised user |
| 29 // 2. Start "transaction" in Local State. | 30 // 2. Start "transaction" in Local State. |
| 30 // 3, Generate keys for user : master key, salt, encryption and signature keys. | 31 // 3, Generate keys for user : master key, salt, encryption and signature keys. |
| 31 // 4. Create local cryptohome (errors could arise) | 32 // 4. Create local cryptohome (errors could arise) |
| 32 // 5. Create user in cloud (errors could arise) | 33 // 5. Create user in cloud (errors could arise) |
| 33 // 6. Store cloud token in cryptohome (actually, error could arise). | 34 // 6. Store cloud token in cryptohome (actually, error could arise). |
| 34 // 7. Mark "transaction" as completed. | 35 // 7. Mark "transaction" as completed. |
| 35 // 8. End manager session. | 36 // 8. End manager session. |
| 36 class SupervisedUserCreationControllerNew | 37 class SupervisedUserCreationControllerNew |
| 37 : public SupervisedUserCreationController, | 38 : public SupervisedUserCreationController, |
| 38 public ExtendedAuthenticator::NewAuthStatusConsumer { | 39 public ExtendedAuthenticator::NewAuthStatusConsumer { |
| 39 public: | 40 public: |
| 40 // All UI initialization is deferred till Init() call. | 41 // All UI initialization is deferred till Init() call. |
| 41 // |Consumer| is not owned by controller, and it is expected that it wouldn't | 42 // |Consumer| is not owned by controller, and it is expected that it wouldn't |
| 42 // be deleted before SupervisedUserCreationControllerNew. | 43 // be deleted before SupervisedUserCreationControllerNew. |
| 43 SupervisedUserCreationControllerNew(StatusConsumer* consumer, | 44 SupervisedUserCreationControllerNew(StatusConsumer* consumer, |
| 44 const std::string& manager_id); | 45 const AccountId& manager_id); |
| 45 ~SupervisedUserCreationControllerNew() override; | 46 ~SupervisedUserCreationControllerNew() override; |
| 46 | 47 |
| 47 // Returns the current supervised user controller if it has been created. | 48 // Returns the current supervised user controller if it has been created. |
| 48 static SupervisedUserCreationControllerNew* current_controller() { | 49 static SupervisedUserCreationControllerNew* current_controller() { |
| 49 return current_controller_; | 50 return current_controller_; |
| 50 } | 51 } |
| 51 | 52 |
| 52 // Set up controller for creating new supervised user with |display_name|, | 53 // Set up controller for creating new supervised user with |display_name|, |
| 53 // |password| and avatar indexed by |avatar_index|. StartCreation() have to | 54 // |password| and avatar indexed by |avatar_index|. StartCreation() have to |
| 54 // be called to actually start creating user. | 55 // be called to actually start creating user. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 enum CreationType { NEW_USER, USER_IMPORT_OLD, USER_IMPORT_NEW, }; | 113 enum CreationType { NEW_USER, USER_IMPORT_OLD, USER_IMPORT_NEW, }; |
| 113 | 114 |
| 114 // Contains information necessary for new user creation. | 115 // Contains information necessary for new user creation. |
| 115 struct UserCreationContext { | 116 struct UserCreationContext { |
| 116 UserCreationContext(); | 117 UserCreationContext(); |
| 117 ~UserCreationContext(); | 118 ~UserCreationContext(); |
| 118 | 119 |
| 119 base::string16 display_name; | 120 base::string16 display_name; |
| 120 int avatar_index; | 121 int avatar_index; |
| 121 | 122 |
| 122 std::string manager_id; | 123 AccountId manager_id = EmptyAccountId(); |
| 123 | 124 |
| 124 std::string local_user_id; // Used to identify cryptohome. | 125 std::string local_user_id; // Used to identify cryptohome. |
| 125 std::string sync_user_id; // Used to identify user in manager's sync data. | 126 std::string sync_user_id; // Used to identify user in manager's sync data. |
| 126 | 127 |
| 127 // Keys: | 128 // Keys: |
| 128 std::string master_key; // Random string | 129 std::string master_key; // Random string |
| 129 std::string signature_key; // 256 bit HMAC key | 130 std::string signature_key; // 256 bit HMAC key |
| 130 std::string encryption_key; // 256 bit HMAC key | 131 std::string encryption_key; // 256 bit HMAC key |
| 131 std::string salted_password; // Hash(salt + Hash(password)) | 132 std::string salted_password; // Hash(salt + Hash(password)) |
| 132 | 133 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 184 |
| 184 // Factory of callbacks. | 185 // Factory of callbacks. |
| 185 base::WeakPtrFactory<SupervisedUserCreationControllerNew> weak_factory_; | 186 base::WeakPtrFactory<SupervisedUserCreationControllerNew> weak_factory_; |
| 186 | 187 |
| 187 DISALLOW_COPY_AND_ASSIGN(SupervisedUserCreationControllerNew); | 188 DISALLOW_COPY_AND_ASSIGN(SupervisedUserCreationControllerNew); |
| 188 }; | 189 }; |
| 189 | 190 |
| 190 } // namespace chromeos | 191 } // namespace chromeos |
| 191 | 192 |
| 192 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CON
TROLLER_NEW_H_ | 193 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CON
TROLLER_NEW_H_ |
| OLD | NEW |