|
42 | 42 | #include "net/ssl/server_bound_cert_service.h"
|
43 | 43 | #include "net/ssl/ssl_config_service_defaults.h"
|
44 | 44 | #include "net/cookies/cookie_monster.h"
|
| 45 | +#include "net/http/http_auth_filter.h" |
45 | 46 | #include "net/http/http_auth_handler_factory.h"
|
46 | 47 | #include "net/http/http_cache.h"
|
47 | 48 | #include "net/http/http_network_session.h"
|
@@ -125,10 +126,20 @@ ShellURLRequestContextGetter::ShellURLRequestContextGetter(
|
125 | 126 | MessageLoop* io_loop,
|
126 | 127 | MessageLoop* file_loop,
|
127 | 128 | ProtocolHandlerMap* protocol_handlers,
|
128 |
| - ShellBrowserContext* browser_context) |
| 129 | + ShellBrowserContext* browser_context, |
| 130 | + const std::string& auth_schemes, |
| 131 | + const std::string& auth_server_whitelist, |
| 132 | + const std::string& auth_delegate_whitelist, |
| 133 | + const std::string& gssapi_library_name) |
129 | 134 | : ignore_certificate_errors_(ignore_certificate_errors),
|
130 | 135 | data_path_(data_path),
|
131 | 136 | root_path_(root_path),
|
| 137 | + auth_schemes_(auth_schemes), |
| 138 | + negotiate_disable_cname_lookup_(false), |
| 139 | + negotiate_enable_port_(false), |
| 140 | + auth_server_whitelist_(auth_server_whitelist), |
| 141 | + auth_delegate_whitelist_(auth_delegate_whitelist), |
| 142 | + gssapi_library_name_(gssapi_library_name), |
132 | 143 | io_loop_(io_loop),
|
133 | 144 | file_loop_(file_loop),
|
134 | 145 | browser_context_(browser_context) {
|
@@ -209,7 +220,8 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
|
209 | 220 |
|
210 | 221 | storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
|
211 | 222 | storage_->set_http_auth_handler_factory(
|
212 |
| - net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); |
| 223 | + CreateDefaultAuthHandlerFactory(host_resolver.get())); |
| 224 | + |
213 | 225 | storage_->set_http_server_properties(
|
214 | 226 | scoped_ptr<net::HttpServerProperties>(
|
215 | 227 | new net::HttpServerPropertiesImpl()));
|
@@ -278,4 +290,31 @@ net::HostResolver* ShellURLRequestContextGetter::host_resolver() {
|
278 | 290 | return url_request_context_->host_resolver();
|
279 | 291 | }
|
280 | 292 |
|
| 293 | +net::HttpAuthHandlerFactory* ShellURLRequestContextGetter::CreateDefaultAuthHandlerFactory( |
| 294 | + net::HostResolver* resolver) { |
| 295 | + net::HttpAuthFilterWhitelist* auth_filter_default_credentials = NULL; |
| 296 | + if (!auth_server_whitelist_.empty()) { |
| 297 | + auth_filter_default_credentials = |
| 298 | + new net::HttpAuthFilterWhitelist(auth_server_whitelist_); |
| 299 | + } |
| 300 | + net::HttpAuthFilterWhitelist* auth_filter_delegate = NULL; |
| 301 | + if (!auth_delegate_whitelist_.empty()) { |
| 302 | + auth_filter_delegate = |
| 303 | + new net::HttpAuthFilterWhitelist(auth_delegate_whitelist_); |
| 304 | + } |
| 305 | + url_security_manager_.reset( |
| 306 | + net::URLSecurityManager::Create(auth_filter_default_credentials, |
| 307 | + auth_filter_delegate)); |
| 308 | + std::vector<std::string> supported_schemes; |
| 309 | + base::SplitString(auth_schemes_, ',', &supported_schemes); |
| 310 | + |
| 311 | + scoped_ptr<net::HttpAuthHandlerRegistryFactory> registry_factory( |
| 312 | + net::HttpAuthHandlerRegistryFactory::Create( |
| 313 | + supported_schemes, url_security_manager_.get(), |
| 314 | + resolver, gssapi_library_name_, negotiate_disable_cname_lookup_, |
| 315 | + negotiate_enable_port_)); |
| 316 | + |
| 317 | + return registry_factory.release(); |
| 318 | +} |
| 319 | + |
281 | 320 | } // namespace content
|
0 commit comments