[GCP auth filter] hold ref to service config

pull/37831/head
Mark D. Roth 4 months ago
parent c938a7b564
commit 6995b074bd
  1. 9
      src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc
  2. 4
      src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h

@ -153,7 +153,7 @@ absl::StatusOr<std::unique_ptr<GcpAuthenticationFilter>>
GcpAuthenticationFilter::Create(const ChannelArgs& args,
ChannelFilter::Args filter_args) {
// Get filter config.
auto* service_config = args.GetObject<ServiceConfig>();
auto service_config = args.GetObjectRef<ServiceConfig>();
if (service_config == nullptr) {
return absl::InvalidArgumentError(
"gcp_auth: no service config in channel args");
@ -185,14 +185,17 @@ GcpAuthenticationFilter::Create(const ChannelArgs& args,
cache->SetMaxSize(filter_config->cache_size);
// Instantiate filter.
return std::unique_ptr<GcpAuthenticationFilter>(new GcpAuthenticationFilter(
filter_config, std::move(xds_config), std::move(cache)));
std::move(service_config), filter_config, std::move(xds_config),
std::move(cache)));
}
GcpAuthenticationFilter::GcpAuthenticationFilter(
RefCountedPtr<ServiceConfig> service_config,
const GcpAuthenticationParsedConfig::Config* filter_config,
RefCountedPtr<const XdsConfig> xds_config,
RefCountedPtr<CallCredentialsCache> cache)
: filter_config_(filter_config),
: service_config_(std::move(service_config)),
filter_config_(filter_config),
xds_config_(std::move(xds_config)),
cache_(std::move(cache)) {}

@ -80,10 +80,14 @@ class GcpAuthenticationFilter
};
GcpAuthenticationFilter(
RefCountedPtr<ServiceConfig> service_config,
const GcpAuthenticationParsedConfig::Config* filter_config,
RefCountedPtr<const XdsConfig> xds_config,
RefCountedPtr<CallCredentialsCache> cache);
// TODO(roth): Consider having the channel stack hold this ref so that
// individual filters don't need to.
const RefCountedPtr<ServiceConfig> service_config_;
const GcpAuthenticationParsedConfig::Config* filter_config_;
const RefCountedPtr<const XdsConfig> xds_config_;
const RefCountedPtr<CallCredentialsCache> cache_;

Loading…
Cancel
Save