IdentityManager: Introduce access token fetching for arbitrary accounts
The next-generation C++ APIs for interacting with the user's Google identities currently do not give the ability to fetch access tokens for arbitrary accounts; rather, there exists only the PrimaryAccountAccessTokenFetcher, which provides user-friendly access token fetching for the primary account. This CL introduces an analogous AccessTokenFetcher class that allows such user-friendly access token fetching for arbitrary accounts. This class is currently built on top of the Token Service, as it remains future work to expose access token fetching APIs on IdentityManager itself. Once that future work is completed, AccessTokenFetcher will be ported to be layered on top of IdentityManager. In the meantime, we introduce IdentityManager::CreateAccessTokenFetcherForAccount() to allow consumers of IdentityManager to create an AccessTokenFetcher. Note that our intention is that even in the long-term consumers will use AccessTokenFetcher and PrimaryAccountAccessTokenFetcher as the interfaces for fetching access tokens, rather than interacting directly with IdentityManager's lower-level APIs. This CL also ports PrimaryAccountAccessTokenFetcher to internally use AccessTokenFetcher rather than directly fetching access tokens from ProfileOAuth2TokenService. API design note: It would be reasonable to build PAATF's idea of an "access token fetching mode" into AccessTokenFetcher: in this context, kWaitUntilAvailable would simply mean waiting until the refresh token was available. This CL does not add such a mode. However, for Sync's use case having the mode will likely be useful (Sync will alternately use the primary account and an arbitrary account, and it would be ergonomic to be able to fetch access tokens in both contexts using AccessTokenFetcher). Hence, followup work will move this mode down into AccessTokenFetcher. Bug: 729547 Change-Id: Id296adcd1567d6cbfbaf6ffd1dafb718c1f01ed7 Reviewed-on: https://chromium-review.googlesource.com/1104118 Commit-Queue: Colin Blundell <blundell@chromium.org> Reviewed-by:Marc Treib <treib@chromium.org> Cr-Commit-Position: refs/heads/master@{#569281}
Showing
This diff is collapsed.
Please register or sign in to comment