Skip to content
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

Update the auth check to use service.experimental.authorization.provider #67

Merged
merged 14 commits into from
Feb 8, 2017
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.

4 changes: 3 additions & 1 deletion contrib/endpoints/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ cc_proto_library(
"google/api/control.proto",
"google/api/documentation.proto",
"google/api/endpoint.proto",
"google/api/experimental/authorization_config.proto",
"google/api/experimental/experimental.proto",
"google/api/http.proto",
"google/api/label.proto",
"google/api/log.proto",
Expand Down Expand Up @@ -293,7 +295,7 @@ cc_proto_library(

native.new_git_repository(
name = "googleapis_git",
commit = "db1d4547dc56a798915e0eb2c795585385922165",
commit = "412867fb105722fb9d2cd9af90af1f8f120de238",
remote = "https://github.com/googleapis/googleapis.git",
build_file_content = BUILD,
)
Expand Down
16 changes: 13 additions & 3 deletions contrib/endpoints/src/api_manager/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,21 @@ void Config::SetJwksUri(const string &issuer, const string &jwks_uri,
}

std::string Config::GetFirebaseServer() {
if (server_config_ == nullptr) {
return "";
if (server_config_ != nullptr &&
server_config_->has_api_check_security_rules_config() &&
!server_config_->api_check_security_rules_config().firebase_server().empty()) {
// It is the testing environment, use server config.
return server_config_->api_check_security_rules_config().firebase_server();
}

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

} // namespace api_manager
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
Loading