diff options
author | Julien Boeuf <jboeuf@google.com> | 2015-08-31 13:25:21 -0700 |
---|---|---|
committer | Julien Boeuf <jboeuf@google.com> | 2015-08-31 13:25:21 -0700 |
commit | 8b5bb27d34573c8ce6beae15971e563127024488 (patch) | |
tree | fe37f9bf5685048e7a80496830f0484f9a515075 | |
parent | 519e27d84583398192d9db11627419b052672659 (diff) |
Adding C API for metadata credentials plugin.
-rw-r--r-- | include/grpc/grpc_security.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index 049ab3c4be..a5981937f1 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -131,6 +131,32 @@ grpc_credentials *grpc_google_iam_credentials_create( const char *authorization_token, const char *authority_selector, void *reserved); +/* Callback function to be called by the metadata credentials plugin + implementation when the metadata is ready. */ +typedef void (*grpc_credentials_plugin_metadata_cb)( + void *user_data, const grpc_metadata *creds_md, size_t num_creds_md, + grpc_status_code status, const char *error_details); + +typedef struct { + /* The implementation of this method has to be non-blocking. + - service_url is the fully qualified URL that the client stack is + connecting to. + - cb is the callback that needs to be called when the metadata is ready. + - user_data needs to be passed as the first parameter of the callback. */ + void (*get_metadata)(void *state, const char *service_url, + grpc_credentials_plugin_metadata_cb cb, void *user_data); + + /* Destroys the plugin state. */ + void (*destroy)(void *state); + + /* State that will be set as the first parameter of the methods above. */ + void *state; +} grpc_metadata_credentials_plugin; + +/* Creates a credentials object +grpc_credentials *grpc_metadata_credentials_create_from_plugin( + grpc_metadata_credentials_plugin plugin, void *reserved); + /* --- Secure channel creation. --- */ /* Creates a secure channel using the passed-in credentials. */ |