Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: net/http/http_auth_controller.cc

Issue 2507253002: [net/auth] Treat ERR_INVALID_HANDLE as a identity invalidating error. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 auth_info_ = new AuthChallengeInfo; 467 auth_info_ = new AuthChallengeInfo;
468 auth_info_->is_proxy = (target_ == HttpAuth::AUTH_PROXY); 468 auth_info_->is_proxy = (target_ == HttpAuth::AUTH_PROXY);
469 auth_info_->challenger = url::Origin(auth_origin_); 469 auth_info_->challenger = url::Origin(auth_origin_);
470 auth_info_->scheme = HttpAuth::SchemeToString(handler_->auth_scheme()); 470 auth_info_->scheme = HttpAuth::SchemeToString(handler_->auth_scheme());
471 auth_info_->realm = handler_->realm(); 471 auth_info_->realm = handler_->realm();
472 } 472 }
473 473
474 int HttpAuthController::HandleGenerateTokenResult(int result) { 474 int HttpAuthController::HandleGenerateTokenResult(int result) {
475 DCHECK(CalledOnValidThread()); 475 DCHECK(CalledOnValidThread());
476 switch (result) { 476 switch (result) {
477 // Occurs if the credential handle is found to be invalid at the point it is
478 // exercised (i.e. GenerateAuthToken stage). We are going to consider this
479 // to be an error that invalidates the identity but not necessarily the
480 // scheme. Doing so allows a different identity to be used with the same
481 // scheme. See https://crbug.com/648366.
482 case ERR_INVALID_HANDLE:
mmenke 2016/11/16 22:44:23 How do we get an invalid handle in the first place
asanka 2016/11/16 23:01:31 It's possible for us to get a credentials handle,
483
484 // If the GenerateAuthToken call fails with this error, this means that the
485 // handler can no longer be used. However, the authentication scheme is
486 // considered still usable. This allows a scheme that attempted and failed
487 // to use default credentials to recover and use explicit credentials.
488 //
489 // The current handler may be tied to external state that is no longer
490 // valid, hence should be discarded. Since the scheme is still valid, a new
491 // handler can be created for the current scheme.
477 case ERR_INVALID_AUTH_CREDENTIALS: 492 case ERR_INVALID_AUTH_CREDENTIALS:
478 // If the GenerateAuthToken call fails with this error, this means that
479 // the handler can no longer be used. However, the authentication scheme
480 // is considered still usable. This allows a scheme that attempted and
481 // failed to use default credentials to recover and use explicit
482 // credentials.
483 //
484 // The current handler may be tied to external state that is no longer
485 // valid, hence should be discarded. Since the scheme is still valid, a
486 // new handler can be created for the current scheme.
487 InvalidateCurrentHandler(INVALIDATE_HANDLER_AND_CACHED_CREDENTIALS); 493 InvalidateCurrentHandler(INVALIDATE_HANDLER_AND_CACHED_CREDENTIALS);
488 auth_token_.clear(); 494 auth_token_.clear();
489 return OK; 495 return OK;
490 496
491 // Occurs with GSSAPI, if the user has not already logged in. 497 // Occurs with GSSAPI, if the user has not already logged in.
492 case ERR_MISSING_AUTH_CREDENTIALS: 498 case ERR_MISSING_AUTH_CREDENTIALS:
493 499
494 // Can occur with GSSAPI or SSPI if the underlying library reports 500 // Can occur with GSSAPI or SSPI if the underlying library reports
495 // a permanent error. 501 // a permanent error.
496 case ERR_UNSUPPORTED_AUTH_SCHEME: 502 case ERR_UNSUPPORTED_AUTH_SCHEME:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 DCHECK(CalledOnValidThread()); 544 DCHECK(CalledOnValidThread());
539 disabled_schemes_.insert(scheme); 545 disabled_schemes_.insert(scheme);
540 } 546 }
541 547
542 void HttpAuthController::DisableEmbeddedIdentity() { 548 void HttpAuthController::DisableEmbeddedIdentity() {
543 DCHECK(CalledOnValidThread()); 549 DCHECK(CalledOnValidThread());
544 embedded_identity_used_ = true; 550 embedded_identity_used_ = true;
545 } 551 }
546 552
547 } // namespace net 553 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698