[email protected] | 930cbb5 | 2010-04-02 17:27:10 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "net/http/url_security_manager.h" | ||||
6 | |||||
dcheng | c7eeda42 | 2015-12-26 03:56:48 | [diff] [blame] | 7 | #include <utility> |
8 | |||||
[email protected] | b4955e7d | 2010-04-16 20:22:30 | [diff] [blame] | 9 | #include "net/http/http_auth_filter.h" |
10 | |||||
[email protected] | 930cbb5 | 2010-04-02 17:27:10 | [diff] [blame] | 11 | namespace net { |
12 | |||||
Ryan Sleevi | a9d6aa6 | 2019-07-26 13:32:18 | [diff] [blame] | 13 | URLSecurityManagerAllowlist::URLSecurityManagerAllowlist() = default; |
[email protected] | b4955e7d | 2010-04-16 20:22:30 | [diff] [blame] | 14 | |
Ryan Sleevi | a9d6aa6 | 2019-07-26 13:32:18 | [diff] [blame] | 15 | URLSecurityManagerAllowlist::~URLSecurityManagerAllowlist() = default; |
[email protected] | b104b50 | 2010-10-18 20:21:31 | [diff] [blame] | 16 | |
Ryan Sleevi | a9d6aa6 | 2019-07-26 13:32:18 | [diff] [blame] | 17 | bool URLSecurityManagerAllowlist::CanUseDefaultCredentials( |
18 | const GURL& auth_origin) const { | ||||
19 | if (allowlist_default_.get()) | ||||
20 | return allowlist_default_->IsValid(auth_origin, HttpAuth::AUTH_SERVER); | ||||
[email protected] | d201b200e | 2010-08-27 17:35:02 | [diff] [blame] | 21 | return false; |
22 | } | ||||
23 | |||||
Ryan Sleevi | a9d6aa6 | 2019-07-26 13:32:18 | [diff] [blame] | 24 | bool URLSecurityManagerAllowlist::CanDelegate(const GURL& auth_origin) const { |
25 | if (allowlist_delegate_.get()) | ||||
26 | return allowlist_delegate_->IsValid(auth_origin, HttpAuth::AUTH_SERVER); | ||||
[email protected] | b4955e7d | 2010-04-16 20:22:30 | [diff] [blame] | 27 | return false; |
[email protected] | 930cbb5 | 2010-04-02 17:27:10 | [diff] [blame] | 28 | } |
29 | |||||
Ryan Sleevi | a9d6aa6 | 2019-07-26 13:32:18 | [diff] [blame] | 30 | void URLSecurityManagerAllowlist::SetDefaultAllowlist( |
31 | std::unique_ptr<HttpAuthFilter> allowlist_default) { | ||||
32 | allowlist_default_ = std::move(allowlist_default); | ||||
aberent | bba302d | 2015-12-03 10:20:19 | [diff] [blame] | 33 | } |
34 | |||||
Ryan Sleevi | a9d6aa6 | 2019-07-26 13:32:18 | [diff] [blame] | 35 | void URLSecurityManagerAllowlist::SetDelegateAllowlist( |
36 | std::unique_ptr<HttpAuthFilter> allowlist_delegate) { | ||||
37 | allowlist_delegate_ = std::move(allowlist_delegate); | ||||
aberent | bba302d | 2015-12-03 10:20:19 | [diff] [blame] | 38 | } |
39 | |||||
Ryan Sleevi | a9d6aa6 | 2019-07-26 13:32:18 | [diff] [blame] | 40 | bool URLSecurityManagerAllowlist::HasDefaultAllowlist() const { |
41 | return allowlist_default_.get() != nullptr; | ||||
aberent | bba302d | 2015-12-03 10:20:19 | [diff] [blame] | 42 | } |
43 | |||||
[email protected] | 930cbb5 | 2010-04-02 17:27:10 | [diff] [blame] | 44 | } // namespace net |