OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_HTTP_HTTP_AUTH_FILTER_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_FILTER_H_ |
6 #define NET_HTTP_HTTP_AUTH_FILTER_H_ | 6 #define NET_HTTP_HTTP_AUTH_FILTER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "net/base/net_api.h" | 12 #include "net/base/net_export.h" |
13 #include "net/http/http_auth.h" | 13 #include "net/http/http_auth.h" |
14 #include "net/proxy/proxy_bypass_rules.h" | 14 #include "net/proxy/proxy_bypass_rules.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 // |HttpAuthFilter|s determine whether an authentication scheme should be | 20 // |HttpAuthFilter|s determine whether an authentication scheme should be |
21 // allowed for a particular peer. | 21 // allowed for a particular peer. |
22 class NET_TEST HttpAuthFilter { | 22 class NET_EXPORT_PRIVATE HttpAuthFilter { |
23 public: | 23 public: |
24 virtual ~HttpAuthFilter() {} | 24 virtual ~HttpAuthFilter() {} |
25 | 25 |
26 // Checks if (|url|, |target|) is supported by the authentication scheme. | 26 // Checks if (|url|, |target|) is supported by the authentication scheme. |
27 // Only the host of |url| is examined. | 27 // Only the host of |url| is examined. |
28 virtual bool IsValid(const GURL& url, HttpAuth::Target target) const = 0; | 28 virtual bool IsValid(const GURL& url, HttpAuth::Target target) const = 0; |
29 }; | 29 }; |
30 | 30 |
31 // Whitelist HTTP authentication filter. | 31 // Whitelist HTTP authentication filter. |
32 // Explicit whitelists of domains are set via SetWhitelist(). | 32 // Explicit whitelists of domains are set via SetWhitelist(). |
33 // | 33 // |
34 // Uses the ProxyBypassRules class to do whitelisting for servers. | 34 // Uses the ProxyBypassRules class to do whitelisting for servers. |
35 // All proxies are allowed. | 35 // All proxies are allowed. |
36 class NET_API HttpAuthFilterWhitelist : public HttpAuthFilter { | 36 class NET_EXPORT HttpAuthFilterWhitelist : public HttpAuthFilter { |
37 public: | 37 public: |
38 explicit HttpAuthFilterWhitelist(const std::string& server_whitelist); | 38 explicit HttpAuthFilterWhitelist(const std::string& server_whitelist); |
39 virtual ~HttpAuthFilterWhitelist(); | 39 virtual ~HttpAuthFilterWhitelist(); |
40 | 40 |
41 // Adds an individual URL |filter| to the list, of the specified |target|. | 41 // Adds an individual URL |filter| to the list, of the specified |target|. |
42 bool AddFilter(const std::string& filter, HttpAuth::Target target); | 42 bool AddFilter(const std::string& filter, HttpAuth::Target target); |
43 | 43 |
44 // Adds a rule that bypasses all "local" hostnames. | 44 // Adds a rule that bypasses all "local" hostnames. |
45 void AddRuleToBypassLocal(); | 45 void AddRuleToBypassLocal(); |
46 | 46 |
(...skipping 10 matching lines...) Expand all Loading... |
57 // We are using ProxyBypassRules because they have the functionality that we | 57 // We are using ProxyBypassRules because they have the functionality that we |
58 // want, but we are not using it for proxy bypass. | 58 // want, but we are not using it for proxy bypass. |
59 ProxyBypassRules rules_; | 59 ProxyBypassRules rules_; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(HttpAuthFilterWhitelist); | 61 DISALLOW_COPY_AND_ASSIGN(HttpAuthFilterWhitelist); |
62 }; | 62 }; |
63 | 63 |
64 } // namespace net | 64 } // namespace net |
65 | 65 |
66 #endif // NET_HTTP_HTTP_AUTH_FILTER_H_ | 66 #endif // NET_HTTP_HTTP_AUTH_FILTER_H_ |
OLD | NEW |