Merge pull request #157 from atom/allow-ntlm-everywhere
Optionally allow NTLM authentication for all domains
This commit is contained in:
commit
9efc5fffa2
3 changed files with 48 additions and 2 deletions
|
@ -50,6 +50,7 @@ class BrowserClient : public content::ContentBrowserClient {
|
|||
BrowserMainParts* browser_main_parts_;
|
||||
NetLog net_log_;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(BrowserClient);
|
||||
};
|
||||
|
||||
|
|
|
@ -84,6 +84,24 @@ const char kProxyPacUrl[] = "proxy-pac-url";
|
|||
|
||||
} // namespace
|
||||
|
||||
|
||||
URLRequestContextGetter::DelegateURLSecurityManager::DelegateURLSecurityManager
|
||||
(URLRequestContextGetter::Delegate* delegate) :
|
||||
delegate_(delegate) {}
|
||||
|
||||
bool URLRequestContextGetter::DelegateURLSecurityManager::CanUseDefaultCredentials
|
||||
(const GURL& auth_origin) const {
|
||||
return delegate_->AllowNTLMCredentialsForDomain(auth_origin);
|
||||
}
|
||||
|
||||
bool URLRequestContextGetter::DelegateURLSecurityManager::CanDelegate
|
||||
(const GURL& auth_origin) const {
|
||||
return delegate_->CanDelegateURLSecurity(auth_origin);
|
||||
}
|
||||
|
||||
URLRequestContextGetter::Delegate::Delegate() :
|
||||
orig_url_sec_mgr_(net::URLSecurityManager::Create(NULL, NULL)) {}
|
||||
|
||||
std::string URLRequestContextGetter::Delegate::GetUserAgent() {
|
||||
return base::EmptyString();
|
||||
}
|
||||
|
@ -128,6 +146,15 @@ net::SSLConfigService* URLRequestContextGetter::Delegate::CreateSSLConfigService
|
|||
return new net::SSLConfigServiceDefaults;
|
||||
}
|
||||
|
||||
bool URLRequestContextGetter::Delegate::AllowNTLMCredentialsForDomain(const GURL& auth_origin) {
|
||||
return orig_url_sec_mgr_->CanUseDefaultCredentials(auth_origin);
|
||||
}
|
||||
|
||||
bool URLRequestContextGetter::Delegate::CanDelegateURLSecurity(const GURL& auth_origin) {
|
||||
return orig_url_sec_mgr_->CanDelegate(auth_origin);
|
||||
}
|
||||
|
||||
|
||||
URLRequestContextGetter::URLRequestContextGetter(
|
||||
Delegate* delegate,
|
||||
DevToolsNetworkController* controller,
|
||||
|
@ -145,7 +172,7 @@ URLRequestContextGetter::URLRequestContextGetter(
|
|||
in_memory_(in_memory),
|
||||
io_loop_(io_loop),
|
||||
file_loop_(file_loop),
|
||||
url_sec_mgr_(net::URLSecurityManager::Create(NULL, NULL)),
|
||||
url_sec_mgr_(new URLRequestContextGetter::DelegateURLSecurityManager(delegate)),
|
||||
protocol_interceptors_(protocol_interceptors.Pass()) {
|
||||
// Must first be created on the UI thread.
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
|
|
|
@ -34,7 +34,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
|||
public:
|
||||
class Delegate {
|
||||
public:
|
||||
Delegate() {}
|
||||
Delegate();
|
||||
virtual ~Delegate() {}
|
||||
|
||||
virtual net::NetworkDelegate* CreateNetworkDelegate() { return NULL; }
|
||||
|
@ -45,6 +45,24 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
|||
virtual net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory(
|
||||
const base::FilePath& base_path);
|
||||
virtual net::SSLConfigService* CreateSSLConfigService();
|
||||
virtual bool AllowNTLMCredentialsForDomain(const GURL& auth_origin);
|
||||
virtual bool CanDelegateURLSecurity(const GURL& auth_origin);
|
||||
|
||||
private:
|
||||
scoped_ptr<net::URLSecurityManager> orig_url_sec_mgr_;
|
||||
};
|
||||
|
||||
class DelegateURLSecurityManager : public net::URLSecurityManager {
|
||||
public:
|
||||
DelegateURLSecurityManager(URLRequestContextGetter::Delegate* delegate);
|
||||
|
||||
bool CanUseDefaultCredentials(const GURL& auth_origin) const override;
|
||||
bool CanDelegate(const GURL& auth_origin) const override;
|
||||
|
||||
private:
|
||||
URLRequestContextGetter::Delegate* delegate_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DelegateURLSecurityManager);
|
||||
};
|
||||
|
||||
URLRequestContextGetter(
|
||||
|
|
Loading…
Reference in a new issue