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