diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-15 14:25:50 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-15 14:25:50 +0000 |
commit | fa55e1931013409ddbce59ed39f8b12a351fd0c4 (patch) | |
tree | 1ff77c48d22f36173c1fa63ae8acb1faf896aa0d /net/url_request | |
parent | e8da0a0066695284dbf698c9900617b3b159f33b (diff) | |
download | chromium_src-fa55e1931013409ddbce59ed39f8b12a351fd0c4.zip chromium_src-fa55e1931013409ddbce59ed39f8b12a351fd0c4.tar.gz chromium_src-fa55e1931013409ddbce59ed39f8b12a351fd0c4.tar.bz2 |
Added factories for HttpAuthHandler.
The driving rationale for this change was to prevent choosing an AuthHandler when it
is not supported on the system due to a missing runtime component (such as not being
able to locate a gssapi shared library when seeing a Negotiate scheme).
It also has the advantage (currently unused) of determining some per-auth-scheme properties
only the first time that a challenge for that scheme is seen (such as maximum token length for
the SSPI implementation of NTLM).
Finally, it may make unit tests easier to generate since the factory can be easily mocked.
BUG=34795
TEST=New unit test for HttpAuthHandlerDispatchFactory.
Review URL: http://codereview.chromium.org/582007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39065 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/url_request_context.h | 8 | ||||
-rw-r--r-- | net/url_request/url_request_unittest.h | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index d72f84d..fb2608f 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -23,6 +23,7 @@ namespace net { class CookiePolicy; class FtpTransactionFactory; +class HttpAuthHandlerFactory; class HttpTransactionFactory; class SocketStream; } @@ -77,6 +78,12 @@ class URLRequestContext : // Gets the FTP authentication cache for this context. net::FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; } + // Gets the HTTP Authentication Handler Factory for this context. + // The factory is only valid for the lifetime of this URLRequestContext + net::HttpAuthHandlerFactory* http_auth_handler_factory() { + return http_auth_handler_factory_; + } + // Gets the value of 'Accept-Charset' header field. const std::string& accept_charset() const { return accept_charset_; } @@ -133,6 +140,7 @@ class URLRequestContext : scoped_refptr<net::SSLConfigService> ssl_config_service_; net::HttpTransactionFactory* http_transaction_factory_; net::FtpTransactionFactory* ftp_transaction_factory_; + net::HttpAuthHandlerFactory* http_auth_handler_factory_; scoped_refptr<net::CookieStore> cookie_store_; net::CookiePolicy* cookie_policy_; scoped_refptr<net::TransportSecurityState> transport_security_state_; diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h index 6ea2c15..e0868ff 100644 --- a/net/url_request/url_request_unittest.h +++ b/net/url_request/url_request_unittest.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,6 +30,7 @@ #include "net/base/ssl_config_service_defaults.h" #include "net/disk_cache/disk_cache.h" #include "net/ftp/ftp_network_layer.h" +#include "net/http/http_auth_handler_factory.h" #include "net/http/http_cache.h" #include "net/http/http_network_layer.h" #include "net/socket/ssl_test_util.h" @@ -151,17 +152,20 @@ class TestURLRequestContext : public URLRequestContext { virtual ~TestURLRequestContext() { delete ftp_transaction_factory_; delete http_transaction_factory_; + delete http_auth_handler_factory_; } private: void Init() { ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); ssl_config_service_ = new net::SSLConfigServiceDefaults; + http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault(); http_transaction_factory_ = new net::HttpCache( net::HttpNetworkLayer::CreateFactory(NULL, host_resolver_, proxy_service_, - ssl_config_service_), + ssl_config_service_, + http_auth_handler_factory_), disk_cache::CreateInMemoryCacheBackend(0)); // In-memory cookie store. cookie_store_ = new net::CookieMonster(NULL); |