| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Update ClientLogin credentials in the token service. | 128 // Update ClientLogin credentials in the token service. |
| 129 // Afterwards you can StartFetchingTokens. | 129 // Afterwards you can StartFetchingTokens. |
| 130 void UpdateCredentials( | 130 void UpdateCredentials( |
| 131 const GaiaAuthConsumer::ClientLoginResult& credentials); | 131 const GaiaAuthConsumer::ClientLoginResult& credentials); |
| 132 | 132 |
| 133 // Update credentials in the token service with oauth2 tokens. | 133 // Update credentials in the token service with oauth2 tokens. |
| 134 // Afterwards you can StartFetchingTokens. | 134 // Afterwards you can StartFetchingTokens. |
| 135 void UpdateCredentialsWithOAuth2( | 135 void UpdateCredentialsWithOAuth2( |
| 136 const GaiaAuthConsumer::ClientOAuthResult& credentials); | 136 const GaiaAuthConsumer::ClientOAuthResult& credentials); |
| 137 | 137 |
| 138 // Remove the OAuth2 token. |
| 139 void ClearOAuth2Credentials(); |
| 140 |
| 138 // Terminate any running requests and reset the TokenService to a clean | 141 // Terminate any running requests and reset the TokenService to a clean |
| 139 // slate. Resets in memory structures. Does not modify the DB. | 142 // slate. Resets in memory structures. Does not modify the DB. |
| 140 // When this is done, no tokens will be left in memory and no | 143 // When this is done, no tokens will be left in memory and no |
| 141 // user credentials will be left. Useful if a user is logging out. | 144 // user credentials will be left. Useful if a user is logging out. |
| 142 // Initialize doesn't need to be called again but UpdateCredentials does. | 145 // Initialize doesn't need to be called again but UpdateCredentials does. |
| 143 void ResetCredentialsInMemory(); | 146 void ResetCredentialsInMemory(); |
| 144 | 147 |
| 145 // Async load all tokens for services we know of from the DB. | 148 // Async load all tokens for services we know of from the DB. |
| 146 // You should do this at startup. Optionally you can do it again | 149 // You should do this at startup. Optionally you can do it again |
| 147 // after you reset in memory credentials. | 150 // after you reset in memory credentials. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 261 |
| 259 friend class TokenServiceTest; | 262 friend class TokenServiceTest; |
| 260 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); | 263 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); |
| 261 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); | 264 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); |
| 262 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); | 265 FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, FullIntegrationNewServicesAdded); |
| 263 | 266 |
| 264 DISALLOW_COPY_AND_ASSIGN(TokenService); | 267 DISALLOW_COPY_AND_ASSIGN(TokenService); |
| 265 }; | 268 }; |
| 266 | 269 |
| 267 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ | 270 #endif // CHROME_BROWSER_SIGNIN_TOKEN_SERVICE_H_ |
| OLD | NEW |