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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 case ERR_INVALID_AUTH_CREDENTIALS: | 477 case ERR_INVALID_AUTH_CREDENTIALS: |
478 // If the GenerateAuthToken call fails with this error, this means that | 478 // If the GenerateAuthToken call fails with this error, this means that |
479 // the handler can no longer be used. However, the authentication scheme | 479 // the handler can no longer be used. However, the authentication scheme |
480 // is considered still usable. This allows a scheme that attempted and | 480 // is considered still usable. This allows a scheme that attempted and |
481 // failed to use default credentials to recover and use explicit | 481 // failed to use default credentials to recover and use explicit |
482 // credentials. | 482 // credentials. |
483 // | 483 // |
484 // If the handler does not support any remaining identity sources, then | 484 // If the handler does not support any remaining identity sources, then |
mmenke
2016/11/14 18:03:49
"The handler" seems incorrect here, since we're de
asanka
2016/11/14 18:49:52
DOne.
| |
485 // the authentication controller will pick another authentication handler. | 485 // the authentication controller will pick another authentication handler. |
486 InvalidateCurrentHandler(INVALIDATE_HANDLER_AND_CACHED_CREDENTIALS); | |
486 auth_token_.clear(); | 487 auth_token_.clear(); |
487 return OK; | 488 return OK; |
488 | 489 |
489 // Occurs with GSSAPI, if the user has not already logged in. | 490 // Occurs with GSSAPI, if the user has not already logged in. |
490 case ERR_MISSING_AUTH_CREDENTIALS: | 491 case ERR_MISSING_AUTH_CREDENTIALS: |
491 | 492 |
492 // Can occur with GSSAPI or SSPI if the underlying library reports | 493 // Can occur with GSSAPI or SSPI if the underlying library reports |
493 // a permanent error. | 494 // a permanent error. |
494 case ERR_UNSUPPORTED_AUTH_SCHEME: | 495 case ERR_UNSUPPORTED_AUTH_SCHEME: |
495 | 496 |
496 // These two error codes represent failures we aren't handling. | 497 // These two error codes represent failures we aren't handling. |
497 case ERR_UNEXPECTED_SECURITY_LIBRARY_STATUS: | 498 case ERR_UNEXPECTED_SECURITY_LIBRARY_STATUS: |
498 case ERR_UNDOCUMENTED_SECURITY_LIBRARY_STATUS: | 499 case ERR_UNDOCUMENTED_SECURITY_LIBRARY_STATUS: |
499 | 500 |
500 // Can be returned by SSPI if the authenticating authority or | 501 // Can be returned by SSPI if the authenticating authority or |
501 // target is not known. | 502 // target is not known. |
502 case ERR_MISCONFIGURED_AUTH_ENVIRONMENT: | 503 case ERR_MISCONFIGURED_AUTH_ENVIRONMENT: |
503 | 504 |
504 // In these cases, disable the current scheme as it cannot | 505 // In these cases, disable the current scheme as it cannot |
505 // succeed. | 506 // succeed. |
506 DisableAuthScheme(handler_->auth_scheme()); | 507 InvalidateCurrentHandler(INVALIDATE_HANDLER_AND_DISABLE_SCHEME); |
mmenke
2016/11/14 18:03:49
None of the new tests exercise this, do they?
asanka
2016/11/14 18:49:53
Not the new tests. But existing tests in the Gener
| |
507 auth_token_.clear(); | 508 auth_token_.clear(); |
508 return OK; | 509 return OK; |
509 | 510 |
510 default: | 511 default: |
511 return result; | 512 return result; |
512 } | 513 } |
513 } | 514 } |
514 | 515 |
515 void HttpAuthController::OnIOComplete(int result) { | 516 void HttpAuthController::OnIOComplete(int result) { |
mmenke
2016/11/14 18:03:49
Mind renaming this while you're here? This isn't
mmenke
2016/11/14 19:01:21
Missed this one?
asanka
2016/11/14 21:10:14
Oops. Done.
| |
516 DCHECK(CalledOnValidThread()); | 517 DCHECK(CalledOnValidThread()); |
517 result = HandleGenerateTokenResult(result); | 518 result = HandleGenerateTokenResult(result); |
518 if (!callback_.is_null()) { | 519 if (!callback_.is_null()) { |
519 CompletionCallback c = callback_; | 520 CompletionCallback c = callback_; |
520 callback_.Reset(); | 521 callback_.Reset(); |
521 c.Run(result); | 522 c.Run(result); |
522 } | 523 } |
523 } | 524 } |
524 | 525 |
525 scoped_refptr<AuthChallengeInfo> HttpAuthController::auth_info() { | 526 scoped_refptr<AuthChallengeInfo> HttpAuthController::auth_info() { |
(...skipping 10 matching lines...) Expand all Loading... | |
536 DCHECK(CalledOnValidThread()); | 537 DCHECK(CalledOnValidThread()); |
537 disabled_schemes_.insert(scheme); | 538 disabled_schemes_.insert(scheme); |
538 } | 539 } |
539 | 540 |
540 void HttpAuthController::DisableEmbeddedIdentity() { | 541 void HttpAuthController::DisableEmbeddedIdentity() { |
541 DCHECK(CalledOnValidThread()); | 542 DCHECK(CalledOnValidThread()); |
542 embedded_identity_used_ = true; | 543 embedded_identity_used_ = true; |
543 } | 544 } |
544 | 545 |
545 } // namespace net | 546 } // namespace net |
OLD | NEW |