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