-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Update the auth check to use service.experimental.authorization.provider #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
2da31e2
598d1b1
1e3a82d
478ae1d
0eee367
93ed1cc
b8ca462
1fd53e0
bdfe1fc
05df900
2e55ff7
519b540
d33154d
0d78984
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -515,9 +515,17 @@ void Config::SetJwksUri(const string &issuer, const string &jwks_uri, | |
|
|
||
| std::string Config::GetFirebaseServer() { | ||
| if (server_config_ == nullptr) { | ||
| 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. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| return server_config_->api_check_security_rules_config().firebase_server(); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)