Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: net/http/http_auth_handler_factory.cc

Issue 3199002: --auth-schemes specifies which authentication schemes are supported on the co... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_auth_handler_factory.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_handler_factory.cc
===================================================================
--- net/http/http_auth_handler_factory.cc (revision 56586)
+++ net/http/http_auth_handler_factory.cc (working copy)
@@ -53,6 +53,52 @@
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() {
}
« no previous file with comments | « net/http/http_auth_handler_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698