| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_handler_negotiate.h" | 5 #include "net/http/http_auth_handler_negotiate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "net/base/address_family.h" | 10 #include "net/base/address_family.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // a particular site (based on whitelist), fall back to a | 88 // a particular site (based on whitelist), fall back to a |
| 89 // different scheme. | 89 // different scheme. |
| 90 if (!AllowsDefaultCredentials()) | 90 if (!AllowsDefaultCredentials()) |
| 91 return false; | 91 return false; |
| 92 #endif | 92 #endif |
| 93 if (CanDelegate()) | 93 if (CanDelegate()) |
| 94 auth_system_.Delegate(); | 94 auth_system_.Delegate(); |
| 95 scheme_ = "negotiate"; | 95 scheme_ = "negotiate"; |
| 96 score_ = 4; | 96 score_ = 4; |
| 97 properties_ = ENCRYPTS_IDENTITY | IS_CONNECTION_BASED; | 97 properties_ = ENCRYPTS_IDENTITY | IS_CONNECTION_BASED; |
| 98 HttpAuth::AuthorizationResult auth_result = |
| 99 auth_system_.ParseChallenge(challenge); |
| 100 return (auth_result == HttpAuth::AUTHORIZATION_RESULT_ACCEPT); |
| 101 } |
| 102 |
| 103 HttpAuth::AuthorizationResult HttpAuthHandlerNegotiate::HandleAnotherChallenge( |
| 104 HttpAuth::ChallengeTokenizer* challenge) { |
| 98 return auth_system_.ParseChallenge(challenge); | 105 return auth_system_.ParseChallenge(challenge); |
| 99 } | 106 } |
| 100 | 107 |
| 101 // Require identity on first pass instead of second. | 108 // Require identity on first pass instead of second. |
| 102 bool HttpAuthHandlerNegotiate::NeedsIdentity() { | 109 bool HttpAuthHandlerNegotiate::NeedsIdentity() { |
| 103 return auth_system_.NeedsIdentity(); | 110 return auth_system_.NeedsIdentity(); |
| 104 } | 111 } |
| 105 | 112 |
| 106 bool HttpAuthHandlerNegotiate::IsFinalRound() { | |
| 107 return auth_system_.IsFinalRound(); | |
| 108 } | |
| 109 | |
| 110 bool HttpAuthHandlerNegotiate::AllowsDefaultCredentials() { | 113 bool HttpAuthHandlerNegotiate::AllowsDefaultCredentials() { |
| 111 if (target_ == HttpAuth::AUTH_PROXY) | 114 if (target_ == HttpAuth::AUTH_PROXY) |
| 112 return true; | 115 return true; |
| 113 if (!url_security_manager_) | 116 if (!url_security_manager_) |
| 114 return false; | 117 return false; |
| 115 return url_security_manager_->CanUseDefaultCredentials(origin_); | 118 return url_security_manager_->CanUseDefaultCredentials(origin_); |
| 116 } | 119 } |
| 117 | 120 |
| 118 bool HttpAuthHandlerNegotiate::CanDelegate() const { | 121 bool HttpAuthHandlerNegotiate::CanDelegate() const { |
| 119 // TODO(cbentzel): Should delegation be allowed on proxies? | 122 // TODO(cbentzel): Should delegation be allowed on proxies? |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 resolver_, disable_cname_lookup_, | 323 resolver_, disable_cname_lookup_, |
| 321 use_port_)); | 324 use_port_)); |
| 322 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) | 325 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) |
| 323 return ERR_INVALID_RESPONSE; | 326 return ERR_INVALID_RESPONSE; |
| 324 handler->swap(tmp_handler); | 327 handler->swap(tmp_handler); |
| 325 return OK; | 328 return OK; |
| 326 #endif | 329 #endif |
| 327 } | 330 } |
| 328 | 331 |
| 329 } // namespace net | 332 } // namespace net |
| OLD | NEW |