diff options
author | ahendrickson@google.com <ahendrickson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-28 18:03:04 +0000 |
---|---|---|
committer | ahendrickson@google.com <ahendrickson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-28 18:03:04 +0000 |
commit | aef042746af7a3a9a9967195c24cb7a9c755a0e8 (patch) | |
tree | 2c0aa7088f240c63f1f12b2bd19651314cdfc928 /chrome/browser/io_thread.cc | |
parent | f9f41ec4f27ba5fd19ca82d4c04b13bed6627d23 (diff) | |
download | chromium_src-aef042746af7a3a9a9967195c24cb7a9c755a0e8.zip chromium_src-aef042746af7a3a9a9967195c24cb7a9c755a0e8.tar.gz chromium_src-aef042746af7a3a9a9967195c24cb7a9c755a0e8.tar.bz2 |
Hooking GSSAPI code into HTTP authenticate Negotiate handler.
BUG=33033.
TEST=None.
Review URL: http://codereview.chromium.org/2684001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51001 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/io_thread.cc')
-rw-r--r-- | chrome/browser/io_thread.cc | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 681bb9d..885aae9 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -207,6 +207,22 @@ net::HttpAuthHandlerFactory* IOThread::CreateDefaultAuthHandlerFactory() { auth_filter->SetWhitelist(auth_server_whitelist); } + // Set the flag that enables or disables the Negotiate auth handler. +#if defined(OS_WIN) + static const bool kNegotiateAuthEnabledDefault = true; +#else + static const bool kNegotiateAuthEnabledDefault = false; +#endif + bool negotiate_auth_enabled = kNegotiateAuthEnabledDefault; + if (command_line.HasSwitch(switches::kExperimentalEnableNegotiateAuth)) { + std::string enable_negotiate_auth = command_line.GetSwitchValueASCII( + switches::kExperimentalEnableNegotiateAuth); + // Enabled if no value, or value is 'true'. Disabled otherwise. + negotiate_auth_enabled = + enable_negotiate_auth.empty() || + (StringToLowerASCII(enable_negotiate_auth) == "true"); + } + net::HttpAuthHandlerRegistryFactory* registry_factory = net::HttpAuthHandlerFactory::CreateDefault(); @@ -219,18 +235,22 @@ net::HttpAuthHandlerFactory* IOThread::CreateDefaultAuthHandlerFactory() { registry_factory->SetURLSecurityManager("negotiate", globals_->url_security_manager.get()); - // Configure the Negotiate settings for the Kerberos SPN. - // TODO(cbentzel): Read the related IE registry settings on Windows builds. - // TODO(cbentzel): Ugly use of static_cast here. - net::HttpAuthHandlerNegotiate::Factory* negotiate_factory = - static_cast<net::HttpAuthHandlerNegotiate::Factory*>( - registry_factory->GetSchemeFactory("negotiate")); - DCHECK(negotiate_factory); - if (command_line.HasSwitch(switches::kDisableAuthNegotiateCnameLookup)) - negotiate_factory->set_disable_cname_lookup(true); - if (command_line.HasSwitch(switches::kEnableAuthNegotiatePort)) - negotiate_factory->set_use_port(true); - + if (negotiate_auth_enabled) { + // Configure the Negotiate settings for the Kerberos SPN. + // TODO(cbentzel): Read the related IE registry settings on Windows builds. + // TODO(cbentzel): Ugly use of static_cast here. + net::HttpAuthHandlerNegotiate::Factory* negotiate_factory = + static_cast<net::HttpAuthHandlerNegotiate::Factory*>( + registry_factory->GetSchemeFactory("negotiate")); + DCHECK(negotiate_factory); + if (command_line.HasSwitch(switches::kDisableAuthNegotiateCnameLookup)) + negotiate_factory->set_disable_cname_lookup(true); + if (command_line.HasSwitch(switches::kEnableAuthNegotiatePort)) + negotiate_factory->set_use_port(true); + } else { + // Disable the Negotiate authentication handler. + registry_factory->RegisterSchemeFactory("negotiate", NULL); + } return registry_factory; } |