| Index: net/http/http_auth_preferences.cc
|
| diff --git a/net/http/http_auth_preferences.cc b/net/http/http_auth_preferences.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2e9fdae9b40e5041679087bc0c0b77c3b96041f9
|
| --- /dev/null
|
| +++ b/net/http/http_auth_preferences.cc
|
| @@ -0,0 +1,80 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "base/strings/string_split.h"
|
| +#include "net/http/http_auth_filter.h"
|
| +#include "net/http/http_auth_preferences.h"
|
| +#include "net/http/url_security_manager.h"
|
| +
|
| +namespace net {
|
| +
|
| +HttpAuthPreferences::HttpAuthPreferences(
|
| + const std::vector<std::string>& auth_schemes
|
| +#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
| + ,
|
| + std::string gssapi_library_name
|
| +#endif
|
| + )
|
| + : auth_schemes_(auth_schemes),
|
| +#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
| + gssapi_library_name_(gssapi_library_name),
|
| +#endif
|
| + security_manager_(URLSecurityManager::Create()) {
|
| +}
|
| +
|
| +HttpAuthPreferences::~HttpAuthPreferences() {}
|
| +
|
| +std::vector<std::string> HttpAuthPreferences::auth_schemes() const {
|
| + return auth_schemes_;
|
| +}
|
| +
|
| +bool HttpAuthPreferences::negotiate_disable_cname_lookup() const {
|
| + return negotiate_disable_cname_lookup_;
|
| +}
|
| +
|
| +bool HttpAuthPreferences::negotiate_enable_port() const {
|
| + return negotiate_enable_port_;
|
| +}
|
| +
|
| +#if defined(OS_ANDROID)
|
| +std::string HttpAuthPreferences::auth_android_negotiate_account_type() const {
|
| + return auth_android_negotiate_account_type_;
|
| +}
|
| +#endif
|
| +#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
| +std::string HttpAuthPreferences::gssapi_library_name() const {
|
| + return gssapi_library_name_;
|
| +}
|
| +#endif
|
| +
|
| +bool HttpAuthPreferences::CanUseDefaultCredentials(
|
| + const GURL& auth_origin) const {
|
| + return security_manager_->CanUseDefaultCredentials(auth_origin);
|
| +}
|
| +
|
| +bool HttpAuthPreferences::CanDelegate(const GURL& auth_origin) const {
|
| + return security_manager_->CanDelegate(auth_origin);
|
| +}
|
| +
|
| +void HttpAuthPreferences::set_server_whitelist(
|
| + const std::string& server_whitelist) {
|
| + if (server_whitelist.empty()) {
|
| + security_manager_->SetDefaultWhitelist(scoped_ptr<HttpAuthFilter>());
|
| + } else {
|
| + security_manager_->SetDefaultWhitelist(scoped_ptr<HttpAuthFilter>(
|
| + new net::HttpAuthFilterWhitelist(server_whitelist)));
|
| + }
|
| +}
|
| +
|
| +void HttpAuthPreferences::set_delegate_whitelist(
|
| + const std::string& delegate_whitelist) {
|
| + if (delegate_whitelist.empty()) {
|
| + security_manager_->SetDelegateWhitelist(scoped_ptr<HttpAuthFilter>());
|
| + } else {
|
| + security_manager_->SetDelegateWhitelist(scoped_ptr<HttpAuthFilter>(
|
| + new net::HttpAuthFilterWhitelist(delegate_whitelist)));
|
| + }
|
| +}
|
| +
|
| +} // namespace net
|
|
|