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

Side by Side Diff: chrome/browser/chromeos/login/authenticator.h

Issue 12704002: Support for auth code based authentication flow for both app and web UI driven flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase4 Created 7 years, 9 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_AUTHENTICATOR_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_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/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/chromeos/login/login_status_consumer.h" 12 #include "chrome/browser/chromeos/login/login_status_consumer.h"
13 #include "google_apis/gaia/gaia_auth_consumer.h" 13 #include "google_apis/gaia/gaia_auth_consumer.h"
14 14
15 class Profile; 15 class Profile;
16 16
17 namespace chromeos { 17 namespace chromeos {
18 18
19 struct UserCredentials;
20
19 // An interface for objects that will authenticate a Chromium OS user. 21 // An interface for objects that will authenticate a Chromium OS user.
20 // When authentication successfully completes, will call 22 // When authentication successfully completes, will call
21 // consumer_->OnLoginSuccess() on the UI thread. 23 // consumer_->OnLoginSuccess() on the UI thread.
22 // On failure, will call consumer_->OnLoginFailure() on the UI thread. 24 // On failure, will call consumer_->OnLoginFailure() on the UI thread.
23 // On password change detected, will call 25 // On password change detected, will call
24 // consumer_->OnPasswordChangeDetected() on the UI thread. 26 // consumer_->OnPasswordChangeDetected() on the UI thread.
25 class Authenticator : public base::RefCountedThreadSafe<Authenticator> { 27 class Authenticator : public base::RefCountedThreadSafe<Authenticator> {
26 public: 28 public:
27 explicit Authenticator(LoginStatusConsumer* consumer); 29 explicit Authenticator(LoginStatusConsumer* consumer);
28 30
29 // Given externally authenticated |username| and |password|, this method 31 // Given externally authenticated |username| and |password|, this method
30 // attempts to complete authentication process. 32 // attempts to complete authentication process.
31 virtual void CompleteLogin(Profile* profile, 33 virtual void CompleteLogin(Profile* profile,
32 const std::string& username, 34 const UserCredentials& credentials) = 0;
33 const std::string& password) = 0;
34 35
35 // Given a |username| and |password|, this method attempts to authenticate 36 // Given a |username| and |password|, this method attempts to authenticate
36 // to login. 37 // to login.
37 // Optionally |login_token| and |login_captcha| could be provided. 38 // Optionally |login_token| and |login_captcha| could be provided.
38 // Must be called on the UI thread. 39 // Must be called on the UI thread.
39 virtual void AuthenticateToLogin(Profile* profile, 40 virtual void AuthenticateToLogin(Profile* profile,
40 const std::string& username, 41 const UserCredentials& credentials,
41 const std::string& password,
42 const std::string& login_token, 42 const std::string& login_token,
43 const std::string& login_captcha) = 0; 43 const std::string& login_captcha) = 0;
44 44
45 // Given a |username| and |password|, this method attempts to 45 // Given a |username| and |password|, this method attempts to
46 // authenticate to unlock the computer. 46 // authenticate to unlock the computer.
47 // Must be called on the UI thread. 47 // Must be called on the UI thread.
48 virtual void AuthenticateToUnlock(const std::string& username, 48 virtual void AuthenticateToUnlock(
49 const std::string& password) = 0; 49 const UserCredentials& credentials) = 0;
50 50
51 // Initiates locally managed user login. 51 // Initiates locally managed user login.
52 virtual void LoginAsLocallyManagedUser(const std::string& username, 52 virtual void LoginAsLocallyManagedUser(
53 const std::string& password) = 0; 53 const UserCredentials& credentials) = 0;
54 54
55 // Initiates retail mode login. 55 // Initiates retail mode login.
56 virtual void LoginRetailMode() = 0; 56 virtual void LoginRetailMode() = 0;
57 57
58 // Initiates incognito ("browse without signing in") login. 58 // Initiates incognito ("browse without signing in") login.
59 virtual void LoginOffTheRecord() = 0; 59 virtual void LoginOffTheRecord() = 0;
60 60
61 // Initiates login into the public account identified by |username|. 61 // Initiates login into the public account identified by |username|.
62 virtual void LoginAsPublicAccount(const std::string& username) = 0; 62 virtual void LoginAsPublicAccount(const std::string& username) = 0;
63 63
(...skipping 17 matching lines...) Expand all
81 // his data was last encrypted with. 81 // his data was last encrypted with.
82 virtual void RecoverEncryptedData( 82 virtual void RecoverEncryptedData(
83 const std::string& old_password) = 0; 83 const std::string& old_password) = 0;
84 84
85 // Call this method to erase the user's encrypted data 85 // Call this method to erase the user's encrypted data
86 // and create a new cryptohome. 86 // and create a new cryptohome.
87 virtual void ResyncEncryptedData() = 0; 87 virtual void ResyncEncryptedData() = 0;
88 88
89 // Attempt to authenticate online again. 89 // Attempt to authenticate online again.
90 virtual void RetryAuth(Profile* profile, 90 virtual void RetryAuth(Profile* profile,
91 const std::string& username, 91 const UserCredentials& credentials,
92 const std::string& password,
93 const std::string& login_token, 92 const std::string& login_token,
94 const std::string& login_captcha) = 0; 93 const std::string& login_captcha) = 0;
95 94
96 // Profile (usually off the record ) that was used to perform the last 95 // Profile (usually off the record ) that was used to perform the last
97 // authentication process. 96 // authentication process.
98 Profile* authentication_profile() { return authentication_profile_; } 97 Profile* authentication_profile() { return authentication_profile_; }
99 98
100 // Sets consumer explicitly. 99 // Sets consumer explicitly.
101 void SetConsumer(LoginStatusConsumer* consumer); 100 void SetConsumer(LoginStatusConsumer* consumer);
102 101
103 protected: 102 protected:
104 virtual ~Authenticator(); 103 virtual ~Authenticator();
105 104
106 LoginStatusConsumer* consumer_; 105 LoginStatusConsumer* consumer_;
107 Profile* authentication_profile_; 106 Profile* authentication_profile_;
108 107
109 private: 108 private:
110 friend class base::RefCountedThreadSafe<Authenticator>; 109 friend class base::RefCountedThreadSafe<Authenticator>;
111 110
112 DISALLOW_COPY_AND_ASSIGN(Authenticator); 111 DISALLOW_COPY_AND_ASSIGN(Authenticator);
113 }; 112 };
114 113
115 } // namespace chromeos 114 } // namespace chromeos
116 115
117 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ 116 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/auth_attempt_state.cc ('k') | chrome/browser/chromeos/login/existing_user_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698