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_URL_SECURITY_MANAGER_H_ | 5 #ifndef NET_HTTP_URL_SECURITY_MANAGER_H_ |
6 #define NET_HTTP_URL_SECURITY_MANAGER_H_ | 6 #define NET_HTTP_URL_SECURITY_MANAGER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
11 | 11 #include "url/origin.h" |
12 class GURL; | |
13 | 12 |
14 namespace net { | 13 namespace net { |
15 | 14 |
16 class HttpAuthFilter; | 15 class HttpAuthFilter; |
17 | 16 |
18 // The URL security manager controls the policies (allow, deny, prompt user) | 17 // The URL security manager controls the policies (allow, deny, prompt user) |
19 // regarding URL actions (e.g., sending the default credentials to a server). | 18 // regarding URL actions (e.g., sending the default credentials to a server). |
20 class NET_EXPORT URLSecurityManager { | 19 class NET_EXPORT URLSecurityManager { |
21 public: | 20 public: |
22 URLSecurityManager() {} | 21 URLSecurityManager() {} |
(...skipping 16 matching lines...) Expand all Loading... |
39 // Both |whitelist_default| and |whitelist_delegate| will be owned by | 38 // Both |whitelist_default| and |whitelist_delegate| will be owned by |
40 // the created URLSecurityManager. | 39 // the created URLSecurityManager. |
41 // | 40 // |
42 // TODO(cbentzel): Perhaps it's better to make a non-abstract HttpAuthFilter | 41 // TODO(cbentzel): Perhaps it's better to make a non-abstract HttpAuthFilter |
43 // and just copy into the URLSecurityManager? | 42 // and just copy into the URLSecurityManager? |
44 static URLSecurityManager* Create(const HttpAuthFilter* whitelist_default, | 43 static URLSecurityManager* Create(const HttpAuthFilter* whitelist_default, |
45 const HttpAuthFilter* whitelist_delegate); | 44 const HttpAuthFilter* whitelist_delegate); |
46 | 45 |
47 // Returns true if we can send the default credentials to the server at | 46 // Returns true if we can send the default credentials to the server at |
48 // |auth_origin| for HTTP NTLM or Negotiate authentication. | 47 // |auth_origin| for HTTP NTLM or Negotiate authentication. |
49 virtual bool CanUseDefaultCredentials(const GURL& auth_origin) const = 0; | 48 virtual bool CanUseDefaultCredentials( |
| 49 const url::Origin& auth_origin) const = 0; |
50 | 50 |
51 // Returns true if Kerberos delegation is allowed for the server at | 51 // Returns true if Kerberos delegation is allowed for the server at |
52 // |auth_origin| for HTTP Negotiate authentication. | 52 // |auth_origin| for HTTP Negotiate authentication. |
53 virtual bool CanDelegate(const GURL& auth_origin) const = 0; | 53 virtual bool CanDelegate(const url::Origin& auth_origin) const = 0; |
54 | 54 |
55 private: | 55 private: |
56 DISALLOW_COPY_AND_ASSIGN(URLSecurityManager); | 56 DISALLOW_COPY_AND_ASSIGN(URLSecurityManager); |
57 }; | 57 }; |
58 | 58 |
59 class URLSecurityManagerWhitelist : public URLSecurityManager { | 59 class URLSecurityManagerWhitelist : public URLSecurityManager { |
60 public: | 60 public: |
61 // The URLSecurityManagerWhitelist takes ownership of the whitelists. | 61 // The URLSecurityManagerWhitelist takes ownership of the whitelists. |
62 URLSecurityManagerWhitelist(const HttpAuthFilter* whitelist_default, | 62 URLSecurityManagerWhitelist(const HttpAuthFilter* whitelist_default, |
63 const HttpAuthFilter* whitelist_delegation); | 63 const HttpAuthFilter* whitelist_delegation); |
64 ~URLSecurityManagerWhitelist() override; | 64 ~URLSecurityManagerWhitelist() override; |
65 | 65 |
66 // URLSecurityManager methods. | 66 // URLSecurityManager methods. |
67 bool CanUseDefaultCredentials(const GURL& auth_origin) const override; | 67 bool CanUseDefaultCredentials(const url::Origin& auth_origin) const override; |
68 bool CanDelegate(const GURL& auth_origin) const override; | 68 bool CanDelegate(const url::Origin& auth_origin) const override; |
69 | 69 |
70 private: | 70 private: |
71 scoped_ptr<const HttpAuthFilter> whitelist_default_; | 71 scoped_ptr<const HttpAuthFilter> whitelist_default_; |
72 scoped_ptr<const HttpAuthFilter> whitelist_delegate_; | 72 scoped_ptr<const HttpAuthFilter> whitelist_delegate_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(URLSecurityManagerWhitelist); | 74 DISALLOW_COPY_AND_ASSIGN(URLSecurityManagerWhitelist); |
75 }; | 75 }; |
76 | 76 |
77 } // namespace net | 77 } // namespace net |
78 | 78 |
79 #endif // NET_HTTP_URL_SECURITY_MANAGER_H_ | 79 #endif // NET_HTTP_URL_SECURITY_MANAGER_H_ |
OLD | NEW |