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 #ifndef NET_HTTP_HTTP_AUTH_PREFERENCES_H_ |
| 6 #define NET_HTTP_HTTP_AUTH_PREFERENCES_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 #include "base/macros.h" |
| 11 #include "net/base/net_export.h" |
| 12 #include "url/gurl.h" |
| 13 |
| 14 namespace net { |
| 15 |
| 16 class URLSecurityManager; |
| 17 /* |
| 18 * Manage the preferences needed for authentication, and provide a cache of them |
| 19 * accessible from the IO thread. |
| 20 */ |
| 21 class NET_EXPORT HttpAuthPreferences { |
| 22 public: |
| 23 HttpAuthPreferences(const std::vector<std::string>& auth_schemes |
| 24 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 25 , |
| 26 std::string gssapi_library_name |
| 27 #endif |
| 28 ); |
| 29 virtual ~HttpAuthPreferences(); |
| 30 |
| 31 virtual std::vector<std::string> auth_schemes() const; |
| 32 virtual bool negotiate_disable_cname_lookup() const; |
| 33 virtual bool negotiate_enable_port() const; |
| 34 #if defined(OS_ANDROID) |
| 35 virtual std::string auth_android_negotiate_account_type() const; |
| 36 #endif |
| 37 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 38 virtual std::string gssapi_library_name() const; |
| 39 #endif |
| 40 virtual bool CanUseDefaultCredentials(const GURL& auth_origin) const; |
| 41 virtual bool CanDelegate(const GURL& auth_origin) const; |
| 42 |
| 43 void set_negotiate_disable_cname_lookup(bool negotiate_disable_cname_lookup) { |
| 44 negotiate_disable_cname_lookup_ = negotiate_disable_cname_lookup; |
| 45 } |
| 46 |
| 47 void set_negotiate_enable_port(bool negotiate_enable_port) { |
| 48 negotiate_enable_port_ = negotiate_enable_port; |
| 49 } |
| 50 |
| 51 void set_server_whitelist(const std::string& server_whitelist); |
| 52 |
| 53 void set_delegate_whitelist(const std::string& delegate_whitelist); |
| 54 |
| 55 #if defined(OS_ANDROID) |
| 56 void set_auth_android_negotiate_account_type( |
| 57 const std::string& account_type) { |
| 58 auth_android_negotiate_account_type_ = account_type; |
| 59 } |
| 60 #endif |
| 61 |
| 62 private: |
| 63 // TODO(aberent) Make the list of auth schemes a PrefMember, so that the |
| 64 // policy can change after startup (https://crbug/549273). |
| 65 std::vector<std::string> auth_schemes_; |
| 66 bool negotiate_disable_cname_lookup_; |
| 67 bool negotiate_enable_port_; |
| 68 |
| 69 #if defined(OS_ANDROID) |
| 70 std::string auth_android_negotiate_account_type_; |
| 71 #endif |
| 72 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 73 // No PrefMember for the GSSAPI library name, since changing it after startup |
| 74 // requires unloading the existing GSSAPI library, which could cause all sorts |
| 75 // of problems for, for example, active Negotiate transactions. |
| 76 std::string gssapi_library_name_; |
| 77 #endif |
| 78 scoped_ptr<URLSecurityManager> security_manager_; |
| 79 DISALLOW_COPY_AND_ASSIGN(HttpAuthPreferences); |
| 80 }; |
| 81 } |
| 82 // namespace net |
| 83 #endif // NET_HTTP_HTTP_AUTH_PREFERENCES_H_ |
OLD | NEW |