aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/security/credentials.h
diff options
context:
space:
mode:
authorGravatar Julien Boeuf <jboeuf@google.com>2015-05-29 13:12:12 -0700
committerGravatar Julien Boeuf <jboeuf@google.com>2015-05-29 13:12:12 -0700
commit75c9b6f49519d7c616628905f2e58782206c98d2 (patch)
treee7285a2a1b6f5c6dea552587f0fd615106592d74 /src/core/security/credentials.h
parent5e9757bf0f8ada75068038c3e29d8b1e875d2ce3 (diff)
Removing mdctx from the credentials.
Diffstat (limited to 'src/core/security/credentials.h')
-rw-r--r--src/core/security/credentials.h41
1 files changed, 31 insertions, 10 deletions
diff --git a/src/core/security/credentials.h b/src/core/security/credentials.h
index 87c773e49a..4768ce6990 100644
--- a/src/core/security/credentials.h
+++ b/src/core/security/credentials.h
@@ -82,13 +82,40 @@ typedef enum {
#define GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING \
"client_id=%s&client_secret=%s&refresh_token=%s&grant_type=refresh_token"
+/* --- grpc_credentials_md. --- */
+
+typedef struct {
+ gpr_slice key;
+ gpr_slice value;
+} grpc_credentials_md;
+
+typedef struct {
+ grpc_credentials_md *entries;
+ size_t num_entries;
+ size_t allocated;
+ gpr_refcount refcount;
+} grpc_credentials_md_store;
+
+grpc_credentials_md_store *grpc_credentials_md_store_create(
+ size_t initial_capacity);
+
+/* Will ref key and value. */
+void grpc_credentials_md_store_add(grpc_credentials_md_store *store,
+ gpr_slice key, gpr_slice value);
+void grpc_credentials_md_store_add_cstrings(grpc_credentials_md_store *store,
+ const char *key, const char *value);
+grpc_credentials_md_store *grpc_credentials_md_store_ref(
+ grpc_credentials_md_store *store);
+void grpc_credentials_md_store_unref(grpc_credentials_md_store *store);
+
+
/* --- grpc_credentials. --- */
/* It is the caller's responsibility to gpr_free the result if not NULL. */
char *grpc_get_well_known_google_credentials_file_path(void);
typedef void (*grpc_credentials_metadata_cb)(void *user_data,
- grpc_mdelem **md_elems,
+ grpc_credentials_md *md_elems,
size_t num_md,
grpc_credentials_status status);
@@ -96,7 +123,6 @@ typedef struct {
void (*destroy)(grpc_credentials *c);
int (*has_request_metadata)(const grpc_credentials *c);
int (*has_request_metadata_only)(const grpc_credentials *c);
- grpc_mdctx *(*get_metadata_context)(grpc_credentials *c);
void (*get_request_metadata)(grpc_credentials *c,
const char *service_url,
grpc_credentials_metadata_cb cb,
@@ -123,11 +149,6 @@ void grpc_credentials_get_request_metadata(grpc_credentials *creds,
grpc_credentials_metadata_cb cb,
void *user_data);
-/* Gets the mdctx from the credentials and increase the refcount if it exists,
- otherwise, create a new one. */
-grpc_mdctx *grpc_credentials_get_or_create_metadata_context(
- grpc_credentials *creds);
-
/* Creates a security connector for the channel. May also create new channel
args for the channel to be used in place of the passed in const args if
returned non NULL. In that case the caller is responsible for destroying
@@ -155,9 +176,9 @@ grpc_credentials *grpc_credentials_contains_type(
/* Exposed for testing only. */
grpc_credentials_status
- grpc_oauth2_token_fetcher_credentials_parse_server_response(
- const struct grpc_httpcli_response *response, grpc_mdctx *ctx,
- grpc_mdelem **token_elem, gpr_timespec *token_lifetime);
+grpc_oauth2_token_fetcher_credentials_parse_server_response(
+ const struct grpc_httpcli_response *response, grpc_credentials_md_store **token_md,
+ gpr_timespec *token_lifetime);
/* Simulates an oauth2 token fetch with the specified value for testing. */
grpc_credentials *grpc_fake_oauth2_credentials_create(