OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_SUPERVISED_USER_AUTHENTICATION_H_ | |
5 #define CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_SUPERVISED_USER_AUTHENTICATION_H_ | |
6 | |
7 #include "base/basictypes.h" | |
8 #include "base/compiler_specific.h" | |
9 #include "base/memory/weak_ptr.h" | |
10 #include "base/strings/string16.h" | |
11 #include "base/values.h" | |
12 #include "chrome/browser/chromeos/login/managed/supervised_user_login_flow.h" | |
13 | |
14 namespace chromeos { | |
15 | |
16 const int kPlainPasswordSchema = 1; | |
Nikita (slow)
2013/12/09 16:42:16
Do you need this in header? I see that these are o
Denis Kuznetsov (DE-MUC)
2013/12/12 19:45:24
Moved it to enum inside the class.
For now it's in
| |
17 const int kPasswordEncryptedWithSaltSchema = 2; | |
Bernhard Bauer
2013/12/11 14:46:43
Could you use an enum?
Denis Kuznetsov (DE-MUC)
2013/12/12 19:45:24
Done.
| |
18 | |
19 class SupervisedUserManager; | |
20 | |
21 // UserFlow implementation for signing in locally managed user. | |
Nikita (slow)
2013/12/09 16:42:16
SupervisedUserAuthentication class comment should
Denis Kuznetsov (DE-MUC)
2013/12/12 19:45:24
Done.
| |
22 class SupervisedUserAuthentication { | |
23 public: | |
24 explicit SupervisedUserAuthentication(SupervisedUserManager* owner); | |
25 virtual ~SupervisedUserAuthentication(); | |
26 | |
27 // Transforms password according to schema specified in Local State. | |
28 std::string TransformPassword(const std::string& supervised_user_id, | |
29 const std::string& password); | |
30 | |
31 // Returns |true| if current password schema for user is different from | |
32 // target schema. | |
Nikita (slow)
2013/12/09 16:42:16
nit: Can you change "target schema" to something m
Denis Kuznetsov (DE-MUC)
2013/12/12 19:45:24
Done.
| |
33 bool PasswordNeedsMigration(const std::string& user_id); | |
34 | |
35 // Schedules password migration for |user_id| with |password| as a plain text | |
36 // password. Migration should happen during |user_login_flow|. | |
37 void SchedulePasswordMigration(const std::string& user_id, | |
38 const std::string& password, | |
39 SupervisedUserLoginFlow* user_login_flow); | |
40 | |
41 // Fills |password_data| with |password|-specific data for |user_id|, | |
42 // depending on target schema. Does not affect Local State. | |
43 bool FillDataForNewUser(const std::string& user_id, | |
44 const std::string& password, | |
45 base::DictionaryValue* password_data); | |
46 | |
47 // Stores |password_data| for |user_id| in Local State. Only public parts | |
48 // of |password_data| will be stored. | |
49 void StorePasswordData(const std::string& user_id, | |
50 const base::DictionaryValue& password_data); | |
51 | |
52 std::string BuildPasswordForSchemaV2(const std::string& salt, | |
Nikita (slow)
2013/12/09 16:42:16
nit: Please add comment. Move to private API or to
Nikita (slow)
2013/12/09 17:51:08
nit: You name schema here as V2 while constant is
| |
53 const std::string& plain_password); | |
54 private: | |
55 SupervisedUserManager* owner_; | |
56 | |
57 // Controls if migration is enabled. | |
58 bool should_migrate_; | |
Nikita (slow)
2013/12/09 16:42:16
nit: migration_enabled_
Denis Kuznetsov (DE-MUC)
2013/12/12 19:45:24
Done.
| |
59 | |
60 // Target schema version. Affects migration process and new user creation. | |
61 int target_version_; | |
Nikita (slow)
2013/12/09 16:42:16
nit: current_version_ or latest_version_
Denis Kuznetsov (DE-MUC)
2013/12/12 19:45:24
Done.
| |
62 | |
63 // Utility method that gets schema version for |user_id| from Local State. | |
64 int GetPasswordSchemaVersion(const std::string& user_id); | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(SupervisedUserAuthentication); | |
67 }; | |
68 | |
69 } // namespace chromeos | |
70 | |
71 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_SUPERVISED_USER_AUTHENTICATION_ H_ | |
OLD | NEW |