Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: chrome/browser/chromeos/login/supervised/supervised_user_authentication.h

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_AUTHENTICATION_ H_ 4 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_AUTHENTICATION_ H_
5 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_AUTHENTICATION_ H_ 5 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 key according to schema specified in Local State. 59 // Transforms key according to schema specified in Local State.
60 UserContext TransformKey(const UserContext& context); 60 UserContext TransformKey(const UserContext& context);
61 61
62 // Fills |password_data| with |password|-specific data for |user_id|, 62 // Fills |password_data| with |password|-specific data for |user_id|,
63 // depending on target schema. Does not affect Local State. 63 // depending on target schema. Does not affect Local State.
64 bool FillDataForNewUser(const std::string& user_id, 64 bool FillDataForNewUser(const user_manager::UserID& user_id,
65 const std::string& password, 65 const std::string& password,
66 base::DictionaryValue* password_data, 66 base::DictionaryValue* password_data,
67 base::DictionaryValue* extra_data); 67 base::DictionaryValue* extra_data);
68 68
69 // 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
70 // of |password_data| will be stored. 70 // of |password_data| will be stored.
71 void StorePasswordData(const std::string& user_id, 71 void StorePasswordData(const user_manager::UserID& user_id,
72 const base::DictionaryValue& password_data); 72 const base::DictionaryValue& password_data);
73 73
74 bool NeedPasswordChange(const std::string& user_id, 74 bool NeedPasswordChange(const user_manager::UserID& user_id,
75 const base::DictionaryValue* password_data); 75 const base::DictionaryValue* password_data);
76 76
77 // Checks if given user should update password upon signin. 77 // Checks if given user should update password upon signin.
78 bool HasScheduledPasswordUpdate(const std::string& user_id); 78 bool HasScheduledPasswordUpdate(const user_manager::UserID& user_id);
79 void ClearScheduledPasswordUpdate(const std::string& user_id); 79 void ClearScheduledPasswordUpdate(const user_manager::UserID& user_id);
80 80
81 // Checks if password was migrated to new schema by supervised user. 81 // Checks if password was migrated to new schema by supervised user.
82 // In this case it does not have encryption key, and should be updated by 82 // In this case it does not have encryption key, and should be updated by
83 // manager even if password versions match. 83 // manager even if password versions match.
84 bool HasIncompleteKey(const std::string& user_id); 84 bool HasIncompleteKey(const user_manager::UserID& user_id);
85 void MarkKeyIncomplete(const std::string& user_id, bool incomplete); 85 void MarkKeyIncomplete(const user_manager::UserID& user_id, bool incomplete);
86 86
87 // Loads password data stored by ScheduleSupervisedPasswordChange. 87 // Loads password data stored by ScheduleSupervisedPasswordChange.
88 void LoadPasswordUpdateData(const std::string& user_id, 88 void LoadPasswordUpdateData(const user_manager::UserID& user_id,
89 const PasswordDataCallback& success_callback, 89 const PasswordDataCallback& success_callback,
90 const base::Closure& failure_callback); 90 const base::Closure& failure_callback);
91 91
92 // Creates a random string that can be used as a master key for managed 92 // Creates a random string that can be used as a master key for managed
93 // user's homedir. 93 // user's homedir.
94 std::string GenerateMasterKey(); 94 std::string GenerateMasterKey();
95 95
96 // 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.
97 void ScheduleSupervisedPasswordChange( 97 void ScheduleSupervisedPasswordChange(
98 const std::string& supervised_user_id, 98 const user_manager::UserID& supervised_user_id,
99 const base::DictionaryValue* password_data); 99 const base::DictionaryValue* password_data);
100 100
101 // 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.
102 Schema GetPasswordSchema(const std::string& user_id); 102 Schema GetPasswordSchema(const user_manager::UserID& user_id);
103 103
104 static std::string BuildPasswordSignature( 104 static std::string BuildPasswordSignature(
105 const std::string& password, 105 const std::string& password,
106 int revision, 106 int revision,
107 const std::string& base64_signature_key); 107 const std::string& base64_signature_key);
108 108
109 private: 109 private:
110 SupervisedUserManager* owner_; 110 SupervisedUserManager* owner_;
111 111
112 // Target schema version. Affects migration process and new user creation. 112 // Target schema version. Affects migration process and new user creation.
113 Schema stable_schema_; 113 Schema stable_schema_;
114 114
115 115
116 DISALLOW_COPY_AND_ASSIGN(SupervisedUserAuthentication); 116 DISALLOW_COPY_AND_ASSIGN(SupervisedUserAuthentication);
117 }; 117 };
118 118
119 } // namespace chromeos 119 } // namespace chromeos
120 120
121 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_AUTHENTICATI ON_H_ 121 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_AUTHENTICATI ON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698