OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GOOGLE_AUTHENTICATOR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_GOOGLE_AUTHENTICATOR_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_GOOGLE_AUTHENTICATOR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_GOOGLE_AUTHENTICATOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 28 matching lines...) Expand all Loading... |
39 class GoogleAuthenticator : public Authenticator, public GaiaAuthConsumer { | 39 class GoogleAuthenticator : public Authenticator, public GaiaAuthConsumer { |
40 public: | 40 public: |
41 explicit GoogleAuthenticator(LoginStatusConsumer* consumer); | 41 explicit GoogleAuthenticator(LoginStatusConsumer* consumer); |
42 virtual ~GoogleAuthenticator(); | 42 virtual ~GoogleAuthenticator(); |
43 | 43 |
44 // Given externally authenticated |username| and |password|, this method | 44 // Given externally authenticated |username| and |password|, this method |
45 // attempts to complete authentication process. The ultimate result is either | 45 // attempts to complete authentication process. The ultimate result is either |
46 // a callback to consumer_->OnLoginSuccess() with the |username| and a vector | 46 // a callback to consumer_->OnLoginSuccess() with the |username| and a vector |
47 // of authentication cookies or a callback to consumer_->OnLoginFailure() with | 47 // of authentication cookies or a callback to consumer_->OnLoginFailure() with |
48 // an error message. | 48 // an error message. |
49 // Returns true if the attempt gets sent successfully and false if not. | 49 virtual void CompleteLogin(Profile* profile, |
50 virtual bool CompleteLogin(Profile* profile, | |
51 const std::string& username, | 50 const std::string& username, |
52 const std::string& password) OVERRIDE; | 51 const std::string& password) OVERRIDE; |
53 | 52 |
54 // Given a |username| and |password|, this method attempts to authenticate to | 53 // Given a |username| and |password|, this method attempts to authenticate to |
55 // the Google accounts servers. The ultimate result is either a callback to | 54 // the Google accounts servers. The ultimate result is either a callback to |
56 // consumer_->OnLoginSuccess() with the |username| and a vector of | 55 // consumer_->OnLoginSuccess() with the |username| and a vector of |
57 // authentication cookies or a callback to consumer_->OnLoginFailure() with | 56 // authentication cookies or a callback to consumer_->OnLoginFailure() with |
58 // an error message. Uses |profile| when doing URL fetches. | 57 // an error message. Uses |profile| when doing URL fetches. |
59 // Optionally could pass CAPTCHA challenge token - |login_token| and | 58 // Optionally could pass CAPTCHA challenge token - |login_token| and |
60 // |login_captcha| string that user has entered. | 59 // |login_captcha| string that user has entered. |
61 // | 60 // |
62 // NOTE: We do not allow HOSTED accounts to log in. In the event that | 61 // NOTE: We do not allow HOSTED accounts to log in. In the event that |
63 // we are asked to authenticate valid HOSTED account creds, we will | 62 // we are asked to authenticate valid HOSTED account creds, we will |
64 // call OnLoginFailure() with HOSTED_NOT_ALLOWED. | 63 // call OnLoginFailure() with HOSTED_NOT_ALLOWED. |
65 // | 64 virtual void AuthenticateToLogin(Profile* profile, |
66 // Returns true if the attempt gets sent successfully and false if not. | |
67 virtual bool AuthenticateToLogin(Profile* profile, | |
68 const std::string& username, | 65 const std::string& username, |
69 const std::string& password, | 66 const std::string& password, |
70 const std::string& login_token, | 67 const std::string& login_token, |
71 const std::string& login_captcha) OVERRIDE; | 68 const std::string& login_captcha) OVERRIDE; |
72 | 69 |
73 // Given a |username| and |password|, this method attempts to | 70 // Given a |username| and |password|, this method attempts to |
74 // authenticate to the cached credentials. This will never contact | 71 // authenticate to the cached credentials. This will never contact |
75 // the server even if it's online. The auth result is sent to | 72 // the server even if it's online. The auth result is sent to |
76 // LoginStatusConsumer in a same way as AuthenticateToLogin does. | 73 // LoginStatusConsumer in a same way as AuthenticateToLogin does. |
77 virtual bool AuthenticateToUnlock(const std::string& username, | 74 virtual void AuthenticateToUnlock(const std::string& username, |
78 const std::string& password) OVERRIDE; | 75 const std::string& password) OVERRIDE; |
79 | 76 |
80 // Initiates incognito ("browse without signing in") login. | 77 // Initiates incognito ("browse without signing in") login. |
81 // Mounts tmpfs and notifies consumer on the success/failure. | 78 // Mounts tmpfs and notifies consumer on the success/failure. |
82 virtual void LoginOffTheRecord() OVERRIDE; | 79 virtual void LoginOffTheRecord() OVERRIDE; |
83 | 80 |
84 // Public for testing. | 81 // Public for testing. |
85 void set_system_salt(const chromeos::CryptohomeBlob& new_salt) { | 82 void set_system_salt(const chromeos::CryptohomeBlob& new_salt) { |
86 system_salt_ = new_salt; | 83 system_salt_ = new_salt; |
87 } | 84 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, LoginNetFailure); | 245 FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, LoginNetFailure); |
249 FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, LoginDenied); | 246 FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, LoginDenied); |
250 FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, TwoFactorLogin); | 247 FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, TwoFactorLogin); |
251 | 248 |
252 DISALLOW_COPY_AND_ASSIGN(GoogleAuthenticator); | 249 DISALLOW_COPY_AND_ASSIGN(GoogleAuthenticator); |
253 }; | 250 }; |
254 | 251 |
255 } // namespace chromeos | 252 } // namespace chromeos |
256 | 253 |
257 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_GOOGLE_AUTHENTICATOR_H_ | 254 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_GOOGLE_AUTHENTICATOR_H_ |
OLD | NEW |