OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // The TokenService will supply authentication tokens for any service that | 5 // The TokenService will supply authentication tokens for any service that |
6 // needs it, such as sync. Whenever the user logs in, a controller watching | 6 // needs it, such as sync. Whenever the user logs in, a controller watching |
7 // the token service is expected to call ClientLogin to derive a new SID and | 7 // the token service is expected to call ClientLogin to derive a new SID and |
8 // LSID. Whenever such credentials are available, the TokenService should be | 8 // LSID. Whenever such credentials are available, the TokenService should be |
9 // updated with new credentials. The controller should then start fetching | 9 // updated with new credentials. The controller should then start fetching |
10 // tokens, which will be written to the database after retrieval, as well as | 10 // tokens, which will be written to the database after retrieval, as well as |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // You should do this at startup. Optionally you can do it again | 108 // You should do this at startup. Optionally you can do it again |
109 // after you reset in memory credentials. | 109 // after you reset in memory credentials. |
110 void LoadTokensFromDB(); | 110 void LoadTokensFromDB(); |
111 | 111 |
112 // Clear all DB stored tokens for the current profile. Tokens may still be | 112 // Clear all DB stored tokens for the current profile. Tokens may still be |
113 // available in memory. If a DB load is pending it may still be serviced. | 113 // available in memory. If a DB load is pending it may still be serviced. |
114 void EraseTokensFromDB(); | 114 void EraseTokensFromDB(); |
115 | 115 |
116 // For legacy services with their own auth routines, they can just read | 116 // For legacy services with their own auth routines, they can just read |
117 // the LSID out directly. Deprecated. | 117 // the LSID out directly. Deprecated. |
118 const bool HasLsid() const; | 118 bool HasLsid() const; |
119 const std::string& GetLsid() const; | 119 const std::string& GetLsid() const; |
120 // Did we get a proper LSID? | 120 // Did we get a proper LSID? |
121 const bool AreCredentialsValid() const; | 121 bool AreCredentialsValid() const; |
122 | 122 |
123 // Tokens will be fetched for all services(sync, talk) in the background. | 123 // Tokens will be fetched for all services(sync, talk) in the background. |
124 // Results come back via event channel. Services can also poll before events | 124 // Results come back via event channel. Services can also poll before events |
125 // are issued. | 125 // are issued. |
126 void StartFetchingTokens(); | 126 void StartFetchingTokens(); |
127 const bool HasTokenForService(const char* const service) const; | 127 bool HasTokenForService(const char* const service) const; |
128 const std::string& GetTokenForService(const char* const service) const; | 128 const std::string& GetTokenForService(const char* const service) const; |
129 | 129 |
130 // For tests only. Doesn't save to the WebDB. | 130 // For tests only. Doesn't save to the WebDB. |
131 void IssueAuthTokenForTest(const std::string& service, | 131 void IssueAuthTokenForTest(const std::string& service, |
132 const std::string& auth_token); | 132 const std::string& auth_token); |
133 | 133 |
134 // GaiaAuthConsumer implementation. | 134 // GaiaAuthConsumer implementation. |
135 virtual void OnIssueAuthTokenSuccess(const std::string& service, | 135 virtual void OnIssueAuthTokenSuccess(const std::string& service, |
136 const std::string& auth_token); | 136 const std::string& auth_token); |
137 virtual void OnIssueAuthTokenFailure(const std::string& service, | 137 virtual void OnIssueAuthTokenFailure(const std::string& service, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 NotificationRegistrar registrar_; | 185 NotificationRegistrar registrar_; |
186 | 186 |
187 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); | 187 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); |
188 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); | 188 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); |
189 | 189 |
190 DISALLOW_COPY_AND_ASSIGN(TokenService); | 190 DISALLOW_COPY_AND_ASSIGN(TokenService); |
191 }; | 191 }; |
192 | 192 |
193 #endif // CHROME_BROWSER_NET_GAIA_TOKEN_SERVICE_H_ | 193 #endif // CHROME_BROWSER_NET_GAIA_TOKEN_SERVICE_H_ |
OLD | NEW |