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() {
account_id_,
base::BindOnce(&GaiaWebAuthFlow::OnUbertokenFetchComplete,
base::Unretained(this)),
gaia::GaiaSource::kChrome, profile_->GetURLLoaderFactory(),
/*bound_to_channel_id=*/false);
gaia::GaiaSource::kChrome, profile_->GetURLLoaderFactory());
}
void GaiaWebAuthFlow::OnUbertokenFetchComplete(GoogleServiceAuthError error,
......
......@@ -34,28 +34,24 @@ UbertokenFetcherImpl::UbertokenFetcherImpl(
ProfileOAuth2TokenService* token_service,
CompletionCallback ubertoken_callback,
gaia::GaiaSource source,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
bool is_bound_to_channel_id)
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: UbertokenFetcherImpl(account_id,
/*access_token=*/"",
token_service,
std::move(ubertoken_callback),
base::BindRepeating(CreateGaiaAuthFetcher,
source,
url_loader_factory),
is_bound_to_channel_id) {}
url_loader_factory)) {}
UbertokenFetcherImpl::UbertokenFetcherImpl(
const CoreAccountId& account_id,
const std::string& access_token,
ProfileOAuth2TokenService* token_service,
CompletionCallback ubertoken_callback,
GaiaAuthFetcherFactory factory,
bool is_bound_to_channel_id)
GaiaAuthFetcherFactory factory)
: OAuth2AccessTokenManager::Consumer("uber_token_fetcher"),
token_service_(token_service),
ubertoken_callback_(std::move(ubertoken_callback)),
is_bound_to_channel_id_(is_bound_to_channel_id),
gaia_auth_fetcher_factory_(factory),
account_id_(account_id),
access_token_(access_token),
......@@ -146,8 +142,7 @@ void UbertokenFetcherImpl::RequestAccessToken() {
void UbertokenFetcherImpl::ExchangeTokens() {
gaia_auth_fetcher_ = gaia_auth_fetcher_factory_.Run(this);
gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange(
access_token_, is_bound_to_channel_id_);
gaia_auth_fetcher_->StartTokenFetchForUberAuthExchange(access_token_);
}
} // namespace signin
......@@ -55,16 +55,14 @@ class UbertokenFetcherImpl : public UbertokenFetcher,
ProfileOAuth2TokenService* token_service,
CompletionCallback ubertoken_callback,
gaia::GaiaSource source,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
bool is_bound_to_channel_id = true);
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory);
// Constructs an instance and starts fetching the ubertoken for |account_id|.
UbertokenFetcherImpl(const CoreAccountId& account_id,
const std::string& access_token,
ProfileOAuth2TokenService* token_service,
CompletionCallback ubertoken_callback,
GaiaAuthFetcherFactory factory,
bool is_bound_to_channel_id = true);
GaiaAuthFetcherFactory factory);
~UbertokenFetcherImpl() override;
// Overridden from GaiaAuthConsumer
......@@ -87,7 +85,6 @@ class UbertokenFetcherImpl : public UbertokenFetcher,
ProfileOAuth2TokenService* token_service_;
CompletionCallback ubertoken_callback_;
bool is_bound_to_channel_id_; // defaults to true
GaiaAuthFetcherFactory gaia_auth_fetcher_factory_;
std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_;
std::unique_ptr<OAuth2AccessTokenManager::Request> access_token_request_;
......
......@@ -296,11 +296,10 @@ IdentityManager::CreateUbertokenFetcherForAccount(
const CoreAccountId& account_id,
UbertokenFetcher::CompletionCallback callback,
gaia::GaiaSource source,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
bool bount_to_channel_id) {
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) {
return std::make_unique<UbertokenFetcherImpl>(
account_id, token_service_.get(), std::move(callback), source,
url_loader_factory, bount_to_channel_id);
url_loader_factory);
}
AccountsInCookieJarInfo IdentityManager::GetAccountsInCookieJar() const {
......
......@@ -295,8 +295,7 @@ class IdentityManager : public KeyedService,
const CoreAccountId& account_id,
UbertokenFetcher::CompletionCallback callback,
gaia::GaiaSource source,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
bool bound_to_channel_id = true);
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory);
// Provides the information of all accounts that are present in the Gaia
// cookie in the cookie jar, ordered by their order in the cookie.
......
......@@ -620,16 +620,13 @@ void GaiaAuthFetcher::StartMergeSession(const std::string& uber_token,
}
void GaiaAuthFetcher::StartTokenFetchForUberAuthExchange(
const std::string& access_token,
bool is_bound_to_channel_id) {
const std::string& access_token) {
DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
VLOG(1) << "Starting StartTokenFetchForUberAuthExchange with access_token="
<< access_token;
std::string authentication_header =
base::StringPrintf(kOAuthHeaderFormat, access_token.c_str());
int load_flags =
is_bound_to_channel_id ? net::LOAD_NORMAL : kLoadFlagsIgnoreCookies;
net::NetworkTrafficAnnotationTag traffic_annotation =
net::DefineNetworkTrafficAnnotation("gaia_auth_fetch_for_uber", R"(
semantics {
......@@ -658,7 +655,7 @@ void GaiaAuthFetcher::StartTokenFetchForUberAuthExchange(
}
})");
CreateAndStartGaiaFetcher(std::string(), authentication_header,
uberauth_token_gurl_, load_flags,
uberauth_token_gurl_, kLoadFlagsIgnoreCookies,
traffic_annotation);
}
......
......@@ -143,13 +143,10 @@ class GaiaAuthFetcher {
// 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
// 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
// called on the consumer on the original thread.
void StartTokenFetchForUberAuthExchange(const std::string& access_token,
bool is_bound_to_channel_id);
void StartTokenFetchForUberAuthExchange(const std::string& access_token);
// Start a request to exchange an OAuthLogin-scoped oauth2 access token for a
// ClientLogin-style service tokens. The response to this request is the
......
......@@ -464,8 +464,7 @@ TEST_F(GaiaAuthFetcherTest, UberAuthTokenSuccess) {
EXPECT_CALL(consumer, OnUberAuthTokenSuccess("uberToken")).Times(1);
TestGaiaAuthFetcher auth(&consumer, GetURLLoaderFactory());
auth.StartTokenFetchForUberAuthExchange("myAccessToken",
true /* is_bound_to_channel_id */);
auth.StartTokenFetchForUberAuthExchange("myAccessToken");
EXPECT_TRUE(auth.HasPendingFetch());
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