From 73a60ea3e3ca0d68d5e60a8815e77983b29d30c1 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Fri, 16 Oct 2015 16:39:42 -0700 Subject: [PATCH] Create a new URLSecurityManager that allows explicit settings --- brightray/browser/url_request_context_getter.cc | 10 ++++++++++ brightray/browser/url_request_context_getter.h | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index bdef77d1c2e..5cbca4654b7 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -84,6 +84,16 @@ const char kProxyPacUrl[] = "proxy-pac-url"; } // namespace +ExplicitURLSecurityManager::ExplicitURLSecurityManager() : allow_default_creds_(false) {} + +bool ExplicitURLSecurityManager::CanUseDefaultCredentials(const GURL& auth_origin) const { + return allow_default_creds_; +} + +bool ExplicitURLSecurityManager::CanDelegate(const GURL& auth_origin) const { + return false; +} + std::string URLRequestContextGetter::Delegate::GetUserAgent() { return base::EmptyString(); } diff --git a/brightray/browser/url_request_context_getter.h b/brightray/browser/url_request_context_getter.h index 4794f1bf6e5..fdbb7c68156 100644 --- a/brightray/browser/url_request_context_getter.h +++ b/brightray/browser/url_request_context_getter.h @@ -30,6 +30,21 @@ namespace brightray { class DevToolsNetworkController; class NetLog; +class ExplicitURLSecurityManager : public net::URLSecurityManager { +public: + ExplicitURLSecurityManager(); + + virtual bool CanUseDefaultCredentials(const GURL& auth_origin) const override; + virtual bool CanDelegate(const GURL& auth_origin) const override; + + void AllowNTLMCredentialsForAllDomains(bool should_allow) { allow_default_creds_ = should_allow; } + +private: + bool allow_default_creds_; + + DISALLOW_COPY_AND_ASSIGN(ExplicitURLSecurityManager); +}; + class URLRequestContextGetter : public net::URLRequestContextGetter { public: class Delegate {