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

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

Issue 393343002: Rename "managed (mode|user)" to "supervised user" (part 7) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more alphabetize (and rebase again) Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_MANAGED_MANAGED_USER_AUTHENTICATOR_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_AUTHENTICATOR_H _
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_AUTHENTICATOR_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_AUTHENTICATOR_H _
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "third_party/cros_system_api/dbus/service_constants.h" 14 #include "third_party/cros_system_api/dbus/service_constants.h"
15 15
16 namespace chromeos { 16 namespace chromeos {
17 17
18 // Authenticates locally managed users against the cryptohome. 18 // Authenticates supervised users against the cryptohome.
19 // 19 //
20 // Typical flow: 20 // Typical flow:
21 // AuthenticateToMount() calls a Cryptohome to perform offline login, 21 // AuthenticateToMount() calls a Cryptohome to perform offline login,
22 // AuthenticateToCreate() calls a Cryptohome to create new cryptohome. 22 // AuthenticateToCreate() calls a Cryptohome to create new cryptohome.
23 class ManagedUserAuthenticator 23 class SupervisedUserAuthenticator
24 : public base::RefCountedThreadSafe<ManagedUserAuthenticator> { 24 : public base::RefCountedThreadSafe<SupervisedUserAuthenticator> {
25 public: 25 public:
26 enum AuthState { 26 enum AuthState {
27 CONTINUE, // State indeterminate; try again when more info available. 27 CONTINUE, // State indeterminate; try again when more info available.
28 NO_MOUNT, // No cryptohome exist for user. 28 NO_MOUNT, // No cryptohome exist for user.
29 FAILED_MOUNT, // Failed to mount existing cryptohome - login failed. 29 FAILED_MOUNT, // Failed to mount existing cryptohome - login failed.
30 FAILED_TPM, // Failed to mount/create cryptohome because of TPM error. 30 FAILED_TPM, // Failed to mount/create cryptohome because of TPM error.
31 SUCCESS, // Login succeeded . 31 SUCCESS, // Login succeeded .
32 }; 32 };
33 33
34 class AuthAttempt { 34 class AuthAttempt {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 public: 73 public:
74 virtual ~AuthStatusConsumer() {} 74 virtual ~AuthStatusConsumer() {}
75 // The current login attempt has ended in failure, with error. 75 // The current login attempt has ended in failure, with error.
76 virtual void OnAuthenticationFailure(AuthState state) = 0; 76 virtual void OnAuthenticationFailure(AuthState state) = 0;
77 // The current login attempt has ended succesfully. 77 // The current login attempt has ended succesfully.
78 virtual void OnMountSuccess(const std::string& mount_hash) = 0; 78 virtual void OnMountSuccess(const std::string& mount_hash) = 0;
79 // The current add key attempt has ended succesfully. 79 // The current add key attempt has ended succesfully.
80 virtual void OnAddKeySuccess() = 0; 80 virtual void OnAddKeySuccess() = 0;
81 }; 81 };
82 82
83 explicit ManagedUserAuthenticator(AuthStatusConsumer* consumer); 83 explicit SupervisedUserAuthenticator(AuthStatusConsumer* consumer);
84 84
85 void AuthenticateToMount(const std::string& username, 85 void AuthenticateToMount(const std::string& username,
86 const std::string& password); 86 const std::string& password);
87 87
88 void AuthenticateToCreate(const std::string& username, 88 void AuthenticateToCreate(const std::string& username,
89 const std::string& password); 89 const std::string& password);
90 90
91 void AddMasterKey(const std::string& username, 91 void AddMasterKey(const std::string& username,
92 const std::string& password, 92 const std::string& password,
93 const std::string& master_key); 93 const std::string& master_key);
94 void Resolve(); 94 void Resolve();
95 95
96 private: 96 private:
97 friend class base::RefCountedThreadSafe<ManagedUserAuthenticator>; 97 friend class base::RefCountedThreadSafe<SupervisedUserAuthenticator>;
98 98
99 ~ManagedUserAuthenticator(); 99 ~SupervisedUserAuthenticator();
100 100
101 AuthState ResolveState(); 101 AuthState ResolveState();
102 AuthState ResolveCryptohomeFailureState(); 102 AuthState ResolveCryptohomeFailureState();
103 AuthState ResolveCryptohomeSuccessState(); 103 AuthState ResolveCryptohomeSuccessState();
104 void OnAuthenticationSuccess(const std::string& mount_hash, bool add_key); 104 void OnAuthenticationSuccess(const std::string& mount_hash, bool add_key);
105 void OnAuthenticationFailure(AuthState state); 105 void OnAuthenticationFailure(AuthState state);
106 106
107 scoped_ptr<AuthAttempt> current_state_; 107 scoped_ptr<AuthAttempt> current_state_;
108 AuthStatusConsumer* consumer_; 108 AuthStatusConsumer* consumer_;
109 109
110 DISALLOW_COPY_AND_ASSIGN(ManagedUserAuthenticator); 110 DISALLOW_COPY_AND_ASSIGN(SupervisedUserAuthenticator);
111 }; 111 };
112 112
113 } // namespace chromeos 113 } // namespace chromeos
114 114
115 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_AUTHENTICATOR_H_ 115 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_AUTHENTICATO R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698