Merge pull request #104 from atom/enable-ntlm-auth
Explicitly create HttpAuthHandlerFactory to enable NTLM / Kerberos authentication
This commit is contained in:
commit
9b1302b894
2 changed files with 20 additions and 2 deletions
|
@ -119,6 +119,7 @@ URLRequestContextGetter::URLRequestContextGetter(
|
||||||
base_path_(base_path),
|
base_path_(base_path),
|
||||||
io_loop_(io_loop),
|
io_loop_(io_loop),
|
||||||
file_loop_(file_loop),
|
file_loop_(file_loop),
|
||||||
|
url_sec_mgr_(net::URLSecurityManager::Create(NULL, NULL)),
|
||||||
protocol_interceptors_(protocol_interceptors.Pass()) {
|
protocol_interceptors_(protocol_interceptors.Pass()) {
|
||||||
// Must first be created on the UI thread.
|
// Must first be created on the UI thread.
|
||||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||||
|
@ -188,11 +189,26 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
|
||||||
NULL,
|
NULL,
|
||||||
url_request_context_->network_delegate()));
|
url_request_context_->network_delegate()));
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<std::string> schemes;
|
||||||
|
schemes.push_back(std::string("basic"));
|
||||||
|
schemes.push_back(std::string("digest"));
|
||||||
|
schemes.push_back(std::string("ntlm"));
|
||||||
|
schemes.push_back(std::string("negotiate"));
|
||||||
|
|
||||||
|
auto auth_handler_factory =
|
||||||
|
net::HttpAuthHandlerRegistryFactory::Create(
|
||||||
|
schemes,
|
||||||
|
url_sec_mgr_.get(),
|
||||||
|
host_resolver.get(),
|
||||||
|
std::string(), // gssapi_library_name
|
||||||
|
false, // negotiate_disable_cname_lookup
|
||||||
|
true); // negotiate_enable_port
|
||||||
|
|
||||||
storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
|
storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
|
||||||
storage_->set_transport_security_state(new net::TransportSecurityState);
|
storage_->set_transport_security_state(new net::TransportSecurityState);
|
||||||
storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
|
storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
|
||||||
storage_->set_http_auth_handler_factory(
|
storage_->set_http_auth_handler_factory(auth_handler_factory);
|
||||||
net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get()));
|
|
||||||
scoped_ptr<net::HttpServerProperties> server_properties(
|
scoped_ptr<net::HttpServerProperties> server_properties(
|
||||||
new net::HttpServerPropertiesImpl);
|
new net::HttpServerPropertiesImpl);
|
||||||
storage_->set_http_server_properties(server_properties.Pass());
|
storage_->set_http_server_properties(server_properties.Pass());
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "content/public/browser/content_browser_client.h"
|
#include "content/public/browser/content_browser_client.h"
|
||||||
#include "net/http/http_cache.h"
|
#include "net/http/http_cache.h"
|
||||||
|
#include "net/http/url_security_manager.h"
|
||||||
#include "net/url_request/url_request_context_getter.h"
|
#include "net/url_request/url_request_context_getter.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
|
@ -68,6 +69,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
||||||
scoped_ptr<net::URLRequestContextStorage> storage_;
|
scoped_ptr<net::URLRequestContextStorage> storage_;
|
||||||
scoped_ptr<net::URLRequestContext> url_request_context_;
|
scoped_ptr<net::URLRequestContext> url_request_context_;
|
||||||
scoped_ptr<net::HostMappingRules> host_mapping_rules_;
|
scoped_ptr<net::HostMappingRules> host_mapping_rules_;
|
||||||
|
scoped_ptr<net::URLSecurityManager> url_sec_mgr_;
|
||||||
content::ProtocolHandlerMap protocol_handlers_;
|
content::ProtocolHandlerMap protocol_handlers_;
|
||||||
content::URLRequestInterceptorScopedVector protocol_interceptors_;
|
content::URLRequestInterceptorScopedVector protocol_interceptors_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue