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

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

Issue 1128043007: Support Kerberos on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mistake in previous Windows fixes Created 5 years, 7 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 unified diff | Download patch
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.h" 7 #include "base/stl_util.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/http/http_auth_challenge_tokenizer.h" 10 #include "net/http/http_auth_challenge_tokenizer.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 HttpAuthHandlerRegistryFactory* registry_factory = 49 HttpAuthHandlerRegistryFactory* registry_factory =
50 new HttpAuthHandlerRegistryFactory(); 50 new HttpAuthHandlerRegistryFactory();
51 registry_factory->RegisterSchemeFactory( 51 registry_factory->RegisterSchemeFactory(
52 "basic", new HttpAuthHandlerBasic::Factory()); 52 "basic", new HttpAuthHandlerBasic::Factory());
53 registry_factory->RegisterSchemeFactory( 53 registry_factory->RegisterSchemeFactory(
54 "digest", new HttpAuthHandlerDigest::Factory()); 54 "digest", new HttpAuthHandlerDigest::Factory());
55 55
56 #if defined(USE_KERBEROS) 56 #if defined(USE_KERBEROS)
57 HttpAuthHandlerNegotiate::Factory* negotiate_factory = 57 HttpAuthHandlerNegotiate::Factory* negotiate_factory =
58 new HttpAuthHandlerNegotiate::Factory(); 58 new HttpAuthHandlerNegotiate::Factory();
59 #if defined(OS_POSIX) 59 #if defined(OS_POSIX) && !defined(OS_ANDROID)
60 negotiate_factory->set_library(new GSSAPISharedLibrary(std::string())); 60 negotiate_factory->set_library(new GSSAPISharedLibrary(std::string()));
61 #elif defined(OS_WIN) 61 #elif defined(OS_WIN)
62 negotiate_factory->set_library(new SSPILibraryDefault()); 62 negotiate_factory->set_library(new SSPILibraryDefault());
63 #endif 63 #endif
64 negotiate_factory->set_host_resolver(host_resolver); 64 negotiate_factory->set_host_resolver(host_resolver);
65 registry_factory->RegisterSchemeFactory("negotiate", negotiate_factory); 65 registry_factory->RegisterSchemeFactory("negotiate", negotiate_factory);
66 #endif // defined(USE_KERBEROS) 66 #endif // defined(USE_KERBEROS)
67 67
68 HttpAuthHandlerNTLM::Factory* ntlm_factory = 68 HttpAuthHandlerNTLM::Factory* ntlm_factory =
69 new HttpAuthHandlerNTLM::Factory(); 69 new HttpAuthHandlerNTLM::Factory();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 return it->second; 125 return it->second;
126 } 126 }
127 127
128 // static 128 // static
129 HttpAuthHandlerRegistryFactory* HttpAuthHandlerRegistryFactory::Create( 129 HttpAuthHandlerRegistryFactory* HttpAuthHandlerRegistryFactory::Create(
130 const std::vector<std::string>& supported_schemes, 130 const std::vector<std::string>& supported_schemes,
131 URLSecurityManager* security_manager, 131 URLSecurityManager* security_manager,
132 HostResolver* host_resolver, 132 HostResolver* host_resolver,
133 const std::string& gssapi_library_name, 133 const std::string& gssapi_library_name,
134 const std::string& auth_android_negotiate_account_type,
134 bool negotiate_disable_cname_lookup, 135 bool negotiate_disable_cname_lookup,
135 bool negotiate_enable_port) { 136 bool negotiate_enable_port) {
136 HttpAuthHandlerRegistryFactory* registry_factory = 137 HttpAuthHandlerRegistryFactory* registry_factory =
137 new HttpAuthHandlerRegistryFactory(); 138 new HttpAuthHandlerRegistryFactory();
138 if (IsSupportedScheme(supported_schemes, "basic")) 139 if (IsSupportedScheme(supported_schemes, "basic"))
139 registry_factory->RegisterSchemeFactory( 140 registry_factory->RegisterSchemeFactory(
140 "basic", new HttpAuthHandlerBasic::Factory()); 141 "basic", new HttpAuthHandlerBasic::Factory());
141 if (IsSupportedScheme(supported_schemes, "digest")) 142 if (IsSupportedScheme(supported_schemes, "digest"))
142 registry_factory->RegisterSchemeFactory( 143 registry_factory->RegisterSchemeFactory(
143 "digest", new HttpAuthHandlerDigest::Factory()); 144 "digest", new HttpAuthHandlerDigest::Factory());
144 if (IsSupportedScheme(supported_schemes, "ntlm")) { 145 if (IsSupportedScheme(supported_schemes, "ntlm")) {
145 HttpAuthHandlerNTLM::Factory* ntlm_factory = 146 HttpAuthHandlerNTLM::Factory* ntlm_factory =
146 new HttpAuthHandlerNTLM::Factory(); 147 new HttpAuthHandlerNTLM::Factory();
147 ntlm_factory->set_url_security_manager(security_manager); 148 ntlm_factory->set_url_security_manager(security_manager);
148 #if defined(OS_WIN) 149 #if defined(OS_WIN)
149 ntlm_factory->set_sspi_library(new SSPILibraryDefault()); 150 ntlm_factory->set_sspi_library(new SSPILibraryDefault());
150 #endif 151 #endif
151 registry_factory->RegisterSchemeFactory("ntlm", ntlm_factory); 152 registry_factory->RegisterSchemeFactory("ntlm", ntlm_factory);
152 } 153 }
153 #if defined(USE_KERBEROS) 154 #if defined(USE_KERBEROS)
154 if (IsSupportedScheme(supported_schemes, "negotiate")) { 155 if (IsSupportedScheme(supported_schemes, "negotiate")) {
155 HttpAuthHandlerNegotiate::Factory* negotiate_factory = 156 HttpAuthHandlerNegotiate::Factory* negotiate_factory =
156 new HttpAuthHandlerNegotiate::Factory(); 157 new HttpAuthHandlerNegotiate::Factory();
157 #if defined(OS_POSIX) 158 #if defined(OS_ANDROID)
159 negotiate_factory->set_account_type(auth_android_negotiate_account_type);
160 #elif defined(OS_POSIX)
158 negotiate_factory->set_library( 161 negotiate_factory->set_library(
159 new GSSAPISharedLibrary(gssapi_library_name)); 162 new GSSAPISharedLibrary(gssapi_library_name));
160 #elif defined(OS_WIN) 163 #elif defined(OS_WIN)
161 negotiate_factory->set_library(new SSPILibraryDefault()); 164 negotiate_factory->set_library(new SSPILibraryDefault());
162 #endif 165 #endif
163 negotiate_factory->set_url_security_manager(security_manager); 166 negotiate_factory->set_url_security_manager(security_manager);
164 DCHECK(host_resolver || negotiate_disable_cname_lookup); 167 DCHECK(host_resolver || negotiate_disable_cname_lookup);
165 negotiate_factory->set_host_resolver(host_resolver); 168 negotiate_factory->set_host_resolver(host_resolver);
166 negotiate_factory->set_disable_cname_lookup(negotiate_disable_cname_lookup); 169 negotiate_factory->set_disable_cname_lookup(negotiate_disable_cname_lookup);
167 negotiate_factory->set_use_port(negotiate_enable_port); 170 negotiate_factory->set_use_port(negotiate_enable_port);
(...skipping 22 matching lines...) Expand all
190 if (it == factory_map_.end()) { 193 if (it == factory_map_.end()) {
191 handler->reset(); 194 handler->reset();
192 return ERR_UNSUPPORTED_AUTH_SCHEME; 195 return ERR_UNSUPPORTED_AUTH_SCHEME;
193 } 196 }
194 DCHECK(it->second); 197 DCHECK(it->second);
195 return it->second->CreateAuthHandler(challenge, target, origin, reason, 198 return it->second->CreateAuthHandler(challenge, target, origin, reason,
196 digest_nonce_count, net_log, handler); 199 digest_nonce_count, net_log, handler);
197 } 200 }
198 201
199 } // namespace net 202 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698