Commit b19a2944 authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

Remove channel id binding from fetching uber tokens.

Support for channel ID binding was removed from Chrome a while back.
This CL removes some boolean that was referring to channel ID binding
from uber token fetcher.

Fixed: 1021455
Change-Id: I195056e7b3a2446afc1714c7394040b0171b6602
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1899851Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarRyan Sleevi <rsleevi@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713775}
parent 97ee89da
...@@ -90,8 +90,7 @@ void GaiaWebAuthFlow::Start() { ...@@ -90,8 +90,7 @@ void GaiaWebAuthFlow::Start() {
account_id_, account_id_,
base::BindOnce(&GaiaWebAuthFlow::OnUbertokenFetchComplete, base::BindOnce(&GaiaWebAuthFlow::OnUbertokenFetchComplete,
base::Unretained(this)), base::Unretained(this)),
gaia::GaiaSource::kChrome, profile_->GetURLLoaderFactory(), gaia::GaiaSource::kChrome, profile_->GetURLLoaderFactory());
/*bound_to_channel_id=*/false);
} }
void GaiaWebAuthFlow::OnUbertokenFetchComplete(GoogleServiceAuthError error, void GaiaWebAuthFlow::OnUbertokenFetchComplete(GoogleServiceAuthError error,
......
...@@ -34,28 +34,24 @@ UbertokenFetcherImpl::UbertokenFetcherImpl( ...@@ -34,28 +34,24 @@ UbertokenFetcherImpl::UbertokenFetcherImpl(
ProfileOAuth2TokenService* token_service, ProfileOAuth2TokenService* token_service,
CompletionCallback ubertoken_callback, CompletionCallback ubertoken_callback,
gaia::GaiaSource source, gaia::GaiaSource source,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
bool is_bound_to_channel_id)
: UbertokenFetcherImpl(account_id, : UbertokenFetcherImpl(account_id,
/*access_token=*/"", /*access_token=*/"",
token_service, token_service,
std::move(ubertoken_callback), std::move(ubertoken_callback),
base::BindRepeating(CreateGaiaAuthFetcher, base::BindRepeating(CreateGaiaAuthFetcher,
source, source,
url_loader_factory), url_loader_factory)) {}
is_bound_to_channel_id) {}
UbertokenFetcherImpl::UbertokenFetcherImpl( UbertokenFetcherImpl::UbertokenFetcherImpl(
const CoreAccountId& account_id, const CoreAccountId& account_id,
const std::string& access_token, const std::string& access_token,
ProfileOAuth2TokenService* token_service, ProfileOAuth2TokenService* token_service,
CompletionCallback ubertoken_callback, CompletionCallback ubertoken_callback,
GaiaAuthFetcherFactory factory, GaiaAuthFetcherFactory factory)
bool is_bound_to_channel_id)
: OAuth2AccessTokenManager::Consumer("uber_token_fetcher"), : OAuth2AccessTokenManager::Consumer("uber_token_fetcher"),
token_service_(token_service), token_service_(token_service),
ubertoken_callback_(std::move(ubertoken_callback)), ubertoken_callback_(std::move(ubertoken_callback)),
is_bound_to_channel_id_(is_bound_to_channel_id),
gaia_auth_fetcher_factory_(factory), gaia_auth_fetcher_factory_(factory),
account_id_(account_id), account_id_(account_id),
access_token_(access_token), access_token_(access_token),
...@@ -146,8 +142,7 @@ void UbertokenFetcherImpl::RequestAccessToken() { ...@@ -146,8 +142,7 @@ void UbertokenFetcherImpl::RequestAccessToken() {
void UbertokenFetcherImpl::ExchangeTokens() { void UbertokenFetcherImpl::ExchangeTokens() {
gaia_auth_fetcher_ = gaia_auth_fetcher_factory_.Run(this); gaia_auth_fetcher_ = gaia_auth_fetcher_factory_.Run(this);
gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange( gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange(access_token_);
access_token_, is_bound_to_channel_id_);
} }
} // namespace signin } // namespace signin
...@@ -55,16 +55,14 @@ class UbertokenFetcherImpl : public UbertokenFetcher, ...@@ -55,16 +55,14 @@ class UbertokenFetcherImpl : public UbertokenFetcher,
ProfileOAuth2TokenService* token_service, ProfileOAuth2TokenService* token_service,
CompletionCallback ubertoken_callback, CompletionCallback ubertoken_callback,
gaia::GaiaSource source, gaia::GaiaSource source,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory);
bool is_bound_to_channel_id = true);
// Constructs an instance and starts fetching the ubertoken for |account_id|. // Constructs an instance and starts fetching the ubertoken for |account_id|.
UbertokenFetcherImpl(const CoreAccountId& account_id, UbertokenFetcherImpl(const CoreAccountId& account_id,
const std::string& access_token, const std::string& access_token,
ProfileOAuth2TokenService* token_service, ProfileOAuth2TokenService* token_service,
CompletionCallback ubertoken_callback, CompletionCallback ubertoken_callback,
GaiaAuthFetcherFactory factory, GaiaAuthFetcherFactory factory);
bool is_bound_to_channel_id = true);
~UbertokenFetcherImpl() override; ~UbertokenFetcherImpl() override;
// Overridden from GaiaAuthConsumer // Overridden from GaiaAuthConsumer
...@@ -87,7 +85,6 @@ class UbertokenFetcherImpl : public UbertokenFetcher, ...@@ -87,7 +85,6 @@ class UbertokenFetcherImpl : public UbertokenFetcher,
ProfileOAuth2TokenService* token_service_; ProfileOAuth2TokenService* token_service_;
CompletionCallback ubertoken_callback_; CompletionCallback ubertoken_callback_;
bool is_bound_to_channel_id_; // defaults to true
GaiaAuthFetcherFactory gaia_auth_fetcher_factory_; GaiaAuthFetcherFactory gaia_auth_fetcher_factory_;
std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_;
std::unique_ptr<OAuth2AccessTokenManager::Request> access_token_request_; std::unique_ptr<OAuth2AccessTokenManager::Request> access_token_request_;
......
...@@ -296,11 +296,10 @@ IdentityManager::CreateUbertokenFetcherForAccount( ...@@ -296,11 +296,10 @@ IdentityManager::CreateUbertokenFetcherForAccount(
const CoreAccountId& account_id, const CoreAccountId& account_id,
UbertokenFetcher::CompletionCallback callback, UbertokenFetcher::CompletionCallback callback,
gaia::GaiaSource source, gaia::GaiaSource source,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) {
bool bount_to_channel_id) {
return std::make_unique<UbertokenFetcherImpl>( return std::make_unique<UbertokenFetcherImpl>(
account_id, token_service_.get(), std::move(callback), source, account_id, token_service_.get(), std::move(callback), source,
url_loader_factory, bount_to_channel_id); url_loader_factory);
} }
AccountsInCookieJarInfo IdentityManager::GetAccountsInCookieJar() const { AccountsInCookieJarInfo IdentityManager::GetAccountsInCookieJar() const {
......
...@@ -295,8 +295,7 @@ class IdentityManager : public KeyedService, ...@@ -295,8 +295,7 @@ class IdentityManager : public KeyedService,
const CoreAccountId& account_id, const CoreAccountId& account_id,
UbertokenFetcher::CompletionCallback callback, UbertokenFetcher::CompletionCallback callback,
gaia::GaiaSource source, gaia::GaiaSource source,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory);
bool bound_to_channel_id = true);
// Provides the information of all accounts that are present in the Gaia // Provides the information of all accounts that are present in the Gaia
// cookie in the cookie jar, ordered by their order in the cookie. // cookie in the cookie jar, ordered by their order in the cookie.
......
...@@ -620,16 +620,13 @@ void GaiaAuthFetcher::StartMergeSession(const std::string& uber_token, ...@@ -620,16 +620,13 @@ void GaiaAuthFetcher::StartMergeSession(const std::string& uber_token,
} }
void GaiaAuthFetcher::StartTokenFetchForUberAuthExchange( void GaiaAuthFetcher::StartTokenFetchForUberAuthExchange(
const std::string& access_token, const std::string& access_token) {
bool is_bound_to_channel_id) {
DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
VLOG(1) << "Starting StartTokenFetchForUberAuthExchange with access_token=" VLOG(1) << "Starting StartTokenFetchForUberAuthExchange with access_token="
<< access_token; << access_token;
std::string authentication_header = std::string authentication_header =
base::StringPrintf(kOAuthHeaderFormat, access_token.c_str()); base::StringPrintf(kOAuthHeaderFormat, access_token.c_str());
int load_flags =
is_bound_to_channel_id ? net::LOAD_NORMAL : kLoadFlagsIgnoreCookies;
net::NetworkTrafficAnnotationTag traffic_annotation = net::NetworkTrafficAnnotationTag traffic_annotation =
net::DefineNetworkTrafficAnnotation("gaia_auth_fetch_for_uber", R"( net::DefineNetworkTrafficAnnotation("gaia_auth_fetch_for_uber", R"(
semantics { semantics {
...@@ -658,7 +655,7 @@ void GaiaAuthFetcher::StartTokenFetchForUberAuthExchange( ...@@ -658,7 +655,7 @@ void GaiaAuthFetcher::StartTokenFetchForUberAuthExchange(
} }
})"); })");
CreateAndStartGaiaFetcher(std::string(), authentication_header, CreateAndStartGaiaFetcher(std::string(), authentication_header,
uberauth_token_gurl_, load_flags, uberauth_token_gurl_, kLoadFlagsIgnoreCookies,
traffic_annotation); traffic_annotation);
} }
......
...@@ -143,13 +143,10 @@ class GaiaAuthFetcher { ...@@ -143,13 +143,10 @@ class GaiaAuthFetcher {
// Start a request to exchange an OAuthLogin-scoped oauth2 access token for an // Start a request to exchange an OAuthLogin-scoped oauth2 access token for an
// uber-auth token. The returned token can be used with the method // uber-auth token. The returned token can be used with the method
// StartMergeSession(). // StartMergeSession().
// If |is_bound_to_channel_id| is true, then the generated UberToken will
// be bound to the channel ID of the network context of |getter_|.
// //
// Either OnUberAuthTokenSuccess or OnUberAuthTokenFailure will be // Either OnUberAuthTokenSuccess or OnUberAuthTokenFailure will be
// called on the consumer on the original thread. // called on the consumer on the original thread.
void StartTokenFetchForUberAuthExchange(const std::string& access_token, void StartTokenFetchForUberAuthExchange(const std::string& access_token);
bool is_bound_to_channel_id);
// Start a request to exchange an OAuthLogin-scoped oauth2 access token for a // Start a request to exchange an OAuthLogin-scoped oauth2 access token for a
// ClientLogin-style service tokens. The response to this request is the // ClientLogin-style service tokens. The response to this request is the
......
...@@ -464,8 +464,7 @@ TEST_F(GaiaAuthFetcherTest, UberAuthTokenSuccess) { ...@@ -464,8 +464,7 @@ TEST_F(GaiaAuthFetcherTest, UberAuthTokenSuccess) {
EXPECT_CALL(consumer, OnUberAuthTokenSuccess("uberToken")).Times(1); EXPECT_CALL(consumer, OnUberAuthTokenSuccess("uberToken")).Times(1);
TestGaiaAuthFetcher auth(&consumer, GetURLLoaderFactory()); TestGaiaAuthFetcher auth(&consumer, GetURLLoaderFactory());
auth.StartTokenFetchForUberAuthExchange("myAccessToken", auth.StartTokenFetchForUberAuthExchange("myAccessToken");
true /* is_bound_to_channel_id */);
EXPECT_TRUE(auth.HasPendingFetch()); EXPECT_TRUE(auth.HasPendingFetch());
auth.TestOnURLLoadCompleteInternal(net::OK, net::HTTP_OK, "uberToken"); auth.TestOnURLLoadCompleteInternal(net::OK, net::HTTP_OK, "uberToken");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment