diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-02-23 17:13:40 -0800 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-02-23 17:13:40 -0800 |
commit | b9d91eb454ae7f72926e3c9f1dc6f723d23d51e2 (patch) | |
tree | 333eed8b5e106faffe927bc437b831622ed5da2e /include | |
parent | e4fe844b67191b46ee5d1942714e43cb2e12672b (diff) | |
parent | 0b9dfcf02a09d480af681e9c3c1b1f85f5f2978d (diff) |
Merge github.com:google/grpc into deprecate-c++
Conflicts:
test/cpp/end2end/async_end2end_test.cc
test/cpp/end2end/end2end_test.cc
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc++/credentials.h | 20 | ||||
-rw-r--r-- | include/grpc/grpc_security.h | 17 | ||||
-rw-r--r-- | include/grpc/support/atm.h | 4 | ||||
-rw-r--r-- | include/grpc/support/sync.h | 2 | ||||
-rw-r--r-- | include/grpc/support/sync_posix.h | 1 | ||||
-rw-r--r-- | include/grpc/support/sync_win32.h | 1 | ||||
-rw-r--r-- | include/grpc/support/time.h | 2 |
7 files changed, 30 insertions, 17 deletions
diff --git a/include/grpc++/credentials.h b/include/grpc++/credentials.h index ac6f394847..5cbcca3aa5 100644 --- a/include/grpc++/credentials.h +++ b/include/grpc++/credentials.h @@ -86,17 +86,23 @@ struct SslCredentialsOptions { // fail on it. class CredentialsFactory { public: - // Builds credentials with reasonable defaults. - static std::unique_ptr<Credentials> DefaultCredentials(); + // Builds google credentials with reasonable defaults. + // WARNING: Do NOT use this credentials to connect to a non-google service as + // this could result in an oauth2 token leak. + static std::unique_ptr<Credentials> GoogleDefaultCredentials(); // Builds SSL Credentials given SSL specific options static std::unique_ptr<Credentials> SslCredentials( const SslCredentialsOptions& options); // Builds credentials for use when running in GCE + // WARNING: Do NOT use this credentials to connect to a non-google service as + // this could result in an oauth2 token leak. static std::unique_ptr<Credentials> ComputeEngineCredentials(); // Builds service account credentials. + // WARNING: Do NOT use this credentials to connect to a non-google service as + // this could result in an oauth2 token leak. // json_key is the JSON key string containing the client's private key. // scope is a space-delimited list of the requested permissions. // token_lifetime is the lifetime of each token acquired through this service @@ -106,13 +112,21 @@ class CredentialsFactory { const grpc::string& json_key, const grpc::string& scope, std::chrono::seconds token_lifetime); + // Builds JWT credentials. + // json_key is the JSON key string containing the client's private key. + // token_lifetime is the lifetime of each Json Web Token (JWT) created with + // this credentials. It should not exceed grpc_max_auth_token_lifetime or + // will be cropped to this value. + static std::unique_ptr<Credentials> JWTCredentials( + const grpc::string& json_key, std::chrono::seconds token_lifetime); + // Builds IAM credentials. static std::unique_ptr<Credentials> IAMCredentials( const grpc::string& authorization_token, const grpc::string& authority_selector); // Combines two credentials objects into a composite credentials - static std::unique_ptr<Credentials> ComposeCredentials( + static std::unique_ptr<Credentials> CompositeCredentials( const std::unique_ptr<Credentials>& creds1, const std::unique_ptr<Credentials>& creds2); }; diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index 0eae444a9b..4ba4ffc118 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -51,8 +51,10 @@ typedef struct grpc_credentials grpc_credentials; The creator of the credentials object is responsible for its release. */ void grpc_credentials_release(grpc_credentials *creds); -/* Creates default credentials. */ -grpc_credentials *grpc_default_credentials_create(void); +/* Creates default credentials to connect to a google gRPC service. + WARNING: Do NOT use this credentials to connect to a non-google service as + this could result in an oauth2 token leak. */ +grpc_credentials *grpc_google_default_credentials_create(void); /* Environment variable that points to the default SSL roots file. This file must be a PEM encoded file with all the roots such as the one that can be @@ -88,13 +90,17 @@ grpc_credentials *grpc_ssl_credentials_create( grpc_credentials *grpc_composite_credentials_create(grpc_credentials *creds1, grpc_credentials *creds2); -/* Creates a compute engine credentials object. */ +/* Creates a compute engine credentials object. + WARNING: Do NOT use this credentials to connect to a non-google service as + this could result in an oauth2 token leak. */ grpc_credentials *grpc_compute_engine_credentials_create(void); extern const gpr_timespec grpc_max_auth_token_lifetime; /* Creates a service account credentials object. May return NULL if the input is invalid. + WARNING: Do NOT use this credentials to connect to a non-google service as + this could result in an oauth2 token leak. - json_key is the JSON key string containing the client's private key. - scope is a space-delimited list of the requested permissions. - token_lifetime is the lifetime of each token acquired through this service @@ -129,11 +135,6 @@ grpc_credentials *grpc_iam_credentials_create(const char *authorization_token, channel, it will just be ignored. */ #define GRPC_SSL_TARGET_NAME_OVERRIDE_ARG "grpc.ssl_target_name_override" -/* Creates a default secure channel using the default credentials object using - the environment. */ -grpc_channel *grpc_default_secure_channel_create(const char *target, - const grpc_channel_args *args); - /* Creates a secure channel using the passed-in credentials. */ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds, const char *target, diff --git a/include/grpc/support/atm.h b/include/grpc/support/atm.h index 0cac9bf586..f1e30d31e8 100644 --- a/include/grpc/support/atm.h +++ b/include/grpc/support/atm.h @@ -51,12 +51,12 @@ The routines may be implemented as macros. - // Atomic operations acton an intergral_type gpr_atm that is guaranteed to + // Atomic operations act on an intergral_type gpr_atm that is guaranteed to // be the same size as a pointer. typedef gpr_intptr gpr_atm; // A memory barrier, providing both acquire and release semantics, but not - // otherwise acting no memory. + // otherwise acting on memory. void gpr_atm_full_barrier(void); // Atomically return *p, with acquire semantics. diff --git a/include/grpc/support/sync.h b/include/grpc/support/sync.h index 4437375db7..bc99317f3c 100644 --- a/include/grpc/support/sync.h +++ b/include/grpc/support/sync.h @@ -206,7 +206,7 @@ void *gpr_event_cancellable_wait(gpr_event *ev, gpr_timespec abs_deadline, /* --- Reference counting --- - These calls act on the type gpr_refcount. It requires no desctruction. */ + These calls act on the type gpr_refcount. It requires no destruction. */ /* Initialize *r to value n. */ void gpr_ref_init(gpr_refcount *r, int n); diff --git a/include/grpc/support/sync_posix.h b/include/grpc/support/sync_posix.h index 413226a9e8..8ba2c5b892 100644 --- a/include/grpc/support/sync_posix.h +++ b/include/grpc/support/sync_posix.h @@ -36,7 +36,6 @@ #include <grpc/support/sync_generic.h> -/* Posix variant of gpr_sync_platform.h */ #include <pthread.h> typedef pthread_mutex_t gpr_mu; diff --git a/include/grpc/support/sync_win32.h b/include/grpc/support/sync_win32.h index 5a48b52a2d..13823b8ee3 100644 --- a/include/grpc/support/sync_win32.h +++ b/include/grpc/support/sync_win32.h @@ -36,7 +36,6 @@ #include <grpc/support/sync_generic.h> -/* Win32 variant of gpr_sync_platform.h */ #include <windows.h> typedef struct { diff --git a/include/grpc/support/time.h b/include/grpc/support/time.h index ebc18c91e9..150b7ac8c5 100644 --- a/include/grpc/support/time.h +++ b/include/grpc/support/time.h @@ -76,7 +76,7 @@ gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b); gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b); gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b); -/* Return a timespec representing a given number of microseconds. LONG_MIN is +/* Return a timespec representing a given number of time units. LONG_MIN is interpreted as gpr_inf_past, and LONG_MAX as gpr_inf_future. */ gpr_timespec gpr_time_from_micros(long x); gpr_timespec gpr_time_from_nanos(long x); |