OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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> |
(...skipping 19 matching lines...) Expand all Loading... |
30 // Whitelist HTTP authentication filter. | 30 // Whitelist HTTP authentication filter. |
31 // Explicit whitelists of domains are set via SetWhitelist(). | 31 // Explicit whitelists of domains are set via SetWhitelist(). |
32 // | 32 // |
33 // Uses the ProxyBypassRules class to do whitelisting for servers. | 33 // Uses the ProxyBypassRules class to do whitelisting for servers. |
34 // All proxies are allowed. | 34 // All proxies are allowed. |
35 class HttpAuthFilterWhitelist : public HttpAuthFilter { | 35 class HttpAuthFilterWhitelist : public HttpAuthFilter { |
36 public: | 36 public: |
37 explicit HttpAuthFilterWhitelist(const std::string& server_whitelist); | 37 explicit HttpAuthFilterWhitelist(const std::string& server_whitelist); |
38 virtual ~HttpAuthFilterWhitelist(); | 38 virtual ~HttpAuthFilterWhitelist(); |
39 | 39 |
40 // HttpAuthFilter methods: | |
41 virtual bool IsValid(const GURL& url, HttpAuth::Target target) const; | |
42 | |
43 // Adds an individual URL |filter| to the list, of the specified |target|. | 40 // Adds an individual URL |filter| to the list, of the specified |target|. |
44 bool AddFilter(const std::string& filter, HttpAuth::Target target); | 41 bool AddFilter(const std::string& filter, HttpAuth::Target target); |
45 | 42 |
46 // Adds a rule that bypasses all "local" hostnames. | 43 // Adds a rule that bypasses all "local" hostnames. |
47 void AddRuleToBypassLocal(); | 44 void AddRuleToBypassLocal(); |
48 | 45 |
49 const ProxyBypassRules& rules() const { return rules_; } | 46 const ProxyBypassRules& rules() const { return rules_; } |
50 | 47 |
| 48 // HttpAuthFilter methods: |
| 49 virtual bool IsValid(const GURL& url, HttpAuth::Target target) const; |
| 50 |
51 private: | 51 private: |
52 // Installs the whitelist. | 52 // Installs the whitelist. |
53 // |server_whitelist| is parsed by ProxyBypassRules. | 53 // |server_whitelist| is parsed by ProxyBypassRules. |
54 void SetWhitelist(const std::string& server_whitelist); | 54 void SetWhitelist(const std::string& server_whitelist); |
55 | 55 |
56 // We are using ProxyBypassRules because they have the functionality that we | 56 // We are using ProxyBypassRules because they have the functionality that we |
57 // want, but we are not using it for proxy bypass. | 57 // want, but we are not using it for proxy bypass. |
58 ProxyBypassRules rules_; | 58 ProxyBypassRules rules_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(HttpAuthFilterWhitelist); | 60 DISALLOW_COPY_AND_ASSIGN(HttpAuthFilterWhitelist); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace net | 63 } // namespace net |
64 | 64 |
65 #endif // NET_HTTP_HTTP_AUTH_FILTER_H_ | 65 #endif // NET_HTTP_HTTP_AUTH_FILTER_H_ |
OLD | NEW |