Skip to content
14 changes: 0 additions & 14 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/proxy.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

354 changes: 0 additions & 354 deletions .idea/workspace.xml

This file was deleted.

8 changes: 8 additions & 0 deletions contrib/endpoints/src/api_manager/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,17 @@ void Config::SetJwksUri(const string &issuer, const string &jwks_uri,

std::string Config::GetFirebaseServer() {
if (server_config_ == nullptr) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is not sufficient. You need to check the following:

if (server_config_ && !server_config_->api_check_security_rules_config()->firebase_server().empty) {
return server_config_->api_check_security_rules_config().firebase_server();
}

Then you can add the code you have added.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will also need to update the config unit tests to check the behavior.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this review is based on an old version. Updated anyway. Is the following check enough? What if server_config_ is not null, but server_config_->api_check_security_rules_config() is null?

if (server_config_ && !server_config_->api_check_security_rules_config()->firebase_server().empty)

if (service_.has_experimental() &&
service_.experimental().has_authorization() &&
service_.experimental().authorization().has_provider()) {
// In real environment, server_config_ should be null. And we rely on the
// field in service.
return service_.experimental().authorization().provider();
}
return "";
}

// It is the testing environment, use server config.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By design, server_config over-ride service_config. Please check server_config first.

Server_config may have other fields, only if it doesn't have firebase server field, check service_config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return server_config_->api_check_security_rules_config().firebase_server();
}

Expand Down
4 changes: 1 addition & 3 deletions contrib/endpoints/src/api_manager/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ class Config {
// TODO: Remove in favor of service().
const std::string &service_name() const { return service_.name(); }

bool HasAuth() const { return service_.has_experimental() &&
service_.experimental().has_authorization() &&
service_.experimental().authorization().has_provider(); }
bool HasAuth() const { return service_.has_authentication(); }

// Returns true if the caller should try openId discovery to fetch jwksUri.
// url is set to the openId discovery link in this case. Returns false
Expand Down