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

Side by Side Diff: net/http/http_auth_handler_factory.cc

Issue 4560001: Support specifying the GSSAPI library that will be used. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix another compile error on Windows Created 10 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_auth_handler_factory.h ('k') | net/http/http_auth_handler_negotiate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_auth_handler_factory.h" 5 #include "net/http/http_auth_handler_factory.h"
6 6
7 #include "base/stl_util-inl.h" 7 #include "base/stl_util-inl.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/http/http_auth_filter.h" 10 #include "net/http/http_auth_filter.h"
(...skipping 30 matching lines...) Expand all
41 // static 41 // static
42 HttpAuthHandlerRegistryFactory* HttpAuthHandlerFactory::CreateDefault( 42 HttpAuthHandlerRegistryFactory* HttpAuthHandlerFactory::CreateDefault(
43 HostResolver* host_resolver) { 43 HostResolver* host_resolver) {
44 DCHECK(host_resolver); 44 DCHECK(host_resolver);
45 HttpAuthHandlerRegistryFactory* registry_factory = 45 HttpAuthHandlerRegistryFactory* registry_factory =
46 new HttpAuthHandlerRegistryFactory(); 46 new HttpAuthHandlerRegistryFactory();
47 registry_factory->RegisterSchemeFactory( 47 registry_factory->RegisterSchemeFactory(
48 "basic", new HttpAuthHandlerBasic::Factory()); 48 "basic", new HttpAuthHandlerBasic::Factory());
49 registry_factory->RegisterSchemeFactory( 49 registry_factory->RegisterSchemeFactory(
50 "digest", new HttpAuthHandlerDigest::Factory()); 50 "digest", new HttpAuthHandlerDigest::Factory());
51
51 HttpAuthHandlerNegotiate::Factory* negotiate_factory = 52 HttpAuthHandlerNegotiate::Factory* negotiate_factory =
52 new HttpAuthHandlerNegotiate::Factory(); 53 new HttpAuthHandlerNegotiate::Factory();
54 #if defined(OS_POSIX)
55 negotiate_factory->set_library(new GSSAPISharedLibrary(std::string()));
56 #elif defined(OS_WIN)
57 negotiate_factory->set_library(new SSPILibraryDefault());
58 #endif
53 negotiate_factory->set_host_resolver(host_resolver); 59 negotiate_factory->set_host_resolver(host_resolver);
54 registry_factory->RegisterSchemeFactory("negotiate", negotiate_factory); 60 registry_factory->RegisterSchemeFactory("negotiate", negotiate_factory);
55 registry_factory->RegisterSchemeFactory( 61
56 "ntlm", new HttpAuthHandlerNTLM::Factory()); 62 HttpAuthHandlerNTLM::Factory* ntlm_factory =
63 new HttpAuthHandlerNTLM::Factory();
64 #if defined(OS_WIN)
65 ntlm_factory->set_sspi_library(new SSPILibraryDefault());
66 #endif
67 registry_factory->RegisterSchemeFactory("ntlm", ntlm_factory);
57 return registry_factory; 68 return registry_factory;
58 } 69 }
59 70
60 namespace { 71 namespace {
61 72
62 bool IsSupportedScheme(const std::vector<std::string>& supported_schemes, 73 bool IsSupportedScheme(const std::vector<std::string>& supported_schemes,
63 const std::string& scheme) { 74 const std::string& scheme) {
64 std::vector<std::string>::const_iterator it = std::find( 75 std::vector<std::string>::const_iterator it = std::find(
65 supported_schemes.begin(), supported_schemes.end(), scheme); 76 supported_schemes.begin(), supported_schemes.end(), scheme);
66 return it != supported_schemes.end(); 77 return it != supported_schemes.end();
67 } 78 }
68 79
69 } // namespace 80 } // namespace
70 81
71 // static 82 // static
72 HttpAuthHandlerRegistryFactory* HttpAuthHandlerRegistryFactory::Create( 83 HttpAuthHandlerRegistryFactory* HttpAuthHandlerRegistryFactory::Create(
73 const std::vector<std::string>& supported_schemes, 84 const std::vector<std::string>& supported_schemes,
74 URLSecurityManager* security_manager, 85 URLSecurityManager* security_manager,
75 HostResolver* host_resolver, 86 HostResolver* host_resolver,
87 const std::string& gssapi_library_name,
76 bool negotiate_disable_cname_lookup, 88 bool negotiate_disable_cname_lookup,
77 bool negotiate_enable_port) { 89 bool negotiate_enable_port) {
78 HttpAuthHandlerRegistryFactory* registry_factory = 90 HttpAuthHandlerRegistryFactory* registry_factory =
79 new HttpAuthHandlerRegistryFactory(); 91 new HttpAuthHandlerRegistryFactory();
80 if (IsSupportedScheme(supported_schemes, "basic")) 92 if (IsSupportedScheme(supported_schemes, "basic"))
81 registry_factory->RegisterSchemeFactory( 93 registry_factory->RegisterSchemeFactory(
82 "basic", new HttpAuthHandlerBasic::Factory()); 94 "basic", new HttpAuthHandlerBasic::Factory());
83 if (IsSupportedScheme(supported_schemes, "digest")) 95 if (IsSupportedScheme(supported_schemes, "digest"))
84 registry_factory->RegisterSchemeFactory( 96 registry_factory->RegisterSchemeFactory(
85 "digest", new HttpAuthHandlerDigest::Factory()); 97 "digest", new HttpAuthHandlerDigest::Factory());
86 if (IsSupportedScheme(supported_schemes, "ntlm")) { 98 if (IsSupportedScheme(supported_schemes, "ntlm")) {
87 HttpAuthHandlerNTLM::Factory* ntlm_factory = 99 HttpAuthHandlerNTLM::Factory* ntlm_factory =
88 new HttpAuthHandlerNTLM::Factory(); 100 new HttpAuthHandlerNTLM::Factory();
89 ntlm_factory->set_url_security_manager(security_manager); 101 ntlm_factory->set_url_security_manager(security_manager);
102 #if defined(OS_WIN)
103 ntlm_factory->set_sspi_library(new SSPILibraryDefault());
104 #endif
90 registry_factory->RegisterSchemeFactory("ntlm", ntlm_factory); 105 registry_factory->RegisterSchemeFactory("ntlm", ntlm_factory);
91 } 106 }
92 if (IsSupportedScheme(supported_schemes, "negotiate")) { 107 if (IsSupportedScheme(supported_schemes, "negotiate")) {
93 HttpAuthHandlerNegotiate::Factory* negotiate_factory = 108 HttpAuthHandlerNegotiate::Factory* negotiate_factory =
94 new HttpAuthHandlerNegotiate::Factory(); 109 new HttpAuthHandlerNegotiate::Factory();
110 #if defined(OS_POSIX)
111 negotiate_factory->set_library(
112 new GSSAPISharedLibrary(gssapi_library_name));
113 #elif defined(OS_WIN)
114 negotiate_factory->set_library(new SSPILibraryDefault());
115 #endif
95 negotiate_factory->set_url_security_manager(security_manager); 116 negotiate_factory->set_url_security_manager(security_manager);
96 DCHECK(host_resolver || negotiate_disable_cname_lookup); 117 DCHECK(host_resolver || negotiate_disable_cname_lookup);
97 negotiate_factory->set_host_resolver(host_resolver); 118 negotiate_factory->set_host_resolver(host_resolver);
98 negotiate_factory->set_disable_cname_lookup(negotiate_disable_cname_lookup); 119 negotiate_factory->set_disable_cname_lookup(negotiate_disable_cname_lookup);
99 negotiate_factory->set_use_port(negotiate_enable_port); 120 negotiate_factory->set_use_port(negotiate_enable_port);
100 registry_factory->RegisterSchemeFactory("negotiate", negotiate_factory); 121 registry_factory->RegisterSchemeFactory("negotiate", negotiate_factory);
101 } 122 }
102 123
103 return registry_factory; 124 return registry_factory;
104 } 125 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 const std::string& scheme) const { 182 const std::string& scheme) const {
162 std::string lower_scheme = StringToLowerASCII(scheme); 183 std::string lower_scheme = StringToLowerASCII(scheme);
163 FactoryMap::const_iterator it = factory_map_.find(lower_scheme); 184 FactoryMap::const_iterator it = factory_map_.find(lower_scheme);
164 if (it == factory_map_.end()) { 185 if (it == factory_map_.end()) {
165 return NULL; // |scheme| is not registered. 186 return NULL; // |scheme| is not registered.
166 } 187 }
167 return it->second; 188 return it->second;
168 } 189 }
169 190
170 } // namespace net 191 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_factory.h ('k') | net/http/http_auth_handler_negotiate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698