Chromium Code Reviews| 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 #include "net/http/http_auth_controller.h" | 5 #include "net/http/http_auth_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 INVALIDATE_HANDLER : | 270 INVALIDATE_HANDLER : |
| 271 INVALIDATE_HANDLER_AND_CACHED_CREDENTIALS); | 271 INVALIDATE_HANDLER_AND_CACHED_CREDENTIALS); |
| 272 break; | 272 break; |
| 273 default: | 273 default: |
| 274 NOTREACHED(); | 274 NOTREACHED(); |
| 275 break; | 275 break; |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 | 278 |
| 279 identity_.invalid = true; | 279 identity_.invalid = true; |
| 280 auth_info_ = nullptr; | |
|
mmenke
2016/11/17 16:07:19
Can this be put at the start of this method? I do
mmenke
2016/11/17 16:07:19
Please add a comment along the lines: "Clear info
asanka
2016/11/17 18:01:25
I moved it all the way up to ResetAuth and comment
| |
| 280 | 281 |
| 281 bool can_send_auth = (target_ != HttpAuth::AUTH_SERVER || | 282 bool can_send_auth = (target_ != HttpAuth::AUTH_SERVER || |
| 282 !do_not_send_server_auth); | 283 !do_not_send_server_auth); |
| 283 | 284 |
| 284 do { | 285 do { |
| 285 if (!handler_.get() && can_send_auth) { | 286 if (!handler_.get() && can_send_auth) { |
| 286 // Find the best authentication challenge that we support. | 287 // Find the best authentication challenge that we support. |
| 287 HttpAuth::ChooseBestChallenge(http_auth_handler_factory_, *headers, | 288 HttpAuth::ChooseBestChallenge(http_auth_handler_factory_, *headers, |
| 288 ssl_info, target_, auth_origin_, | 289 ssl_info, target_, auth_origin_, |
| 289 disabled_schemes_, net_log, &handler_); | 290 disabled_schemes_, net_log, &handler_); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 319 // We have exhausted all identity possibilities. | 320 // We have exhausted all identity possibilities. |
| 320 if (!handler_->AllowsExplicitCredentials()) { | 321 if (!handler_->AllowsExplicitCredentials()) { |
| 321 // If the handler doesn't accept explicit credentials, then we need to | 322 // If the handler doesn't accept explicit credentials, then we need to |
| 322 // choose a different auth scheme. | 323 // choose a different auth scheme. |
| 323 HistogramAuthEvent(handler_.get(), AUTH_EVENT_REJECT); | 324 HistogramAuthEvent(handler_.get(), AUTH_EVENT_REJECT); |
| 324 InvalidateCurrentHandler(INVALIDATE_HANDLER_AND_DISABLE_SCHEME); | 325 InvalidateCurrentHandler(INVALIDATE_HANDLER_AND_DISABLE_SCHEME); |
| 325 } else { | 326 } else { |
| 326 // Pass the challenge information back to the client. | 327 // Pass the challenge information back to the client. |
| 327 PopulateAuthChallenge(); | 328 PopulateAuthChallenge(); |
| 328 } | 329 } |
| 329 } else { | |
| 330 auth_info_ = NULL; | |
| 331 } | 330 } |
| 332 | 331 |
| 333 // If we get here and we don't have a handler_, that's because we | 332 // If we get here and we don't have a handler_, that's because we |
| 334 // invalidated it due to not having any viable identities to use with it. Go | 333 // invalidated it due to not having any viable identities to use with it. Go |
| 335 // back and try again. | 334 // back and try again. |
| 336 // TODO(asanka): Instead we should create a priority list of | 335 // TODO(asanka): Instead we should create a priority list of |
| 337 // <handler,identity> and iterate through that. | 336 // <handler,identity> and iterate through that. |
| 338 } while(!handler_.get()); | 337 } while(!handler_.get()); |
| 339 return OK; | 338 return OK; |
| 340 } | 339 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 DCHECK(CalledOnValidThread()); | 538 DCHECK(CalledOnValidThread()); |
| 540 disabled_schemes_.insert(scheme); | 539 disabled_schemes_.insert(scheme); |
| 541 } | 540 } |
| 542 | 541 |
| 543 void HttpAuthController::DisableEmbeddedIdentity() { | 542 void HttpAuthController::DisableEmbeddedIdentity() { |
| 544 DCHECK(CalledOnValidThread()); | 543 DCHECK(CalledOnValidThread()); |
| 545 embedded_identity_used_ = true; | 544 embedded_identity_used_ = true; |
| 546 } | 545 } |
| 547 | 546 |
| 548 } // namespace net | 547 } // namespace net |
| OLD | NEW |