| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/strings/string_split.h" | 5 #include "base/strings/string_split.h" |
| 6 #include "net/http/http_auth_filter.h" | 6 #include "net/http/http_auth_filter.h" |
| 7 #include "net/http/http_auth_preferences.h" | 7 #include "net/http/http_auth_preferences.h" |
| 8 #include "net/http/url_security_manager.h" | 8 #include "net/http/url_security_manager.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 HttpAuthPreferences::HttpAuthPreferences( | 12 HttpAuthPreferences::HttpAuthPreferences( |
| 13 const std::vector<std::string>& auth_schemes | 13 const std::vector<std::string>& auth_schemes |
| 14 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 14 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 15 , | 15 , |
| 16 const std::string& gssapi_library_name | 16 const std::string& gssapi_library_name |
| 17 #endif | 17 #endif |
| 18 #if defined(OS_CHROMEOS) |
| 19 , |
| 20 bool allow_gssapi_library_load |
| 21 #endif |
| 18 ) | 22 ) |
| 19 : auth_schemes_(auth_schemes.begin(), auth_schemes.end()), | 23 : auth_schemes_(auth_schemes.begin(), auth_schemes.end()), |
| 20 negotiate_disable_cname_lookup_(false), | 24 negotiate_disable_cname_lookup_(false), |
| 21 negotiate_enable_port_(false), | 25 negotiate_enable_port_(false), |
| 22 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 26 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 23 gssapi_library_name_(gssapi_library_name), | 27 gssapi_library_name_(gssapi_library_name), |
| 24 #endif | 28 #endif |
| 29 #if defined(OS_CHROMEOS) |
| 30 allow_gssapi_library_load_(allow_gssapi_library_load), |
| 31 #endif |
| 25 security_manager_(URLSecurityManager::Create()) { | 32 security_manager_(URLSecurityManager::Create()) { |
| 26 } | 33 } |
| 27 | 34 |
| 28 HttpAuthPreferences::~HttpAuthPreferences() {} | 35 HttpAuthPreferences::~HttpAuthPreferences() {} |
| 29 | 36 |
| 30 bool HttpAuthPreferences::IsSupportedScheme(const std::string& scheme) const { | 37 bool HttpAuthPreferences::IsSupportedScheme(const std::string& scheme) const { |
| 31 return auth_schemes_.count(scheme) == 1; | 38 return auth_schemes_.count(scheme) == 1; |
| 32 } | 39 } |
| 33 | 40 |
| 34 bool HttpAuthPreferences::NegotiateDisableCnameLookup() const { | 41 bool HttpAuthPreferences::NegotiateDisableCnameLookup() const { |
| 35 return negotiate_disable_cname_lookup_; | 42 return negotiate_disable_cname_lookup_; |
| 36 } | 43 } |
| 37 | 44 |
| 38 bool HttpAuthPreferences::NegotiateEnablePort() const { | 45 bool HttpAuthPreferences::NegotiateEnablePort() const { |
| 39 return negotiate_enable_port_; | 46 return negotiate_enable_port_; |
| 40 } | 47 } |
| 41 | 48 |
| 42 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
| 43 std::string HttpAuthPreferences::AuthAndroidNegotiateAccountType() const { | 50 std::string HttpAuthPreferences::AuthAndroidNegotiateAccountType() const { |
| 44 return auth_android_negotiate_account_type_; | 51 return auth_android_negotiate_account_type_; |
| 45 } | 52 } |
| 46 #endif | 53 #endif |
| 47 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 54 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 48 std::string HttpAuthPreferences::GssapiLibraryName() const { | 55 std::string HttpAuthPreferences::GssapiLibraryName() const { |
| 49 return gssapi_library_name_; | 56 return gssapi_library_name_; |
| 50 } | 57 } |
| 51 #endif | 58 #endif |
| 59 #if defined(OS_CHROMEOS) |
| 60 bool HttpAuthPreferences::AllowGssapiLibraryLoad() const { |
| 61 return allow_gssapi_library_load_; |
| 62 } |
| 63 #endif |
| 52 | 64 |
| 53 bool HttpAuthPreferences::CanUseDefaultCredentials( | 65 bool HttpAuthPreferences::CanUseDefaultCredentials( |
| 54 const GURL& auth_origin) const { | 66 const GURL& auth_origin) const { |
| 55 return security_manager_->CanUseDefaultCredentials(auth_origin); | 67 return security_manager_->CanUseDefaultCredentials(auth_origin); |
| 56 } | 68 } |
| 57 | 69 |
| 58 bool HttpAuthPreferences::CanDelegate(const GURL& auth_origin) const { | 70 bool HttpAuthPreferences::CanDelegate(const GURL& auth_origin) const { |
| 59 return security_manager_->CanDelegate(auth_origin); | 71 return security_manager_->CanDelegate(auth_origin); |
| 60 } | 72 } |
| 61 | 73 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 73 const std::string& delegate_whitelist) { | 85 const std::string& delegate_whitelist) { |
| 74 if (delegate_whitelist.empty()) { | 86 if (delegate_whitelist.empty()) { |
| 75 security_manager_->SetDelegateWhitelist(std::unique_ptr<HttpAuthFilter>()); | 87 security_manager_->SetDelegateWhitelist(std::unique_ptr<HttpAuthFilter>()); |
| 76 } else { | 88 } else { |
| 77 security_manager_->SetDelegateWhitelist(std::unique_ptr<HttpAuthFilter>( | 89 security_manager_->SetDelegateWhitelist(std::unique_ptr<HttpAuthFilter>( |
| 78 new net::HttpAuthFilterWhitelist(delegate_whitelist))); | 90 new net::HttpAuthFilterWhitelist(delegate_whitelist))); |
| 79 } | 91 } |
| 80 } | 92 } |
| 81 | 93 |
| 82 } // namespace net | 94 } // namespace net |
| OLD | NEW |