blob: c7cbc4cfc037570186ba6c66e174ed0a4fb0e03d [file] [log] [blame]
[email protected]930cbb52010-04-02 17:27:101// 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
dchengc7eeda422015-12-26 03:56:487#include <utility>
8
[email protected]b4955e7d2010-04-16 20:22:309#include "net/http/http_auth_filter.h"
10
[email protected]930cbb52010-04-02 17:27:1011namespace net {
12
Ryan Sleevia9d6aa62019-07-26 13:32:1813URLSecurityManagerAllowlist::URLSecurityManagerAllowlist() = default;
[email protected]b4955e7d2010-04-16 20:22:3014
Ryan Sleevia9d6aa62019-07-26 13:32:1815URLSecurityManagerAllowlist::~URLSecurityManagerAllowlist() = default;
[email protected]b104b502010-10-18 20:21:3116
Ryan Sleevia9d6aa62019-07-26 13:32:1817bool 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]d201b200e2010-08-27 17:35:0221 return false;
22}
23
Ryan Sleevia9d6aa62019-07-26 13:32:1824bool URLSecurityManagerAllowlist::CanDelegate(const GURL& auth_origin) const {
25 if (allowlist_delegate_.get())
26 return allowlist_delegate_->IsValid(auth_origin, HttpAuth::AUTH_SERVER);
[email protected]b4955e7d2010-04-16 20:22:3027 return false;
[email protected]930cbb52010-04-02 17:27:1028}
29
Ryan Sleevia9d6aa62019-07-26 13:32:1830void URLSecurityManagerAllowlist::SetDefaultAllowlist(
31 std::unique_ptr<HttpAuthFilter> allowlist_default) {
32 allowlist_default_ = std::move(allowlist_default);
aberentbba302d2015-12-03 10:20:1933}
34
Ryan Sleevia9d6aa62019-07-26 13:32:1835void URLSecurityManagerAllowlist::SetDelegateAllowlist(
36 std::unique_ptr<HttpAuthFilter> allowlist_delegate) {
37 allowlist_delegate_ = std::move(allowlist_delegate);
aberentbba302d2015-12-03 10:20:1938}
39
Ryan Sleevia9d6aa62019-07-26 13:32:1840bool URLSecurityManagerAllowlist::HasDefaultAllowlist() const {
41 return allowlist_default_.get() != nullptr;
aberentbba302d2015-12-03 10:20:1942}
43
[email protected]930cbb52010-04-02 17:27:1044} // namespace net