Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // 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 either to call ClientLogin to derive a new | 7 // the token service is expected either to call ClientLogin to derive a new |
| 8 // SID and LSID, or to use GAIA OAuth requests to derive an OAuth1 access | 8 // SID and LSID, or to use GAIA OAuth requests to derive an OAuth1 access |
| 9 // token for the OAuthLogin scope. Whenever such credentials are available, | 9 // token for the OAuthLogin scope. Whenever such credentials are available, |
| 10 // the TokenService should be updated with new credentials. The controller | 10 // the TokenService should be updated with new credentials. The controller |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 const std::string& GetTokenForService(const char* const service) const; | 145 const std::string& GetTokenForService(const char* const service) const; |
| 146 | 146 |
| 147 // OAuth login token is an all-powerful token that allows creating OAuth2 | 147 // OAuth login token is an all-powerful token that allows creating OAuth2 |
| 148 // tokens for any other scope (i.e. down-scoping). | 148 // tokens for any other scope (i.e. down-scoping). |
| 149 // Typical use is to create an OAuth2 token for appropriate scope and then | 149 // Typical use is to create an OAuth2 token for appropriate scope and then |
| 150 // use that token to call a Google API. | 150 // use that token to call a Google API. |
| 151 virtual bool HasOAuthLoginToken() const; | 151 virtual bool HasOAuthLoginToken() const; |
| 152 virtual const std::string& GetOAuth2LoginRefreshToken() const; | 152 virtual const std::string& GetOAuth2LoginRefreshToken() const; |
| 153 const std::string& GetOAuth2LoginAccessToken() const; | 153 const std::string& GetOAuth2LoginAccessToken() const; |
| 154 | 154 |
| 155 // Called when a sync token is successfully read from the credential cache. | |
| 156 // Saves the token to DB and notifies observers. | |
| 157 void SaveCachedSyncTokenToDB(const std::string& sync_token); | |
|
Andrew T Wilson (Slow)
2012/07/20 01:04:05
I think the intended way for external components t
Raghu Simha
2012/07/20 23:35:22
Agree. This method is no longer required.
| |
| 158 | |
| 155 // For tests only. Doesn't save to the WebDB. | 159 // For tests only. Doesn't save to the WebDB. |
| 156 void IssueAuthTokenForTest(const std::string& service, | 160 void IssueAuthTokenForTest(const std::string& service, |
| 157 const std::string& auth_token); | 161 const std::string& auth_token); |
| 158 | 162 |
| 159 // GaiaAuthConsumer implementation. | 163 // GaiaAuthConsumer implementation. |
| 160 virtual void OnIssueAuthTokenSuccess(const std::string& service, | 164 virtual void OnIssueAuthTokenSuccess(const std::string& service, |
| 161 const std::string& auth_token) OVERRIDE; | 165 const std::string& auth_token) OVERRIDE; |
| 162 virtual void OnIssueAuthTokenFailure( | 166 virtual void OnIssueAuthTokenFailure( |
| 163 const std::string& service, | 167 const std::string& service, |
| 164 const GoogleServiceAuthError& error) OVERRIDE; | 168 const GoogleServiceAuthError& error) OVERRIDE; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 | 237 |
| 234 friend class TokenServiceTest; | 238 friend class TokenServiceTest; |
| 235 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); | 239 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); |
| 236 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); | 240 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); |
| 237 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); | 241 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); |
| 238 | 242 |
| 239 DISALLOW_COPY_AND_ASSIGN(TokenService); | 243 DISALLOW_COPY_AND_ASSIGN(TokenService); |
| 240 }; | 244 }; |
| 241 | 245 |
| 242 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ | 246 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ |
| OLD | NEW |