diff --git a/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc b/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc index 7e51b20dca3..728bf032542 100644 --- a/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +++ b/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc @@ -153,7 +153,7 @@ absl::StatusOr> GcpAuthenticationFilter::Create(const ChannelArgs& args, ChannelFilter::Args filter_args) { // Get filter config. - auto* service_config = args.GetObject(); + auto service_config = args.GetObjectRef(); 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(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 service_config, const GcpAuthenticationParsedConfig::Config* filter_config, RefCountedPtr xds_config, RefCountedPtr 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)) {} diff --git a/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h b/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h index f8fc704c9e8..a3136ebd460 100644 --- a/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +++ b/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h @@ -80,10 +80,14 @@ class GcpAuthenticationFilter }; GcpAuthenticationFilter( + RefCountedPtr service_config, const GcpAuthenticationParsedConfig::Config* filter_config, RefCountedPtr xds_config, RefCountedPtr cache); + // TODO(roth): Consider having the channel stack hold this ref so that + // individual filters don't need to. + const RefCountedPtr service_config_; const GcpAuthenticationParsedConfig::Config* filter_config_; const RefCountedPtr xds_config_; const RefCountedPtr cache_;