OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/strings/string_split.h" |
| 6 #include "net/http/http_auth_filter.h" |
| 7 #include "net/http/http_auth_preferences.h" |
| 8 #include "net/http/url_security_manager.h" |
| 9 |
| 10 namespace net { |
| 11 |
| 12 HttpAuthPreferences::HttpAuthPreferences( |
| 13 const std::vector<std::string>& auth_schemes |
| 14 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 15 , |
| 16 std::string gssapi_library_name |
| 17 #endif |
| 18 ) |
| 19 : auth_schemes_(auth_schemes), |
| 20 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 21 gssapi_library_name_(gssapi_library_name), |
| 22 #endif |
| 23 security_manager_(URLSecurityManager::Create()) { |
| 24 } |
| 25 |
| 26 HttpAuthPreferences::~HttpAuthPreferences() {} |
| 27 |
| 28 std::vector<std::string> HttpAuthPreferences::auth_schemes() const { |
| 29 return auth_schemes_; |
| 30 } |
| 31 |
| 32 bool HttpAuthPreferences::negotiate_disable_cname_lookup() const { |
| 33 return negotiate_disable_cname_lookup_; |
| 34 } |
| 35 |
| 36 bool HttpAuthPreferences::negotiate_enable_port() const { |
| 37 return negotiate_enable_port_; |
| 38 } |
| 39 |
| 40 #if defined(OS_ANDROID) |
| 41 std::string HttpAuthPreferences::auth_android_negotiate_account_type() const { |
| 42 return auth_android_negotiate_account_type_; |
| 43 } |
| 44 #endif |
| 45 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 46 std::string HttpAuthPreferences::gssapi_library_name() const { |
| 47 return gssapi_library_name_; |
| 48 } |
| 49 #endif |
| 50 |
| 51 bool HttpAuthPreferences::CanUseDefaultCredentials( |
| 52 const GURL& auth_origin) const { |
| 53 return security_manager_->CanUseDefaultCredentials(auth_origin); |
| 54 } |
| 55 |
| 56 bool HttpAuthPreferences::CanDelegate(const GURL& auth_origin) const { |
| 57 return security_manager_->CanDelegate(auth_origin); |
| 58 } |
| 59 |
| 60 void HttpAuthPreferences::set_server_whitelist( |
| 61 const std::string& server_whitelist) { |
| 62 if (server_whitelist.empty()) { |
| 63 security_manager_->SetDefaultWhitelist(scoped_ptr<HttpAuthFilter>()); |
| 64 } else { |
| 65 security_manager_->SetDefaultWhitelist(scoped_ptr<HttpAuthFilter>( |
| 66 new net::HttpAuthFilterWhitelist(server_whitelist))); |
| 67 } |
| 68 } |
| 69 |
| 70 void HttpAuthPreferences::set_delegate_whitelist( |
| 71 const std::string& delegate_whitelist) { |
| 72 if (delegate_whitelist.empty()) { |
| 73 security_manager_->SetDelegateWhitelist(scoped_ptr<HttpAuthFilter>()); |
| 74 } else { |
| 75 security_manager_->SetDelegateWhitelist(scoped_ptr<HttpAuthFilter>( |
| 76 new net::HttpAuthFilterWhitelist(delegate_whitelist))); |
| 77 } |
| 78 } |
| 79 |
| 80 } // namespace net |
OLD | NEW |