Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 registry_factory->RegisterSchemeFactory(kNtlmAuthScheme, ntlm_factory); | 81 registry_factory->RegisterSchemeFactory(kNtlmAuthScheme, ntlm_factory); |
| 82 } | 82 } |
| 83 #if defined(USE_KERBEROS) | 83 #if defined(USE_KERBEROS) |
| 84 if (prefs.IsSupportedScheme(kNegotiateAuthScheme)) { | 84 if (prefs.IsSupportedScheme(kNegotiateAuthScheme)) { |
| 85 DCHECK(host_resolver); | 85 DCHECK(host_resolver); |
| 86 HttpAuthHandlerNegotiate::Factory* negotiate_factory = | 86 HttpAuthHandlerNegotiate::Factory* negotiate_factory = |
| 87 new HttpAuthHandlerNegotiate::Factory(); | 87 new HttpAuthHandlerNegotiate::Factory(); |
| 88 #if defined(OS_WIN) | 88 #if defined(OS_WIN) |
| 89 negotiate_factory->set_library(base::MakeUnique<SSPILibraryDefault>()); | 89 negotiate_factory->set_library(base::MakeUnique<SSPILibraryDefault>()); |
| 90 #elif defined(OS_POSIX) && !defined(OS_ANDROID) | 90 #elif defined(OS_POSIX) && !defined(OS_ANDROID) |
| 91 negotiate_factory->set_library( | 91 bool allow_gssapi_library_load = true; |
| 92 base::MakeUnique<GSSAPISharedLibrary>(prefs.GssapiLibraryName())); | 92 #if defined(OS_CHROMEOS) |
| 93 allow_gssapi_library_load = prefs.AllowGssapiLibraryLoad(); | |
| 94 #endif | |
| 95 negotiate_factory->set_library(base::MakeUnique<GSSAPISharedLibrary>( | |
| 96 prefs.GssapiLibraryName(), allow_gssapi_library_load)); | |
|
asanka
2017/04/26 20:42:25
Rather than this, let's make HttpAuthHandlerNegoti
| |
| 93 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) | 97 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) |
| 94 negotiate_factory->set_host_resolver(host_resolver); | 98 negotiate_factory->set_host_resolver(host_resolver); |
| 95 registry_factory->RegisterSchemeFactory(kNegotiateAuthScheme, | 99 registry_factory->RegisterSchemeFactory(kNegotiateAuthScheme, |
| 96 negotiate_factory); | 100 negotiate_factory); |
| 97 } | 101 } |
| 98 #endif // defined(USE_KERBEROS) | 102 #endif // defined(USE_KERBEROS) |
| 99 return registry_factory; | 103 return registry_factory; |
| 100 } | 104 } |
| 101 | 105 |
| 102 } // namespace | 106 } // namespace |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 // static | 143 // static |
| 140 std::unique_ptr<HttpAuthHandlerRegistryFactory> | 144 std::unique_ptr<HttpAuthHandlerRegistryFactory> |
| 141 HttpAuthHandlerFactory::CreateDefault(HostResolver* host_resolver) { | 145 HttpAuthHandlerFactory::CreateDefault(HostResolver* host_resolver) { |
| 142 std::vector<std::string> auth_types(std::begin(kDefaultAuthSchemes), | 146 std::vector<std::string> auth_types(std::begin(kDefaultAuthSchemes), |
| 143 std::end(kDefaultAuthSchemes)); | 147 std::end(kDefaultAuthSchemes)); |
| 144 HttpAuthPreferences prefs(auth_types | 148 HttpAuthPreferences prefs(auth_types |
| 145 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 149 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 146 , | 150 , |
| 147 std::string() | 151 std::string() |
| 148 #endif | 152 #endif |
| 149 ); | 153 #if defined(OS_CHROMEOS) |
| 154 , | |
| 155 true | |
| 156 #endif | |
| 157 ); | |
| 150 return CreateAuthHandlerRegistryFactory(prefs, host_resolver); | 158 return CreateAuthHandlerRegistryFactory(prefs, host_resolver); |
| 151 } | 159 } |
| 152 | 160 |
| 153 // static | 161 // static |
| 154 std::unique_ptr<HttpAuthHandlerRegistryFactory> | 162 std::unique_ptr<HttpAuthHandlerRegistryFactory> |
| 155 HttpAuthHandlerRegistryFactory::Create(const HttpAuthPreferences* prefs, | 163 HttpAuthHandlerRegistryFactory::Create(const HttpAuthPreferences* prefs, |
| 156 HostResolver* host_resolver) { | 164 HostResolver* host_resolver) { |
| 157 std::unique_ptr<HttpAuthHandlerRegistryFactory> registry_factory( | 165 std::unique_ptr<HttpAuthHandlerRegistryFactory> registry_factory( |
| 158 CreateAuthHandlerRegistryFactory(*prefs, host_resolver)); | 166 CreateAuthHandlerRegistryFactory(*prefs, host_resolver)); |
| 159 registry_factory->set_http_auth_preferences(prefs); | 167 registry_factory->set_http_auth_preferences(prefs); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 183 handler->reset(); | 191 handler->reset(); |
| 184 return ERR_UNSUPPORTED_AUTH_SCHEME; | 192 return ERR_UNSUPPORTED_AUTH_SCHEME; |
| 185 } | 193 } |
| 186 DCHECK(it->second); | 194 DCHECK(it->second); |
| 187 return it->second->CreateAuthHandler(challenge, target, ssl_info, origin, | 195 return it->second->CreateAuthHandler(challenge, target, ssl_info, origin, |
| 188 reason, digest_nonce_count, net_log, | 196 reason, digest_nonce_count, net_log, |
| 189 handler); | 197 handler); |
| 190 } | 198 } |
| 191 | 199 |
| 192 } // namespace net | 200 } // namespace net |
| OLD | NEW |