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_util.h" |
10 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
11 #include "net/base/address_family.h" | 12 #include "net/base/address_family.h" |
12 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
13 #include "net/dns/host_resolver.h" | 14 #include "net/dns/host_resolver.h" |
14 #include "net/dns/single_request_host_resolver.h" | 15 #include "net/dns/single_request_host_resolver.h" |
| 16 #include "net/http/http_auth_challenge_tokenizer.h" |
15 #include "net/http/http_auth_filter.h" | 17 #include "net/http/http_auth_filter.h" |
16 #include "net/http/url_security_manager.h" | 18 #include "net/http/url_security_manager.h" |
17 | 19 |
18 namespace net { | 20 namespace net { |
19 | 21 |
20 HttpAuthHandlerNegotiate::Factory::Factory() | 22 HttpAuthHandlerNegotiate::Factory::Factory() |
21 : disable_cname_lookup_(false), | 23 : disable_cname_lookup_(false), |
22 use_port_(false), | 24 use_port_(false), |
23 resolver_(NULL), | 25 resolver_(NULL), |
24 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 199 } |
198 // GSSAPI does not provide a way to enter username/password to | 200 // GSSAPI does not provide a way to enter username/password to |
199 // obtain a TGT. If the default credentials are not allowed for | 201 // obtain a TGT. If the default credentials are not allowed for |
200 // a particular site (based on whitelist), fall back to a | 202 // a particular site (based on whitelist), fall back to a |
201 // different scheme. | 203 // different scheme. |
202 if (!AllowsDefaultCredentials()) | 204 if (!AllowsDefaultCredentials()) |
203 return false; | 205 return false; |
204 #endif | 206 #endif |
205 if (CanDelegate()) | 207 if (CanDelegate()) |
206 auth_system_.Delegate(); | 208 auth_system_.Delegate(); |
207 auth_scheme_ = HttpAuth::AUTH_SCHEME_NEGOTIATE; | 209 auth_scheme_ = "negotiate"; |
208 score_ = 4; | |
209 properties_ = ENCRYPTS_IDENTITY | IS_CONNECTION_BASED; | |
210 HttpAuth::AuthorizationResult auth_result = | 210 HttpAuth::AuthorizationResult auth_result = |
211 auth_system_.ParseChallenge(challenge); | 211 auth_system_.ParseChallenge(challenge); |
212 return (auth_result == HttpAuth::AUTHORIZATION_RESULT_ACCEPT); | 212 return (auth_result == HttpAuth::AUTHORIZATION_RESULT_ACCEPT); |
213 } | 213 } |
214 | 214 |
215 int HttpAuthHandlerNegotiate::GenerateAuthTokenImpl( | 215 int HttpAuthHandlerNegotiate::GenerateAuthTokenImpl( |
216 const AuthCredentials* credentials, const HttpRequestInfo* request, | 216 const AuthCredentials* credentials, const HttpRequestInfo* request, |
217 const CompletionCallback& callback, std::string* auth_token) { | 217 const CompletionCallback& callback, std::string* auth_token) { |
218 DCHECK(callback_.is_null()); | 218 DCHECK(callback_.is_null()); |
219 DCHECK(auth_token_ == NULL); | 219 DCHECK(auth_token_ == NULL); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 bool HttpAuthHandlerNegotiate::CanDelegate() const { | 335 bool HttpAuthHandlerNegotiate::CanDelegate() const { |
336 // TODO(cbentzel): Should delegation be allowed on proxies? | 336 // TODO(cbentzel): Should delegation be allowed on proxies? |
337 if (target_ == HttpAuth::AUTH_PROXY) | 337 if (target_ == HttpAuth::AUTH_PROXY) |
338 return false; | 338 return false; |
339 if (!url_security_manager_) | 339 if (!url_security_manager_) |
340 return false; | 340 return false; |
341 return url_security_manager_->CanDelegate(origin_); | 341 return url_security_manager_->CanDelegate(origin_); |
342 } | 342 } |
343 | 343 |
344 } // namespace net | 344 } // namespace net |
OLD | NEW |