summaryrefslogtreecommitdiffstats
path: root/net/http/http_auth_handler_factory.cc
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-23 17:42:29 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-23 17:42:29 +0000
commitb7304169b5adb130b7db24b6a0bbf07e13e51e10 (patch)
tree30fdf52bb37c80fd8ca9a6d74d7fc902f5a4b056 /net/http/http_auth_handler_factory.cc
parent7ebccf35d1c0e6dcfafedae7b9ea3a21ba930b41 (diff)
downloadchromium_src-b7304169b5adb130b7db24b6a0bbf07e13e51e10.zip
chromium_src-b7304169b5adb130b7db24b6a0bbf07e13e51e10.tar.gz
chromium_src-b7304169b5adb130b7db24b6a0bbf07e13e51e10.tar.bz2
--auth-schemes specifies which authentication schemes are supported on the command line.
--auth-schemes should be a command separated list containing one or more of the following schemes: basic, digest, ntlm, or negotiate. This will primarily be used to help triage user-reported bugs. BUG=None TEST=specify --auth-schemes and ensure that only the specified schemes are supported. Also, when unspecified all schemes should be supported. Review URL: http://codereview.chromium.org/3199002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57073 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_auth_handler_factory.cc')
-rw-r--r--net/http/http_auth_handler_factory.cc46
1 files changed, 46 insertions, 0 deletions
diff --git a/net/http/http_auth_handler_factory.cc b/net/http/http_auth_handler_factory.cc
index c2d011b..c9e0fb9 100644
--- a/net/http/http_auth_handler_factory.cc
+++ b/net/http/http_auth_handler_factory.cc
@@ -53,6 +53,52 @@ HttpAuthHandlerRegistryFactory* HttpAuthHandlerFactory::CreateDefault() {
return registry_factory;
}
+namespace {
+
+bool IsSupportedScheme(const std::vector<std::string>& supported_schemes,
+ const std::string& scheme) {
+ std::vector<std::string>::const_iterator it = std::find(
+ supported_schemes.begin(), supported_schemes.end(), scheme);
+ return it != supported_schemes.end();
+}
+
+}
+
+// static
+HttpAuthHandlerRegistryFactory* HttpAuthHandlerRegistryFactory::Create(
+ const std::vector<std::string>& supported_schemes,
+ URLSecurityManager* security_manager,
+ HostResolver* host_resolver,
+ bool negotiate_disable_cname_lookup,
+ bool negotiate_enable_port) {
+ HttpAuthHandlerRegistryFactory* registry_factory =
+ new HttpAuthHandlerRegistryFactory();
+ if (IsSupportedScheme(supported_schemes, "basic"))
+ registry_factory->RegisterSchemeFactory(
+ "basic", new HttpAuthHandlerBasic::Factory());
+ if (IsSupportedScheme(supported_schemes, "digest"))
+ registry_factory->RegisterSchemeFactory(
+ "digest", new HttpAuthHandlerDigest::Factory());
+ if (IsSupportedScheme(supported_schemes, "ntlm")) {
+ HttpAuthHandlerNTLM::Factory* ntlm_factory =
+ new HttpAuthHandlerNTLM::Factory();
+ ntlm_factory->set_url_security_manager(security_manager);
+ registry_factory->RegisterSchemeFactory("ntlm", ntlm_factory);
+ }
+ if (IsSupportedScheme(supported_schemes, "negotiate")) {
+ HttpAuthHandlerNegotiate::Factory* negotiate_factory =
+ new HttpAuthHandlerNegotiate::Factory();
+ negotiate_factory->set_url_security_manager(security_manager);
+ DCHECK(host_resolver != NULL || negotiate_disable_cname_lookup);
+ negotiate_factory->set_host_resolver(host_resolver);
+ negotiate_factory->set_disable_cname_lookup(negotiate_disable_cname_lookup);
+ negotiate_factory->set_use_port(negotiate_enable_port);
+ registry_factory->RegisterSchemeFactory("negotiate", negotiate_factory);
+ }
+
+ return registry_factory;
+}
+
HttpAuthHandlerRegistryFactory::HttpAuthHandlerRegistryFactory() {
}