Skip to content

Commit

Permalink
Add error logs when credentials are created with non-positive lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
yang-g committed Mar 13, 2015
1 parent 05e3eef commit 94e296c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cpp/client/secure_credentials.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ std::unique_ptr<Credentials> ServiceAccountCredentials(
const grpc::string& json_key, const grpc::string& scope,
std::chrono::seconds token_lifetime) {
if (token_lifetime.count() <= 0) {
gpr_log(GPR_ERROR,
"Trying to create JWTCredentials with non-positive lifetime");
return WrapCredentials(nullptr);
}
gpr_timespec lifetime = gpr_time_from_seconds(token_lifetime.count());
Expand All @@ -110,6 +112,8 @@ std::unique_ptr<Credentials> ServiceAccountCredentials(
std::unique_ptr<Credentials> JWTCredentials(
const grpc::string &json_key, std::chrono::seconds token_lifetime) {
if (token_lifetime.count() <= 0) {
gpr_log(GPR_ERROR,
"Trying to create JWTCredentials with non-positive lifetime");
return WrapCredentials(nullptr);
}
gpr_timespec lifetime = gpr_time_from_seconds(token_lifetime.count());
Expand Down

0 comments on commit 94e296c

Please sign in to comment.