Skip to content
Snippets Groups Projects
Commit 8b78c284 authored by Julien Boeuf's avatar Julien Boeuf
Browse files

First draft at addressing #1799 for grpc_security.

- Will make all the changes everywhere once we reach consensus.
parent 591c8ee8
No related branches found
No related tags found
No related merge requests found
...@@ -206,8 +206,7 @@ typedef struct grpc_metadata { ...@@ -206,8 +206,7 @@ typedef struct grpc_metadata {
/** The following fields are reserved for grpc internal use. /** The following fields are reserved for grpc internal use.
There is no need to initialize them, and they will be set to garbage There is no need to initialize them, and they will be set to garbage
during during calls to grpc. */
calls to grpc. */
struct { struct {
void *obfuscated[4]; void *obfuscated[4];
} internal_data; } internal_data;
...@@ -378,11 +377,11 @@ typedef struct grpc_op { ...@@ -378,11 +377,11 @@ typedef struct grpc_op {
/** Registers a plugin to be initialized and destroyed with the library. /** Registers a plugin to be initialized and destroyed with the library.
The \a init and \a destroy functions will be invoked as part of The \a init and \a destroy functions will be invoked as part of
\a grpc_init() and \a grpc_shutdown(), respectively. \a grpc_init() and \a grpc_shutdown(), respectively.
Note that these functions can be invoked an arbitrary number of times Note that these functions can be invoked an arbitrary number of times
(and hence so will \a init and \a destroy). (and hence so will \a init and \a destroy).
It is safe to pass NULL to either argument. Plugins are destroyed in It is safe to pass NULL to either argument. Plugins are destroyed in
the reverse order they were initialized. */ the reverse order they were initialized. */
void grpc_register_plugin(void (*init)(void), void (*destroy)(void)); void grpc_register_plugin(void (*init)(void), void (*destroy)(void));
......
...@@ -89,16 +89,18 @@ typedef struct { ...@@ -89,16 +89,18 @@ typedef struct {
key and certificate chain. This parameter can be NULL if the client does key and certificate chain. This parameter can be NULL if the client does
not have such a key/cert pair. */ not have such a key/cert pair. */
grpc_credentials *grpc_ssl_credentials_create( grpc_credentials *grpc_ssl_credentials_create(
const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair); const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair,
void *reserved);
/* Creates a composite credentials object. */ /* Creates a composite credentials object. */
grpc_credentials *grpc_composite_credentials_create(grpc_credentials *creds1, grpc_credentials *grpc_composite_credentials_create(grpc_credentials *creds1,
grpc_credentials *creds2); grpc_credentials *creds2,
void *reserved);
/* 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 WARNING: Do NOT use this credentials to connect to a non-google service as
this could result in an oauth2 token leak. */ this could result in an oauth2 token leak. */
grpc_credentials *grpc_compute_engine_credentials_create(void); grpc_credentials *grpc_compute_engine_credentials_create(void *reserved);
extern const gpr_timespec grpc_max_auth_token_lifetime; extern const gpr_timespec grpc_max_auth_token_lifetime;
...@@ -112,7 +114,8 @@ extern const gpr_timespec grpc_max_auth_token_lifetime; ...@@ -112,7 +114,8 @@ extern const gpr_timespec grpc_max_auth_token_lifetime;
account credentials. It should not exceed grpc_max_auth_token_lifetime account credentials. It should not exceed grpc_max_auth_token_lifetime
or will be cropped to this value. */ or will be cropped to this value. */
grpc_credentials *grpc_service_account_credentials_create( grpc_credentials *grpc_service_account_credentials_create(
const char *json_key, const char *scope, gpr_timespec token_lifetime); const char *json_key, const char *scope, gpr_timespec token_lifetime,
void *reserved);
/* Creates a JWT credentials object. May return NULL if the input is invalid. /* Creates a JWT credentials object. May return NULL if the input is invalid.
- json_key is the JSON key string containing the client's private key. - json_key is the JSON key string containing the client's private key.
...@@ -120,7 +123,7 @@ grpc_credentials *grpc_service_account_credentials_create( ...@@ -120,7 +123,7 @@ grpc_credentials *grpc_service_account_credentials_create(
this credentials. It should not exceed grpc_max_auth_token_lifetime or this credentials. It should not exceed grpc_max_auth_token_lifetime or
will be cropped to this value. */ will be cropped to this value. */
grpc_credentials *grpc_service_account_jwt_access_credentials_create( grpc_credentials *grpc_service_account_jwt_access_credentials_create(
const char *json_key, gpr_timespec token_lifetime); const char *json_key, gpr_timespec token_lifetime, void *reserved);
/* Creates an Oauth2 Refresh Token credentials object. May return NULL if the /* Creates an Oauth2 Refresh Token credentials object. May return NULL if the
input is invalid. input is invalid.
...@@ -129,16 +132,17 @@ grpc_credentials *grpc_service_account_jwt_access_credentials_create( ...@@ -129,16 +132,17 @@ grpc_credentials *grpc_service_account_jwt_access_credentials_create(
- json_refresh_token is the JSON string containing the refresh token itself - json_refresh_token is the JSON string containing the refresh token itself
along with a client_id and client_secret. */ along with a client_id and client_secret. */
grpc_credentials *grpc_refresh_token_credentials_create( grpc_credentials *grpc_refresh_token_credentials_create(
const char *json_refresh_token); const char *json_refresh_token, void *reserved);
/* Creates an Oauth2 Access Token credentials with an access token that was /* Creates an Oauth2 Access Token credentials with an access token that was
aquired by an out of band mechanism. */ aquired by an out of band mechanism. */
grpc_credentials *grpc_access_token_credentials_create( grpc_credentials *grpc_access_token_credentials_create(
const char *access_token); const char *access_token, void *reserved);
/* Creates an IAM credentials object. */ /* Creates an IAM credentials object. */
grpc_credentials *grpc_iam_credentials_create(const char *authorization_token, grpc_credentials *grpc_iam_credentials_create(const char *authorization_token,
const char *authority_selector); const char *authority_selector,
void *reserved);
/* --- Secure channel creation. --- */ /* --- Secure channel creation. --- */
...@@ -154,7 +158,8 @@ grpc_credentials *grpc_iam_credentials_create(const char *authorization_token, ...@@ -154,7 +158,8 @@ grpc_credentials *grpc_iam_credentials_create(const char *authorization_token,
/* Creates a secure channel using the passed-in credentials. */ /* Creates a secure channel using the passed-in credentials. */
grpc_channel *grpc_secure_channel_create(grpc_credentials *creds, grpc_channel *grpc_secure_channel_create(grpc_credentials *creds,
const char *target, const char *target,
const grpc_channel_args *args); const grpc_channel_args *args,
void *reserved);
/* --- grpc_server_credentials object. --- /* --- grpc_server_credentials object. ---
...@@ -180,7 +185,7 @@ void grpc_server_credentials_release(grpc_server_credentials *creds); ...@@ -180,7 +185,7 @@ void grpc_server_credentials_release(grpc_server_credentials *creds);
NULL. */ NULL. */
grpc_server_credentials *grpc_ssl_server_credentials_create( grpc_server_credentials *grpc_ssl_server_credentials_create(
const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs,
size_t num_key_cert_pairs, int force_client_auth); size_t num_key_cert_pairs, int force_client_auth, void *reserved);
/* --- Server-side secure ports. --- */ /* --- Server-side secure ports. --- */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment