mirror of
https://github.com/electron/electron.git
synced 2026-01-10 07:58:08 -05:00
fix: provide explicit cookie encryption provider for cookie encryption (#49348)
fix: provide explicit cookie encryption provider Fixes 6996667: Reland "Port net::CookieCryptoDelegate to os_crypt async" | https://chromium-review.googlesource.com/c/chromium/src/+/6996667
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "net/http/http_util.h"
|
||||
#include "net/net_buildflags.h"
|
||||
#include "services/network/network_service.h"
|
||||
#include "services/network/public/cpp/cookie_encryption_provider_impl.h"
|
||||
#include "services/network/public/cpp/cors/origin_access_list.h"
|
||||
#include "shell/browser/browser_process_impl.h"
|
||||
#include "shell/browser/electron_browser_client.h"
|
||||
@@ -114,6 +115,18 @@ void NetworkContextService::ConfigureNetworkContextParams(
|
||||
network_context_params->enable_encrypted_cookies =
|
||||
electron::fuses::IsCookieEncryptionEnabled();
|
||||
|
||||
// If cookie encryption is enabled, we need to provide a cookie encryption
|
||||
// provider for the network service to use.
|
||||
if (network_context_params->enable_encrypted_cookies) {
|
||||
if (!cookie_encryption_provider_) {
|
||||
cookie_encryption_provider_ =
|
||||
std::make_unique<CookieEncryptionProviderImpl>(
|
||||
g_browser_process->os_crypt_async());
|
||||
}
|
||||
network_context_params->cookie_encryption_provider =
|
||||
cookie_encryption_provider_->BindNewRemote();
|
||||
}
|
||||
|
||||
network_context_params->file_paths->transport_security_persister_file_name =
|
||||
base::FilePath(chrome::kTransportSecurityPersisterFilename);
|
||||
}
|
||||
|
||||
@@ -5,12 +5,16 @@
|
||||
#ifndef ELECTRON_SHELL_BROWSER_NET_NETWORK_CONTEXT_SERVICE_H_
|
||||
#define ELECTRON_SHELL_BROWSER_NET_NETWORK_CONTEXT_SERVICE_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "chrome/browser/net/proxy_config_monitor.h"
|
||||
#include "components/keyed_service/core/keyed_service.h"
|
||||
#include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom-forward.h"
|
||||
#include "services/network/public/mojom/network_context.mojom-forward.h"
|
||||
|
||||
class CookieEncryptionProviderImpl;
|
||||
|
||||
namespace base {
|
||||
class FilePath;
|
||||
} // namespace base
|
||||
@@ -46,6 +50,7 @@ class NetworkContextService : public KeyedService {
|
||||
|
||||
raw_ptr<ElectronBrowserContext> browser_context_;
|
||||
ProxyConfigMonitor proxy_config_monitor_;
|
||||
std::unique_ptr<CookieEncryptionProviderImpl> cookie_encryption_provider_;
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
||||
Reference in New Issue
Block a user