| 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 // Use this class to authenticate users with Gaia and access cookies sent | 5 // Use this class to authenticate users with Gaia and access cookies sent |
| 6 // by the Gaia servers. This class cannot be used on its own becaue it relies | 6 // by the Gaia servers. This class cannot be used on its own becaue it relies |
| 7 // on a subclass to provide the virtual Post and GetBackoffDelaySeconds methods. | 7 // on a subclass to provide the virtual Post and GetBackoffDelaySeconds methods. |
| 8 // | 8 // |
| 9 // Sample usage: | 9 // Sample usage: |
| 10 // class ActualGaiaAuthenticator : public gaia::GaiaAuthenticator { | 10 // class ActualGaiaAuthenticator : public gaia::GaiaAuthenticator { |
| 11 // Provides actual implementation of Post and GetBackoffDelaySeconds. | 11 // Provides actual implementation of Post and GetBackoffDelaySeconds. |
| 12 // }; | 12 // }; |
| 13 // ActualGaiaAuthenticator gaia_auth("User-Agent", SERVICE_NAME, kGaiaUrl); | 13 // ActualGaiaAuthenticator gaia_auth("User-Agent", SERVICE_NAME, kGaiaUrl); |
| 14 // if (gaia_auth.Authenticate("email", "passwd", SAVE_IN_MEMORY_ONLY, | 14 // if (gaia_auth.Authenticate("email", "passwd", SAVE_IN_MEMORY_ONLY, |
| 15 // true)) { // Synchronous | 15 // true)) { // Synchronous |
| 16 // // Do something with: gaia_auth.auth_token(), or gaia_auth.sid(), | 16 // // Do something with: gaia_auth.auth_token(), or gaia_auth.sid(), |
| 17 // // or gaia_auth.lsid() | 17 // // or gaia_auth.lsid() |
| 18 // } | 18 // } |
| 19 // | 19 // |
| 20 // Credentials can also be preserved for subsequent requests, though these are | 20 // Credentials can also be preserved for subsequent requests, though these are |
| 21 // saved in plain-text in memory, and not very secure on client systems. The | 21 // saved in plain-text in memory, and not very secure on client systems. The |
| 22 // email address associated with the Gaia account can be read; the password is | 22 // email address associated with the Gaia account can be read; the password is |
| 23 // write-only. | 23 // write-only. |
| 24 | 24 |
| 25 // TODO(sanjeevr): This class has been moved here from the bookmarks sync code. | 25 // TODO(sanjeevr): This class has been moved here from the bookmarks sync code. |
| 26 // While it is a generic class that handles GAIA authentication, there are some | 26 // While it is a generic class that handles GAIA authentication, there are some |
| 27 // artifacts of the sync code which needs to be cleaned up. | 27 // artifacts of the sync code which needs to be cleaned up. |
| 28 #ifndef CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR_H_ | 28 #ifndef GOOGLE_APIS_GAIA_GAIA_AUTHENTICATOR_H_ |
| 29 #define CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR_H_ | 29 #define GOOGLE_APIS_GAIA_GAIA_AUTHENTICATOR_H_ |
| 30 | 30 |
| 31 #include <string> | 31 #include <string> |
| 32 | 32 |
| 33 #include "base/basictypes.h" | 33 #include "base/basictypes.h" |
| 34 #include "base/gtest_prod_util.h" | 34 #include "base/gtest_prod_util.h" |
| 35 #include "base/message_loop.h" | 35 #include "base/message_loop.h" |
| 36 #include "googleurl/src/gurl.h" | 36 #include "googleurl/src/gurl.h" |
| 37 | 37 |
| 38 namespace gaia { | 38 namespace gaia { |
| 39 | 39 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 #else // defined(OS_WIN) | 263 #else // defined(OS_WIN) |
| 264 time_t next_allowed_auth_attempt_time_; | 264 time_t next_allowed_auth_attempt_time_; |
| 265 #endif // defined(OS_WIN) | 265 #endif // defined(OS_WIN) |
| 266 int early_auth_attempt_count_; | 266 int early_auth_attempt_count_; |
| 267 | 267 |
| 268 // The message loop all our methods are invoked on. | 268 // The message loop all our methods are invoked on. |
| 269 const MessageLoop* message_loop_; | 269 const MessageLoop* message_loop_; |
| 270 }; | 270 }; |
| 271 | 271 |
| 272 } // namespace gaia | 272 } // namespace gaia |
| 273 #endif // CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR_H_ | 273 #endif // GOOGLE_APIS_GAIA_GAIA_AUTHENTICATOR_H_ |
| OLD | NEW |