| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_SUPERVISED_USER_AUTHENTICATION_H_ | 4 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_SUPERVISED_USER_AUTHENTICATION_H_ |
| 5 #define CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_SUPERVISED_USER_AUTHENTICATION_H_ | 5 #define CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_SUPERVISED_USER_AUTHENTICATION_H_ |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 typedef base::Callback<void(const base::DictionaryValue* password_data)> | 49 typedef base::Callback<void(const base::DictionaryValue* password_data)> |
| 50 PasswordDataCallback; | 50 PasswordDataCallback; |
| 51 | 51 |
| 52 explicit SupervisedUserAuthentication(SupervisedUserManager* owner); | 52 explicit SupervisedUserAuthentication(SupervisedUserManager* owner); |
| 53 virtual ~SupervisedUserAuthentication(); | 53 virtual ~SupervisedUserAuthentication(); |
| 54 | 54 |
| 55 // Returns current schema for whole ChromeOS. It defines if users with older | 55 // Returns current schema for whole ChromeOS. It defines if users with older |
| 56 // schema should be migrated somehow. | 56 // schema should be migrated somehow. |
| 57 Schema GetStableSchema(); | 57 Schema GetStableSchema(); |
| 58 | 58 |
| 59 // Transforms password according to schema specified in Local State. | 59 // Transforms key according to schema specified in Local State. |
| 60 std::string TransformPassword(const std::string& supervised_user_id, | 60 UserContext TransformKey(const UserContext& context); |
| 61 const std::string& password); | |
| 62 | |
| 63 // Transforms password according to schema specified in Local State. | |
| 64 UserContext TransformPasswordInContext(const UserContext& context); | |
| 65 | 61 |
| 66 // Fills |password_data| with |password|-specific data for |user_id|, | 62 // Fills |password_data| with |password|-specific data for |user_id|, |
| 67 // depending on target schema. Does not affect Local State. | 63 // depending on target schema. Does not affect Local State. |
| 68 bool FillDataForNewUser(const std::string& user_id, | 64 bool FillDataForNewUser(const std::string& user_id, |
| 69 const std::string& password, | 65 const std::string& password, |
| 70 base::DictionaryValue* password_data, | 66 base::DictionaryValue* password_data, |
| 71 base::DictionaryValue* extra_data); | 67 base::DictionaryValue* extra_data); |
| 72 | 68 |
| 73 // Stores |password_data| for |user_id| in Local State. Only public parts | 69 // Stores |password_data| for |user_id| in Local State. Only public parts |
| 74 // of |password_data| will be stored. | 70 // of |password_data| will be stored. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 98 std::string GenerateMasterKey(); | 94 std::string GenerateMasterKey(); |
| 99 | 95 |
| 100 // Called by supervised user to store password data for migration upon signin. | 96 // Called by supervised user to store password data for migration upon signin. |
| 101 void ScheduleSupervisedPasswordChange( | 97 void ScheduleSupervisedPasswordChange( |
| 102 const std::string& supervised_user_id, | 98 const std::string& supervised_user_id, |
| 103 const base::DictionaryValue* password_data); | 99 const base::DictionaryValue* password_data); |
| 104 | 100 |
| 105 // Utility method that gets schema version for |user_id| from Local State. | 101 // Utility method that gets schema version for |user_id| from Local State. |
| 106 Schema GetPasswordSchema(const std::string& user_id); | 102 Schema GetPasswordSchema(const std::string& user_id); |
| 107 | 103 |
| 108 static std::string BuildPasswordForHashWithSaltSchema( | |
| 109 const std::string& salt, | |
| 110 const std::string& plain_password); | |
| 111 | |
| 112 static std::string BuildPasswordSignature( | 104 static std::string BuildPasswordSignature( |
| 113 const std::string& password, | 105 const std::string& password, |
| 114 int revision, | 106 int revision, |
| 115 const std::string& base64_signature_key); | 107 const std::string& base64_signature_key); |
| 116 | 108 |
| 117 private: | 109 private: |
| 118 SupervisedUserManager* owner_; | 110 SupervisedUserManager* owner_; |
| 119 | 111 |
| 120 // Controls if migration is enabled. | 112 // Controls if migration is enabled. |
| 121 bool migration_enabled_; | 113 bool migration_enabled_; |
| 122 | 114 |
| 123 // Target schema version. Affects migration process and new user creation. | 115 // Target schema version. Affects migration process and new user creation. |
| 124 Schema stable_schema_; | 116 Schema stable_schema_; |
| 125 | 117 |
| 126 | 118 |
| 127 DISALLOW_COPY_AND_ASSIGN(SupervisedUserAuthentication); | 119 DISALLOW_COPY_AND_ASSIGN(SupervisedUserAuthentication); |
| 128 }; | 120 }; |
| 129 | 121 |
| 130 } // namespace chromeos | 122 } // namespace chromeos |
| 131 | 123 |
| 132 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_SUPERVISED_USER_AUTHENTICATION_
H_ | 124 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_SUPERVISED_USER_AUTHENTICATION_
H_ |
| OLD | NEW |