diff options
author | Julien Boeuf <jboeuf@google.com> | 2015-08-28 15:51:02 -0700 |
---|---|---|
committer | Julien Boeuf <jboeuf@google.com> | 2015-08-28 15:51:02 -0700 |
commit | 97cd4ae606a39a62c07b0d2ce2687af3ce812645 (patch) | |
tree | 563c81ba4d81c8dc0764ef3557b24dce9a7be5da /src/cpp/client | |
parent | 68ff03a952d1b5395ef1f4ee326f810cd0b55912 (diff) | |
parent | 036bf58b281e4ff65ccc62ea68002a50ddb626cc (diff) |
Merge branch 'master' of github.com:grpc/grpc into cpp_auth_md_processor
Diffstat (limited to 'src/cpp/client')
-rw-r--r-- | src/cpp/client/secure_credentials.cc | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index e0642469b4..2260f6d33e 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -81,26 +81,10 @@ std::shared_ptr<Credentials> SslCredentials( } // Builds credentials for use when running in GCE -std::shared_ptr<Credentials> ComputeEngineCredentials() { +std::shared_ptr<Credentials> GoogleComputeEngineCredentials() { GrpcLibrary init; // To call grpc_init(). - return WrapCredentials(grpc_compute_engine_credentials_create(nullptr)); -} - -// Builds service account credentials. -std::shared_ptr<Credentials> ServiceAccountCredentials( - const grpc::string& json_key, const grpc::string& scope, - long token_lifetime_seconds) { - GrpcLibrary init; // To call grpc_init(). - if (token_lifetime_seconds <= 0) { - gpr_log(GPR_ERROR, - "Trying to create ServiceAccountCredentials " - "with non-positive lifetime"); - return WrapCredentials(nullptr); - } - gpr_timespec lifetime = - gpr_time_from_seconds(token_lifetime_seconds, GPR_TIMESPAN); - return WrapCredentials(grpc_service_account_credentials_create( - json_key.c_str(), scope.c_str(), lifetime, nullptr)); + return WrapCredentials( + grpc_google_compute_engine_credentials_create(nullptr)); } // Builds JWT credentials. @@ -119,10 +103,10 @@ std::shared_ptr<Credentials> ServiceAccountJWTAccessCredentials( } // Builds refresh token credentials. -std::shared_ptr<Credentials> RefreshTokenCredentials( +std::shared_ptr<Credentials> GoogleRefreshTokenCredentials( const grpc::string& json_refresh_token) { GrpcLibrary init; // To call grpc_init(). - return WrapCredentials(grpc_refresh_token_credentials_create( + return WrapCredentials(grpc_google_refresh_token_credentials_create( json_refresh_token.c_str(), nullptr)); } @@ -135,11 +119,11 @@ std::shared_ptr<Credentials> AccessTokenCredentials( } // Builds IAM credentials. -std::shared_ptr<Credentials> IAMCredentials( +std::shared_ptr<Credentials> GoogleIAMCredentials( const grpc::string& authorization_token, const grpc::string& authority_selector) { GrpcLibrary init; // To call grpc_init(). - return WrapCredentials(grpc_iam_credentials_create( + return WrapCredentials(grpc_google_iam_credentials_create( authorization_token.c_str(), authority_selector.c_str(), nullptr)); } |