| 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_handler_negotiate.h" | 5 #include "net/http/http_auth_handler_negotiate.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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "net/base/address_family.h" | 14 #include "net/base/address_family.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #include "net/cert/x509_util.h" | 16 #include "net/cert/x509_util.h" |
| 17 #include "net/dns/host_resolver.h" | 17 #include "net/dns/host_resolver.h" |
| 18 #include "net/http/http_auth_filter.h" | 18 #include "net/http/http_auth_filter.h" |
| 19 #include "net/http/http_auth_preferences.h" | 19 #include "net/http/http_auth_preferences.h" |
| 20 #include "net/log/net_log.h" | 20 #include "net/log/net_log.h" |
| 21 #include "net/log/net_log_event_type.h" |
| 21 #include "net/ssl/ssl_info.h" | 22 #include "net/ssl/ssl_info.h" |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 std::unique_ptr<base::Value> NetLogParameterChannelBindings( | 28 std::unique_ptr<base::Value> NetLogParameterChannelBindings( |
| 28 const std::string& channel_binding_token, | 29 const std::string& channel_binding_token, |
| 29 NetLogCaptureMode capture_mode) { | 30 NetLogCaptureMode capture_mode) { |
| 30 std::unique_ptr<base::DictionaryValue> dict; | 31 std::unique_ptr<base::DictionaryValue> dict; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 auth_system_.ParseChallenge(challenge); | 234 auth_system_.ParseChallenge(challenge); |
| 234 if (auth_result != HttpAuth::AUTHORIZATION_RESULT_ACCEPT) | 235 if (auth_result != HttpAuth::AUTHORIZATION_RESULT_ACCEPT) |
| 235 return false; | 236 return false; |
| 236 | 237 |
| 237 // Try to extract channel bindings. | 238 // Try to extract channel bindings. |
| 238 if (ssl_info.is_valid()) | 239 if (ssl_info.is_valid()) |
| 239 x509_util::GetTLSServerEndPointChannelBinding(*ssl_info.cert, | 240 x509_util::GetTLSServerEndPointChannelBinding(*ssl_info.cert, |
| 240 &channel_bindings_); | 241 &channel_bindings_); |
| 241 if (!channel_bindings_.empty()) | 242 if (!channel_bindings_.empty()) |
| 242 net_log_.AddEvent( | 243 net_log_.AddEvent( |
| 243 NetLog::TYPE_AUTH_CHANNEL_BINDINGS, | 244 NetLogEventType::AUTH_CHANNEL_BINDINGS, |
| 244 base::Bind(&NetLogParameterChannelBindings, channel_bindings_)); | 245 base::Bind(&NetLogParameterChannelBindings, channel_bindings_)); |
| 245 return true; | 246 return true; |
| 246 } | 247 } |
| 247 | 248 |
| 248 int HttpAuthHandlerNegotiate::GenerateAuthTokenImpl( | 249 int HttpAuthHandlerNegotiate::GenerateAuthTokenImpl( |
| 249 const AuthCredentials* credentials, const HttpRequestInfo* request, | 250 const AuthCredentials* credentials, const HttpRequestInfo* request, |
| 250 const CompletionCallback& callback, std::string* auth_token) { | 251 const CompletionCallback& callback, std::string* auth_token) { |
| 251 DCHECK(callback_.is_null()); | 252 DCHECK(callback_.is_null()); |
| 252 DCHECK(auth_token_ == NULL); | 253 DCHECK(auth_token_ == NULL); |
| 253 auth_token_ = auth_token; | 254 auth_token_ = auth_token; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 bool HttpAuthHandlerNegotiate::CanDelegate() const { | 366 bool HttpAuthHandlerNegotiate::CanDelegate() const { |
| 366 // TODO(cbentzel): Should delegation be allowed on proxies? | 367 // TODO(cbentzel): Should delegation be allowed on proxies? |
| 367 if (target_ == HttpAuth::AUTH_PROXY) | 368 if (target_ == HttpAuth::AUTH_PROXY) |
| 368 return false; | 369 return false; |
| 369 if (!http_auth_preferences_) | 370 if (!http_auth_preferences_) |
| 370 return false; | 371 return false; |
| 371 return http_auth_preferences_->CanDelegate(origin_); | 372 return http_auth_preferences_->CanDelegate(origin_); |
| 372 } | 373 } |
| 373 | 374 |
| 374 } // namespace net | 375 } // namespace net |
| OLD | NEW |