| Index: net/http/http_auth_controller.cc
|
| diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc
|
| index d0ff5518c5599fc43957ec223f9e0d415ae0076a..b575544b7587ca260a805d1ea01f5504a83c96c4 100644
|
| --- a/net/http/http_auth_controller.cc
|
| +++ b/net/http/http_auth_controller.cc
|
| @@ -179,16 +179,12 @@ int HttpAuthController::MaybeGenerateAuthToken(const HttpRequestInfo* request,
|
| bool needs_auth = HaveAuth() || SelectPreemptiveAuth(net_log);
|
| if (!needs_auth)
|
| return OK;
|
| - const string16* username = NULL;
|
| - const string16* password = NULL;
|
| - if (identity_.source != HttpAuth::IDENT_SRC_DEFAULT_CREDENTIALS) {
|
| - username = &identity_.username;
|
| - password = &identity_.password;
|
| - }
|
| + const AuthCredentials* credentials = NULL;
|
| + if (identity_.source != HttpAuth::IDENT_SRC_DEFAULT_CREDENTIALS)
|
| + credentials = &identity_.credentials;
|
| DCHECK(auth_token_.empty());
|
| DCHECK(NULL == user_callback_);
|
| - int rv = handler_->GenerateAuthToken(username,
|
| - password,
|
| + int rv = handler_->GenerateAuthToken(credentials,
|
| request,
|
| &io_callback_,
|
| &auth_token_);
|
| @@ -233,8 +229,7 @@ bool HttpAuthController::SelectPreemptiveAuth(const BoundNetLog& net_log) {
|
| // Set the state
|
| identity_.source = HttpAuth::IDENT_SRC_PATH_LOOKUP;
|
| identity_.invalid = false;
|
| - identity_.username = entry->username();
|
| - identity_.password = entry->password();
|
| + identity_.credentials = entry->credentials();
|
| handler_.swap(handler_preemptive);
|
| return true;
|
| }
|
| @@ -381,17 +376,15 @@ int HttpAuthController::HandleAuthChallenge(
|
| return OK;
|
| }
|
|
|
| -void HttpAuthController::ResetAuth(const string16& username,
|
| - const string16& password) {
|
| +void HttpAuthController::ResetAuth(const AuthCredentials& credentials) {
|
| DCHECK(CalledOnValidThread());
|
| - DCHECK(identity_.invalid || (username.empty() && password.empty()));
|
| + DCHECK(identity_.invalid || credentials.Empty());
|
|
|
| if (identity_.invalid) {
|
| // Update the username/password.
|
| identity_.source = HttpAuth::IDENT_SRC_EXTERNAL;
|
| identity_.invalid = false;
|
| - identity_.username = username;
|
| - identity_.password = password;
|
| + identity_.credentials = credentials;
|
| }
|
|
|
| DCHECK(identity_.source != HttpAuth::IDENT_SRC_PATH_LOOKUP);
|
| @@ -417,8 +410,7 @@ void HttpAuthController::ResetAuth(const string16& username,
|
| default:
|
| http_auth_cache_->Add(auth_origin_, handler_->realm(),
|
| handler_->auth_scheme(), handler_->challenge(),
|
| - identity_.username, identity_.password,
|
| - auth_path_);
|
| + identity_.credentials, auth_path_);
|
| break;
|
| }
|
| }
|
| @@ -452,8 +444,7 @@ void HttpAuthController::InvalidateRejectedAuthFromCache() {
|
| // Note: we require the username/password to match before invalidating
|
| // since the entry in the cache may be newer than what we used last time.
|
| http_auth_cache_->Remove(auth_origin_, handler_->realm(),
|
| - handler_->auth_scheme(), identity_.username,
|
| - identity_.password);
|
| + handler_->auth_scheme(), identity_.credentials);
|
| }
|
|
|
| bool HttpAuthController::SelectNextAuthIdentityToTry() {
|
| @@ -467,9 +458,10 @@ bool HttpAuthController::SelectNextAuthIdentityToTry() {
|
| identity_.source = HttpAuth::IDENT_SRC_URL;
|
| identity_.invalid = false;
|
| // Extract the username:password from the URL.
|
| - GetIdentityFromURL(auth_url_,
|
| - &identity_.username,
|
| - &identity_.password);
|
| + string16 username;
|
| + string16 password;
|
| + GetIdentityFromURL(auth_url_, &username, &password);
|
| + identity_.credentials.Set(username, password);
|
| embedded_identity_used_ = true;
|
| // TODO(eroman): If the password is blank, should we also try combining
|
| // with a password from the cache?
|
| @@ -484,8 +476,7 @@ bool HttpAuthController::SelectNextAuthIdentityToTry() {
|
| if (entry) {
|
| identity_.source = HttpAuth::IDENT_SRC_REALM_LOOKUP;
|
| identity_.invalid = false;
|
| - identity_.username = entry->username();
|
| - identity_.password = entry->password();
|
| + identity_.credentials = entry->credentials();
|
| return true;
|
| }
|
|
|
|
|