diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 70595856c494..f124b00e8089 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -251,6 +251,12 @@ void App::SetAppUserModelId(const std::string& app_id) { #endif } +void App::AllowNTLMCredentialsForAllDomains(bool should_allow) { + auto browser_context = static_cast( + AtomBrowserMainParts::Get()->browser_context()); + browser_context->AllowNTLMCredentialsForAllDomains(should_allow); +} + std::string App::GetLocale() { return l10n_util::GetApplicationLocale(""); } @@ -285,6 +291,8 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder( .SetMethod("getPath", &App::GetPath) .SetMethod("setDesktopName", &App::SetDesktopName) .SetMethod("setAppUserModelId", &App::SetAppUserModelId) + .SetMethod("allowNTLMCredentialsForAllDomains", + &App::AllowNTLMCredentialsForAllDomains) .SetMethod("getLocale", &App::GetLocale) .SetProperty("defaultSession", &App::DefaultSession); } diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index 4896a5f066a1..75889d24543f 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -65,6 +65,8 @@ class App : public mate::EventEmitter, void SetDesktopName(const std::string& desktop_name); void SetAppUserModelId(const std::string& app_id); + void AllowNTLMCredentialsForAllDomains(bool should_allow); + std::string GetLocale(); v8::Local DefaultSession(v8::Isolate* isolate); diff --git a/atom/browser/atom_browser_context.cc b/atom/browser/atom_browser_context.cc index 6823fbaee90c..b0a9897352e1 100644 --- a/atom/browser/atom_browser_context.cc +++ b/atom/browser/atom_browser_context.cc @@ -60,7 +60,8 @@ std::string RemoveWhitespace(const std::string& str) { AtomBrowserContext::AtomBrowserContext(const std::string& partition, bool in_memory) : brightray::BrowserContext(partition, in_memory), - job_factory_(new AtomURLRequestJobFactory) { + job_factory_(new AtomURLRequestJobFactory), + allow_ntlm_everywhere_(false) { } AtomBrowserContext::~AtomBrowserContext() { @@ -168,6 +169,19 @@ void AtomBrowserContext::RegisterPrefs(PrefRegistrySimple* pref_registry) { base::FilePath()); } + +bool AtomBrowserContext::AllowNTLMCredentialsForDomain + (const GURL& auth_origin) { + if (allow_ntlm_everywhere_) return true; + return brightray::URLRequestContextGetter + ::Delegate::AllowNTLMCredentialsForDomain(auth_origin); +} + + +void AtomBrowserContext::AllowNTLMCredentialsForAllDomains(bool should_allow) { + allow_ntlm_everywhere_ = should_allow; +} + } // namespace atom namespace brightray { diff --git a/atom/browser/atom_browser_context.h b/atom/browser/atom_browser_context.h index 839359c1ef50..aafa092442bc 100644 --- a/atom/browser/atom_browser_context.h +++ b/atom/browser/atom_browser_context.h @@ -28,6 +28,7 @@ class AtomBrowserContext : public brightray::BrowserContext { net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory( const base::FilePath& base_path) override; net::SSLConfigService* CreateSSLConfigService() override; + bool AllowNTLMCredentialsForDomain(const GURL& auth_origin) override; // content::BrowserContext: content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; @@ -36,6 +37,8 @@ class AtomBrowserContext : public brightray::BrowserContext { // brightray::BrowserContext: void RegisterPrefs(PrefRegistrySimple* pref_registry) override; + void AllowNTLMCredentialsForAllDomains(bool should_allow); + AtomURLRequestJobFactory* job_factory() const { return job_factory_; } private: @@ -45,6 +48,8 @@ class AtomBrowserContext : public brightray::BrowserContext { // Managed by brightray::BrowserContext. AtomURLRequestJobFactory* job_factory_; + bool allow_ntlm_everywhere_; + DISALLOW_COPY_AND_ASSIGN(AtomBrowserContext); };