1 // Copyright 2010 The Chromium Authors 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 7 #include <utility> 8 9 #include "net/http/http_auth_filter.h" 10 11 namespace net { 12 13 URLSecurityManagerAllowlist::URLSecurityManagerAllowlist() = default; 14 15 URLSecurityManagerAllowlist::~URLSecurityManagerAllowlist() = default; 16 CanUseDefaultCredentials(const url::SchemeHostPort & auth_scheme_host_port) const17bool URLSecurityManagerAllowlist::CanUseDefaultCredentials( 18 const url::SchemeHostPort& auth_scheme_host_port) const { 19 if (allowlist_default_.get()) 20 return allowlist_default_->IsValid(auth_scheme_host_port, 21 HttpAuth::AUTH_SERVER); 22 return false; 23 } 24 CanDelegate(const url::SchemeHostPort & auth_scheme_host_port) const25bool URLSecurityManagerAllowlist::CanDelegate( 26 const url::SchemeHostPort& auth_scheme_host_port) const { 27 if (allowlist_delegate_.get()) 28 return allowlist_delegate_->IsValid(auth_scheme_host_port, 29 HttpAuth::AUTH_SERVER); 30 return false; 31 } 32 SetDefaultAllowlist(std::unique_ptr<HttpAuthFilter> allowlist_default)33void URLSecurityManagerAllowlist::SetDefaultAllowlist( 34 std::unique_ptr<HttpAuthFilter> allowlist_default) { 35 allowlist_default_ = std::move(allowlist_default); 36 } 37 SetDelegateAllowlist(std::unique_ptr<HttpAuthFilter> allowlist_delegate)38void URLSecurityManagerAllowlist::SetDelegateAllowlist( 39 std::unique_ptr<HttpAuthFilter> allowlist_delegate) { 40 allowlist_delegate_ = std::move(allowlist_delegate); 41 } 42 HasDefaultAllowlist() const43bool URLSecurityManagerAllowlist::HasDefaultAllowlist() const { 44 return allowlist_default_.get() != nullptr; 45 } 46 47 } // namespace net 48