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 29 matching lines...) Expand all Loading... |
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 // Returns true if the attempt gets sent successfully and false if not. |
50 virtual bool CompleteLogin(Profile* profile, | 50 virtual void CompleteLogin(Profile* profile, |
51 const std::string& username, | 51 const std::string& username, |
52 const std::string& password) OVERRIDE; | 52 const std::string& password) OVERRIDE; |
53 | 53 |
54 // Given a |username| and |password|, this method attempts to authenticate to | 54 // Given a |username| and |password|, this method attempts to authenticate to |
55 // the Google accounts servers. The ultimate result is either a callback to | 55 // the Google accounts servers. The ultimate result is either a callback to |
56 // consumer_->OnLoginSuccess() with the |username| and a vector of | 56 // consumer_->OnLoginSuccess() with the |username| and a vector of |
57 // authentication cookies or a callback to consumer_->OnLoginFailure() with | 57 // authentication cookies or a callback to consumer_->OnLoginFailure() with |
58 // an error message. Uses |profile| when doing URL fetches. | 58 // an error message. Uses |profile| when doing URL fetches. |
59 // Optionally could pass CAPTCHA challenge token - |login_token| and | 59 // Optionally could pass CAPTCHA challenge token - |login_token| and |
60 // |login_captcha| string that user has entered. | 60 // |login_captcha| string that user has entered. |
61 // | 61 // |
62 // NOTE: We do not allow HOSTED accounts to log in. In the event that | 62 // 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 | 63 // we are asked to authenticate valid HOSTED account creds, we will |
64 // call OnLoginFailure() with HOSTED_NOT_ALLOWED. | 64 // call OnLoginFailure() with HOSTED_NOT_ALLOWED. |
65 // | 65 // |
66 // Returns true if the attempt gets sent successfully and false if not. | 66 // Returns true if the attempt gets sent successfully and false if not. |
67 virtual bool AuthenticateToLogin(Profile* profile, | 67 virtual void AuthenticateToLogin(Profile* profile, |
68 const std::string& username, | 68 const std::string& username, |
69 const std::string& password, | 69 const std::string& password, |
70 const std::string& login_token, | 70 const std::string& login_token, |
71 const std::string& login_captcha) OVERRIDE; | 71 const std::string& login_captcha) OVERRIDE; |
72 | 72 |
73 // Given a |username| and |password|, this method attempts to | 73 // Given a |username| and |password|, this method attempts to |
74 // authenticate to the cached credentials. This will never contact | 74 // authenticate to the cached credentials. This will never contact |
75 // the server even if it's online. The auth result is sent to | 75 // the server even if it's online. The auth result is sent to |
76 // LoginStatusConsumer in a same way as AuthenticateToLogin does. | 76 // LoginStatusConsumer in a same way as AuthenticateToLogin does. |
77 virtual bool AuthenticateToUnlock(const std::string& username, | 77 virtual bool AuthenticateToUnlock(const std::string& username, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, LoginNetFailure); | 248 FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, LoginNetFailure); |
249 FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, LoginDenied); | 249 FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, LoginDenied); |
250 FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, TwoFactorLogin); | 250 FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, TwoFactorLogin); |
251 | 251 |
252 DISALLOW_COPY_AND_ASSIGN(GoogleAuthenticator); | 252 DISALLOW_COPY_AND_ASSIGN(GoogleAuthenticator); |
253 }; | 253 }; |
254 | 254 |
255 } // namespace chromeos | 255 } // namespace chromeos |
256 | 256 |
257 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_GOOGLE_AUTHENTICATOR_H_ | 257 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_GOOGLE_AUTHENTICATOR_H_ |
OLD | NEW |