diff --git a/contrib/endpoints/src/api_manager/config_test.cc b/contrib/endpoints/src/api_manager/config_test.cc index c0aa2c16940..d9170ddf131 100644 --- a/contrib/endpoints/src/api_manager/config_test.cc +++ b/contrib/endpoints/src/api_manager/config_test.cc @@ -883,10 +883,32 @@ api_check_security_rules_config { Config::Create(&env, kServiceNameConfig, server_config); ASSERT_TRUE(config); - auto server = config->GetFirebaseServer(); - ASSERT_EQ(server, "https://myfirebaseserver.com/"); + ASSERT_EQ(config->GetFirebaseServer(), "https://myfirebaseserver.com/"); } +TEST(Config, TestEmptyFirebaseServerCheck) { + MockApiManagerEnvironmentWithLog env; + + static const char server_config[] = R"( +service_control_config { + check_aggregator_config { + cache_entries: 1000 + flush_interval_ms: 10 + response_expiration_ms: 20 + } + report_aggregator_config { + cache_entries: 1020 + flush_interval_ms: 15 + } +} +)"; + + std::unique_ptr config = + Config::Create(&env, kServiceNameConfig, server_config); + ASSERT_TRUE(config); + + ASSERT_TRUE(config->GetFirebaseServer().empty()); +} } // namespace } // namespace api_manager diff --git a/contrib/endpoints/src/api_manager/context/service_context.h b/contrib/endpoints/src/api_manager/context/service_context.h index c0c65626eb2..18761b52cfd 100644 --- a/contrib/endpoints/src/api_manager/context/service_context.h +++ b/contrib/endpoints/src/api_manager/context/service_context.h @@ -69,10 +69,7 @@ class ServiceContext { return RequireAuth() && service().apis_size() > 0 && config_->server_config() && config_->server_config()->has_api_check_security_rules_config() && - !config_->server_config() - ->api_check_security_rules_config() - .firebase_server() - .empty(); + !config_->GetFirebaseServer().empty(); } auth::Certs &certs() { return certs_; }